/* Matilda on Basecoat: amethyst and srg palettes, Inter and Fraunces, loaded after basecoat.min.css. */

@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/static/fonts/inter-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Fraunces'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('/static/fonts/fraunces-latin.woff2') format('woff2');
}

/* Hex only: the dashboard charts read these at runtime, and Chart.js cannot parse oklch. */
:root {
  color-scheme: light;
  --radius: 0.625rem;
  --background: #FCFCFD;
  --foreground: #2B1540;
  --card: #FFFFFF;
  --card-foreground: #2B1540;
  --popover: #FFFFFF;
  --popover-foreground: #2B1540;
  --primary: #5A2E7A;
  --primary-foreground: #FFFFFF;
  --secondary: #EFE6F5;
  --secondary-foreground: #391A4C;
  --muted: #F1EAF6;
  --muted-foreground: #6E5E7A;
  --accent: #EFE6F5;
  --accent-foreground: #391A4C;
  --destructive: #B23A48;
  --border: #E3D8EC;
  --input: #E3D8EC;
  --ring: #8A3FFC;
  --chart-1: #8A3FFC;
  --chart-2: #5A2E7A;
  --chart-3: #B58BDA;
  --chart-4: #3F7D58;
  --chart-5: #B5842E;
  --chart-fill: #8A3FFC24;
  --sidebar: #F1EBF6;
  --sidebar-foreground: #2B1540;
  --sidebar-primary: #5A2E7A;
  --sidebar-primary-foreground: #FFFFFF;
  --sidebar-accent: #E5DAEE;
  --sidebar-accent-foreground: #2B1540;
  --sidebar-border: #E3D8EC;
  --sidebar-ring: #8A3FFC;
  --sidebar-width: 11.5rem;
  --warn: #B5842E;
  --ok: #3F7D58;
  --chart-muted: #A99BB5;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-heading: var(--font-sans);
  --font-brand: 'Fraunces', 'Iowan Old Style', Palatino, Georgia, serif;
}

.dark {
  color-scheme: dark;
  --background: #120A1C;
  --foreground: #F2EAF8;
  --card: #1B1027;
  --card-foreground: #F2EAF8;
  --popover: #1B1027;
  --popover-foreground: #F2EAF8;
  --primary: #A97BFF;
  --primary-foreground: #140B20;
  --secondary: #2A1B3C;
  --secondary-foreground: #F2EAF8;
  --muted: #221531;
  --muted-foreground: #A592B6;
  --accent: #2E1E46;
  --accent-foreground: #F2EAF8;
  --destructive: #F27D8A;
  --border: #C8A0FF24;
  --input: #C8A0FF2E;
  --ring: #A97BFF;
  --chart-1: #A97BFF;
  --chart-2: #C9A7F0;
  --chart-3: #7C3AED;
  --chart-4: #6FBF8F;
  --chart-5: #D9B45A;
  --chart-fill: #A97BFF2B;
  --sidebar: #160D21;
  --sidebar-foreground: #F2EAF8;
  --sidebar-primary: #A97BFF;
  --sidebar-primary-foreground: #140B20;
  --sidebar-accent: #2A1B3C;
  --sidebar-accent-foreground: #F2EAF8;
  --sidebar-border: #C8A0FF24;
  --sidebar-ring: #A97BFF;
  --warn: #D9B45A;
  --ok: #6FBF8F;
  --chart-muted: #B8A8C6;
}

/* SRG palette. #CD9933 is the mark; light mode deepens it for contrast, dark mode uses the swoosh. */
:root[data-palette="srg"] {
  color-scheme: light;
  --background: #F6F2E8;
  --foreground: #1A140C;
  --card: #FFFCF6;
  --card-foreground: #1A140C;
  --popover: #FFFCF6;
  --popover-foreground: #1A140C;
  --primary: #7C5E14;
  --primary-foreground: #FFFCF6;
  --secondary: #EFE6D2;
  --secondary-foreground: #2A2114;
  --muted: #F0E9D8;
  --muted-foreground: #6A5E4E;
  --accent: #EFE6D2;
  --accent-foreground: #2A2114;
  --destructive: #B23A48;
  --border: #E3D6C0;
  --input: #E3D6C0;
  --ring: #8A6414;
  --chart-1: #8A6414;
  --chart-2: #7C5E14;
  --chart-3: #5C4A32;
  --chart-4: #2F6B48;
  --chart-5: #8A4E10;
  --chart-fill: #CD993328;
  --sidebar: #F3ECDE;
  --sidebar-foreground: #1A140C;
  --sidebar-primary: #7C5E14;
  --sidebar-primary-foreground: #FFFCF6;
  --sidebar-accent: #E7DCC4;
  --sidebar-accent-foreground: #1A140C;
  --sidebar-border: #E3D6C0;
  --sidebar-ring: #8A6414;
  --warn: #8A4E10;
  --ok: #2F6B48;
  --chart-muted: #74685A;
}

:root[data-palette="srg"].dark {
  color-scheme: dark;
  --background: #0E0D0B;
  --foreground: #F6F1E6;
  --card: #171512;
  --card-foreground: #F6F1E6;
  --popover: #1C1914;
  --popover-foreground: #F6F1E6;
  --primary: #CD9933;
  --primary-foreground: #1A1408;
  --secondary: #2A241A;
  --secondary-foreground: #F6F1E6;
  --muted: #221E17;
  --muted-foreground: #B7AA94;
  --accent: #322A1C;
  --accent-foreground: #F6F1E6;
  --destructive: #F27D8A;
  --border: #CD993330;
  --input: #CD993340;
  --ring: #E0B04A;
  --chart-1: #E0B04A;
  --chart-2: #CD9933;
  --chart-3: #F0D7A2;
  --chart-4: #6FBF8F;
  --chart-5: #E08A3C;
  --chart-fill: #CD99332E;
  --sidebar: #120F0C;
  --sidebar-foreground: #F6F1E6;
  --sidebar-primary: #CD9933;
  --sidebar-primary-foreground: #1A1408;
  --sidebar-accent: #2A241A;
  --sidebar-accent-foreground: #F6F1E6;
  --sidebar-border: #CD993330;
  --sidebar-ring: #E0B04A;
  --warn: #E08A3C;
  --ok: #6FBF8F;
  --chart-muted: #A89880;
}

body { font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation: none !important; }
}

/* Typography */
h1 { font-family: var(--font-heading); font-weight: 650; font-size: 28px; letter-spacing: -.025em;
  line-height: 1.15; }
h2 { font-weight: 600; font-size: 16px; letter-spacing: -.015em; }
.muted { color: var(--muted-foreground); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.none { color: var(--muted-foreground); font-style: italic; }
.mono { font-family: var(--font-mono); font-size: 12.5px; overflow-wrap: anywhere; }
.wordmark { font-family: var(--font-brand); font-weight: 600; font-size: 22px; letter-spacing: -.01em; }
pre.prompt { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; font-family: var(--font-mono);
  font-size: 12.5px; line-height: 1.65; }
a.link { color: var(--primary); font-weight: 500; }
a.link:hover { text-decoration: underline; }
.wrap { overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }

/* Layout */
.page { max-width: 1120px; margin: 0 auto; padding: 24px 32px 80px; }
.page > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; margin-bottom: 20px; }
.page > header p { margin: 4px 0 0; color: var(--muted-foreground); }
.topbar { display: none; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border);
  background: var(--background); position: sticky; top: 0; z-index: 10; }
/* Ambient field across the signed-in shell, on body so the sidebar gutter is not a solid plate. */
html:has(.shell-stage) { background-color: var(--background); }
body:has(.shell-stage) { background-color: transparent; }
body:has(.shell-stage)::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(circle at center, color-mix(in srgb, var(--foreground) 9%, transparent) .8px, transparent 1.2px);
  background-size: 12px 12px; background-position: 6px 6px;
  /* Wide enough that the floating rail sits on the field, not a blank plate. */
  -webkit-mask-image: radial-gradient(ellipse 120% 80% at 50% 50%, #000 30%, transparent 100%);
  mask-image: radial-gradient(ellipse 120% 80% at 50% 50%, #000 30%, transparent 100%); }
html[data-pattern="crosses"]:has(.shell-stage) body::before {
  background-image: none;
  background-color: color-mix(in srgb, var(--foreground) 11%, transparent);
  -webkit-mask-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23000' stroke-width='1' stroke-linecap='round'%3E%3Cpath d='M6 3.5v5M3.5 6h5'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 120% 80% at 50% 50%, #000 30%, transparent 100%);
  -webkit-mask-size: 12px 12px, 100% 100%;
  -webkit-mask-repeat: repeat, no-repeat;
  -webkit-mask-composite: source-in;
  mask-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23000' stroke-width='1' stroke-linecap='round'%3E%3Cpath d='M6 3.5v5M3.5 6h5'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 120% 80% at 50% 50%, #000 30%, transparent 100%);
  mask-size: 12px 12px, 100% 100%;
  mask-repeat: repeat, no-repeat;
  mask-composite: intersect; }
.shell-stage > main { background-color: transparent; }
.stack { display: grid; gap: 20px; }
.stack > .card { min-width: 0; }
.stack-sm { display: grid; gap: 10px; }
.cluster { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cluster .grow { flex: 1; min-width: 180px; }
.end { margin-left: auto; }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
/* Profile's service bubbles (bubbles.js): size says state, connected largest. */
/* "Apps" with a small search beside it: the magnifier opens a field that narrows the cloud. */
.pf-apps-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 6px; }
.pf-apps-head > h2 { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted-foreground); }
.pf-apps-find { display: flex; align-items: center; height: 28px; border-radius: 999px; transition: background .2s ease; }
.pf-apps-find[data-open=true] { background: var(--muted); }
.pf-apps-find > button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%;
  background: none; color: var(--muted-foreground); cursor: pointer; }
.pf-apps-find > button:hover { color: var(--foreground); }
.pf-apps-find svg { width: 15px; height: 15px; }
.pf-apps-find > input { width: 0; padding: 0; border: 0; outline: none; background: none; color: inherit; font-size: 13px;
  opacity: 0; transition: width .22s ease, padding .22s ease, opacity .15s ease; }
.pf-apps-find[data-open=true] > input { width: 150px; padding-right: 12px; opacity: 1; }
.pf-apps-find > input::-webkit-search-cancel-button { display: none; }
.svc-bubble[hidden] { display: none; }
.svc-none { margin: 8px 0; }
.svc-cloud-wrap { display: grid; justify-items: center; gap: 14px; }
.svc-cloud { --cell: 96px; position: relative; width: 100%; display: flex; flex-wrap: wrap; justify-content: center;
  align-items: center; gap: 12px; }
.svc-cloud.packed { display: block; }
.svc-bubble { --size: calc(var(--cell) * .64); display: grid; place-items: center; width: var(--size); height: var(--size);
  padding: 0; border: 0; border-radius: 50%; background: #FFFFFF; cursor: pointer;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--foreground) 12%, transparent),
              0 0 0 1px color-mix(in srgb, var(--foreground) 5%, transparent);
  transition: scale .15s ease, box-shadow .15s ease, opacity .15s ease; }
.svc-cloud.packed .svc-bubble { position: absolute; translate: -50% -50%; }
.svc-bubble img { width: 46%; height: 46%; object-fit: contain; pointer-events: none; }
.svc-bubble[data-state=connected] { --size: calc(var(--cell) * .92); }
.svc-bubble[data-state=reauth] { --size: calc(var(--cell) * .78); }
.svc-bubble[data-state=setup] { --size: calc(var(--cell) * .52); opacity: .55; }
.svc-bubble[data-state=setup] img { filter: grayscale(1); }
.svc-bubble:hover, .svc-bubble:focus-visible { scale: 1.08; opacity: 1; }
.svc-bubble[aria-expanded=true] { scale: 1.08; opacity: 1;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--foreground) 18%, transparent), 0 0 0 2px var(--primary); }
/* A small status dot: green when connected, red when it needs signing in again. */
.svc-bubble:is([data-state=connected],[data-state=reauth])::after { content: ""; position: absolute; right: 8%; bottom: 8%;
  width: 14%; height: 14%; min-width: 9px; min-height: 9px; border-radius: 50%; background: var(--ok, #2E9E5B);
  box-shadow: 0 0 0 2px #FFFFFF; }
.svc-bubble[data-state=reauth]::after { background: var(--destructive); }
/* Hovered or picked, a bubble and its name sit above its neighbours. */
.svc-bubble:is(:hover, :focus-visible, [aria-expanded=true]) { z-index: 2; }
/* A picked app's details: one quiet line under the cloud. */
.svc-detail:not([hidden]) { display: flex; align-items: center; gap: 12px; width: min(520px, 100%); padding: 12px 14px;
  border-radius: 14px; background: var(--muted); flex-wrap: wrap; }
.svc-detail-text { display: grid; flex: 1; min-width: 160px; line-height: 1.35; }
.svc-detail form { margin: 0; }
/* A member's picture fills their avatar circle. */
.avatar > img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }

/* Profile: one column, no cards; a pencil turns a label/value row into a field. */
.pf { max-width: 720px; margin: 0 auto; display: grid; gap: 40px; }
/* One column: the apps right under who they are, then the settings. */
.pf-body { display: grid; gap: 40px; }
.pf-hero { display: flex; align-items: center; gap: 20px; min-width: 0; }
.pf-pic { width: 84px; height: 84px; font-size: 30px; flex: none; }
.pf-id { display: grid; gap: 2px; min-width: 0; flex: 1; }
.pf-id h1 { margin: 0; font-size: 26px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-title { color: var(--muted-foreground); font-size: 15px; }
.pf-meta { margin: 4px 0 0; color: var(--muted-foreground); font-size: 13px; }
.pf-tools { display: flex; align-items: center; gap: 8px; align-self: flex-start; flex: none; }
/* Icon-only segmented choices: a square button per option. */
.seg-icons > button { width: 30px; padding: 0; justify-content: center; }
.seg-icons > button .palette-swatch { width: 14px; height: 14px; }
.pf-sec { display: grid; }
.pf-sec > h2 { margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted-foreground); }
.pf-row { display: grid; grid-template-columns: 140px minmax(0, 1fr); align-items: start; gap: 16px; padding: 12px 0;
  border-top: 1px solid var(--border); }
.pf-sec > .pf-row:last-of-type { border-bottom: 1px solid var(--border); }
.pf-k { color: var(--muted-foreground); line-height: 30px; }
.pf-v { display: grid; gap: 8px; min-width: 0; min-height: 30px; align-content: center; }
.pf-v .who-show { min-height: 30px; }
.pf-dots { letter-spacing: .12em; }
.pf-v > .seg { justify-self: start; }
form.pf-v { margin: 0; display: flex; align-items: center; gap: 12px; }
/* The apps sit between two hairlines that fade out at both ends. */
.pf-sec .svc-cloud-wrap { position: relative; padding: 22px 0; }
.pf-sec .svc-cloud-wrap::before, .pf-sec .svc-cloud-wrap::after { content: ""; position: absolute; left: 0; right: 0;
  height: 1px; background: linear-gradient(90deg, transparent, var(--border) 25%, var(--border) 75%, transparent); }
.pf-sec .svc-cloud-wrap::before { top: 0; }
.pf-sec .svc-cloud-wrap::after { bottom: 0; }
@media (max-width: 640px) {
  .pf { gap: 32px; }
  .pf-hero { position: relative; gap: 14px; padding-right: 32px; }
  .pf-id h1 { white-space: normal; }
  /* Just the icon in the corner; the words stay for screen readers. */
  .pf-hero { flex-wrap: wrap; }
  .pf-tools { order: 3; flex-basis: 100%; }
  .pf-signout { position: absolute; top: 0; right: -6px; gap: 0; font-size: 0; }
  .pf-pic { width: 64px; height: 64px; font-size: 24px; }
  .pf-id h1 { font-size: 22px; }
  .pf-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .pf-k { line-height: 1.4; font-size: 12.5px; }
}
.who-pic-edit { position: relative; display: inline-grid; cursor: pointer; border-radius: 50%; }
.who-pic-edit:focus-within { outline: 2px solid var(--ring); outline-offset: 2px; }
.who-pic-badge { position: absolute; right: 0; bottom: 0; display: grid; place-items: center; width: 24px; height: 24px;
  border-radius: 50%; background: var(--primary); color: var(--primary-foreground); box-shadow: 0 0 0 2px var(--background); }
.who-pic-badge svg { width: 12px; height: 12px; }
.who-pic-wrap { position: relative; flex: none; }
.who-pic-wrap form { margin: 0; }
.who-pic-remove { position: absolute; left: -2px; top: -2px; opacity: 0; transition: opacity .15s ease; }
.who-pic-wrap:hover .who-pic-remove, .who-pic-remove:focus-within { opacity: 1; }
.who-pic-remove button { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0;
  border-radius: 50%; background: var(--card); color: var(--muted-foreground); cursor: pointer;
  box-shadow: 0 1px 3px color-mix(in srgb, var(--foreground) 25%, transparent); }
.who-pic-remove svg { width: 12px; height: 12px; }
/* Each detail shows once, with a quiet pencil; editing swaps the line for its field. */
.who-show { display: flex; align-items: center; gap: 4px; min-width: 0; }
.who-show > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.who-show form { display: contents; }
.who-pen, .who-ok, .who-cancel { display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px;
  padding: 0; border: 0; border-radius: 7px; background: none; color: var(--muted-foreground); cursor: pointer; }
.who-pen { opacity: .45; transition: opacity .15s ease, background .15s ease; }
.who-field:hover .who-pen, .who-pen:focus-visible { opacity: 1; }
.who-pen:hover, .who-cancel:hover { background: var(--muted); color: var(--foreground); }
.who-ok { background: var(--primary); color: var(--primary-foreground); }
.who-pen svg, .who-ok svg, .who-cancel svg { width: 14px; height: 14px; }
.who-edit:not([hidden]) { display: flex; align-items: center; gap: 6px; min-width: 0; }
.who-edit .input, .who-edit .select { height: 32px; min-width: 0; flex: 1; font-size: 13.5px; padding-block: 0; }
.who-edit-stack:not([hidden]) { display: grid; gap: 8px; max-width: 420px; }
.who-edit-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.who-edit-stack .text-link { justify-self: start; }
.pf-id .who-edit:not([hidden]) { max-width: 420px; }
.who-code { display: grid; gap: 8px; max-width: 420px; }
.wa-code { margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--muted); font-size: 18px;
  letter-spacing: .08em; text-align: center; }
.text-link { background: none; border: 0; padding: 0; color: var(--muted-foreground);
  cursor: pointer; font: inherit; text-decoration: underline; }
.text-link.small { font-size: 12.5px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.grid-2 > * { min-width: 0; }
/* Basecoat card headers are a grid; these ones lay their pieces out in a row. */
.card > header.row-head { display: flex; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 10px; }
.card > header.row-head h2 { margin: 0; }
.card > header.row-head > div { flex: 1; min-width: 0; }
@media (max-width: 960px) { .grid-2 { grid-template-columns: 1fr; } }
.section { display: grid; gap: 10px; }
.section > h2 { margin: 0; }
form.inline { display: contents; }
.narrow { max-width: 440px; }
.pre { white-space: pre-wrap; }

/* Cards that hold a number */
.stat { min-width: 0; }
.stat section { display: grid; gap: 4px; align-content: start; }
.stat .k { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; }
.stat .v { font-size: 28px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere; line-height: 1.1; }
.stat .v.text { font-size: 15px; letter-spacing: 0; line-height: 1.35; }
.stat .sub { color: var(--muted-foreground); font-size: 12.5px; line-height: 1.4;
  overflow-wrap: anywhere; }
.chartbox { position: relative; height: 240px; min-width: 0; }
.chartbox.mini { height: 160px; }
.chartbox canvas { max-width: 100%; }

/* Status badges share the pipeline palette on every surface. */
.badge[data-kind] { background: transparent; border-color: currentColor; }
.badge[data-kind=ok] { color: var(--ok); }
.badge[data-kind=warn] { color: var(--warn); }
.badge[data-kind=bad] { color: var(--destructive); }
.badge[data-kind=info] { color: var(--primary); }
.badge[data-kind=muted] { color: var(--muted-foreground); }
.is-ok { color: var(--ok); }
.is-bad { color: var(--destructive); }

/* Key/value profile list */
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted-foreground); font-weight: 500; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* Feed of recent activity */
.feed { display: grid; min-width: 0; }
.feed > div { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border);
  align-items: baseline; min-width: 0; }
.feed > div:last-child { border-bottom: 0; }
.feed .who { font-weight: 600; flex: 0 1 132px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .txt { color: var(--muted-foreground); flex: 1; min-width: 0; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  white-space: normal; line-height: 1.4; overflow-wrap: anywhere; }
.feed .when { color: var(--muted-foreground); font-size: 12px; white-space: nowrap; flex: none; }

/* Page changes cross-fade; Chat's portrait and the orb share one name so she never blinks. */
@view-transition { navigation: auto; }
.sidebar nav { view-transition-name: sidebar; }
.mchat-who .avatar, .morb:not([data-page=chat]) > .morb-btn { view-transition-name: matilda-face; }
#rail, #orb-rail { view-transition-name: matilda-rail; }
/* Her chat box is the same box on every page, Chat's included. */
#composer:not([hidden]), #askbar-form { view-transition-name: matilda-ask; }
/* Never morph these between pages: a width change would play as a zoom, a fade as a blink. */
::view-transition-group(sidebar), ::view-transition-new(sidebar),
::view-transition-group(matilda-face), ::view-transition-new(matilda-face),
::view-transition-group(matilda-rail), ::view-transition-new(matilda-rail),
::view-transition-group(matilda-ask), ::view-transition-new(matilda-ask) { animation: none; }
::view-transition-old(sidebar), ::view-transition-old(matilda-face), ::view-transition-old(matilda-rail),
::view-transition-old(matilda-ask) { display: none; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

.text-end { text-align: end; }
.tabs > [role=tabpanel] { margin-top: 16px; }
/* A grid or flex item grows to its widest table or tab row unless it may shrink; a long tab row scrolls. */
.tabs { min-width: 0; }
.tabs > [role=tablist] { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs > [role=tablist]::-webkit-scrollbar { display: none; }
.table .avatar { width: 28px; height: 28px; font-size: 11px; }
.table form { margin: 0; }
.matrix th { vertical-align: top; width: 20%; white-space: normal; }
.table .wrap { white-space: normal; }
/* A row's action menu must not be clipped by the table's scroll container. */
.table-container:has(.dropdown-menu), .card:has(.dropdown-menu) { overflow: visible; }
@media (max-width: 640px) { .table-container:has(.dropdown-menu) { overflow-x: auto; }
  .table-container:has(.dropdown-menu) .wrap { min-width: 11rem; } }
/* "tick", not "mark": .mark is the logo mark below and would turn the cell into a grid. */
.matrix td.tick { vertical-align: middle; }
.matrix td.tick svg { display: block; width: 16px; height: 16px; }
.matrix td.tick .muted { opacity: .45; }
.member-lock { cursor: help; color: var(--muted-foreground); }
.member-lock[data-tooltip]::before { white-space: normal; width: max-content; max-width: 28ch; }
.dialog .grid-2 { gap: 12px; }

/* Clickable record rows */
.table.clickable tbody tr[data-href] { cursor: pointer; }
.table td.lead { font-weight: 600; }

/* Timeline of captured facts and milestones */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.timeline li:first-child { border-top: 0; }
.timeline .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex: none; }
.timeline .dot.done { background: var(--ok); }
.timeline .dot.pending { background: var(--border); }
.timeline .main { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.timeline .when { margin-left: auto; color: var(--muted-foreground); font-size: 12px; white-space: nowrap; }

/* Conversation transcript (dashboard) */
.convo { display: flex; flex-direction: column; max-height: 560px; overflow-y: auto; padding: 4px 2px; }
.convo .row { display: flex; width: 100%; margin: 1px 0; }
.convo .row.member { justify-content: flex-start; }
.convo .row.matilda { justify-content: flex-end; }
.convo .row.start { margin-top: 12px; }
.convo .msg { max-width: 76%; min-width: 0; padding: 8px 14px; border-radius: 18px; font-size: 14px;
  line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.convo .msg.matilda { background: var(--primary); color: var(--primary-foreground); }
.convo .msg.member { background: var(--secondary); color: var(--secondary-foreground); }
.convo .msg.evt { background: transparent; border: 1px dashed var(--border); color: var(--muted-foreground);
  font-size: 12.5px; padding: 5px 12px; }
.convo .datesep { align-self: center; font-size: 11px; font-weight: 600; color: var(--muted-foreground);
  margin: 14px 0 6px; }
.convo .stamp { font-size: 10.5px; color: var(--muted-foreground); margin: 2px 6px 0; align-self: flex-start; }
.convo .stamp.matilda { align-self: flex-end; }
.convo .pagelink { align-self: center; font-size: 12.5px; font-weight: 600; color: var(--primary); margin: 6px 0; }
.convo .quote { border-left: 2px solid currentColor; opacity: .8; padding: 2px 8px; margin: 0 0 6px; font-size: 12.5px; }
.convo .atts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.convo .att { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #7f7f7f26; }
.convo .tag { font-size: 11px; opacity: .75; margin-top: 4px; }

/* Setup: the integration cards */
.brandtile { flex: none; width: 32px; height: 32px; border-radius: 8px; background: #fff; border: 1px solid var(--border);
  display: grid; place-items: center; }
.brandtile img, .brandtile svg { width: 18px; height: 18px; object-fit: contain; display: block; color: #2B1540; }
[data-palette="srg"] .brandtile img, [data-palette="srg"] .brandtile svg { color: #1A140C; }
/* Integrations overview: borderless Basecoat items in a grid, one status dot each. */
.integrations { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 2px 12px; }
.integrations .item { text-decoration: none; color: inherit; position: relative; }
.integrations .item h3 a { color: inherit; text-decoration: none; }
.integrations .item h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.integrations .item aside { display: flex; align-items: center; gap: 12px; }
.integrations .item aside form { position: relative; z-index: 1; }
.integrations .item.off > figure, .integrations .item.off > section { opacity: .5; }
.team-switch { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.integrations .item > figure { transform: none; align-self: center; }
.integrations .brandtile { width: 40px; height: 40px; border-radius: 10px; }
.integrations .brandtile img, .integrations .brandtile svg { width: 22px; height: 22px; }
.integrations .item p { color: var(--muted-foreground); overflow-wrap: anywhere; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.status-dot.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
/* Connection mark beside an integration title: colour only, the words live in the label. */
.page > header .conn { align-self: center; }
.conn { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--muted-foreground);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--muted-foreground) 16%, transparent); }
.conn.on { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent); }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-foreground); }
.svc > header .badge { margin-left: auto; }
.svc .fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.svc .fields .select { max-width: 100%; }
.svc .field > p { margin: 0; }
.svc .locked { display: flex; align-items: center; gap: 8px; }
.svc .locked .input { flex: 1; color: var(--muted-foreground); user-select: none; display: flex; align-items: center; }
.svc .result { color: var(--muted-foreground); font-size: 13px; }
/* A pick-one row of logo cards (the AI provider) in place of a dropdown. */
.field > .choices[role=radiogroup] { display: flex; flex-direction: row; flex-wrap: wrap; gap: 10px; }
.choice { position: relative; display: flex; align-items: center; gap: 10px; min-width: 170px; padding: 10px 14px 10px 10px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); cursor: pointer;
  font-weight: 500; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease; }
.choice:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, var(--card));
  box-shadow: 0 0 0 1px var(--primary); }
.choice:has(input:focus-visible) { outline: 2px solid var(--ring); outline-offset: 2px; }


/* Her medallion in each palette and mode shares one cell (macros.matilda_mark); html.dark picks. */
.mark { display: inline-grid; line-height: 0; vertical-align: middle; }
.mark > img { grid-area: 1 / 1; display: block; width: 100%; height: 100%; object-fit: cover; }
.mark > .for-amethyst-dark, .mark > .for-srg, .mark > .for-srg-dark,
.mark > .for-brand, .mark > .for-brand-dark { display: none; }
/* The firm's logo (branding.py) in place of Matilda's mark; never cropped. */
.mark.org > img.org-logo { display: block; object-fit: contain; }
html.dark .mark > .for-amethyst { display: none; }
html.dark .mark > .for-amethyst-dark { display: block; }
html[data-palette="srg"] .mark > .for-amethyst,
html[data-palette="srg"] .mark > .for-amethyst-dark { display: none; }
html[data-palette="srg"] .mark > .for-srg { display: block; }
html[data-palette="srg"].dark .mark > .for-srg { display: none; }
html[data-palette="srg"].dark .mark > .for-srg-dark { display: block; }
/* The firm's palette, once it has her mark in its color (branding.py); until then, Amethyst's. */
html[data-palette="brand"] .mark.has-brand > img { display: none; }
html[data-palette="brand"] .mark.has-brand > .for-brand { display: block; }
html[data-palette="brand"].dark .mark.has-brand > .for-brand { display: none; }
html[data-palette="brand"].dark .mark.has-brand > .for-brand-dark { display: block; }
.centered .mark.org.logo img, .mark.org.wl-mark img { border-radius: 6px; object-fit: contain; }
.centered .mark.org.logo, .mark.org.wl-mark { border-radius: 8px; }
.wordmark.org-name { font-size: 17px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.centered .mark.org.wide.logo { width: auto; max-width: 220px; height: 52px; border-radius: 0; }
.centered .mark.org.wide.logo img { width: auto; max-width: 220px; height: 52px; border-radius: 0; }
.mark.org.wide.wl-mark { width: auto; max-width: 150px; border-radius: 0; }
.mark.org.wide.wl-mark img { width: auto; max-width: 150px; height: 36px; border-radius: 0; }
/* Wordmarks are drawn for white pages; in dark mode they sit on a light plate so they stay legible. */
html.dark .mark.org.wide img { background: #FFFFFFEB; padding: 2px 5px; border-radius: 5px; box-sizing: border-box; }

/* Sidebar. Items can be dragged into any order (kept per browser). */
.sidebar nav li { cursor: grab; }
.sidebar nav .dragging { opacity: .35; }
.sidebar nav > section > [role=group] + [role=group] { border-top: 1px solid var(--sidebar-border, var(--border)); }
.sidebar .brand { display: flex; align-items: center; gap: 10px; }
.sidebar .brand .mark, .sidebar .brand img { width: 30px; height: 30px; }
.sidebar .brand img { border-radius: 50%; object-fit: cover; }
.sidebar .brand .mark.org img { border-radius: 6px; object-fit: contain; }
.sidebar .avatar { width: 30px; height: 30px; font-size: 12px; }
.sidebar nav li > a > .brandtile { width: 20px; height: 20px; border-radius: 5px; flex: none; }
.sidebar nav li > a > .brandtile img { width: 13px; height: 13px; }
.sidebar nav > footer .dropdown-menu > button { display: flex; align-items: center; gap: 10px; text-align: left;
  font: inherit; border-radius: 8px; }
.sidebar nav > footer .dropdown-menu > button:hover { background: var(--sidebar-accent); }
.sidebar nav > footer .text { display: grid; min-width: 0; line-height: 1.25; }
.sidebar nav > footer .on { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar nav > footer .ou { font-size: 11.5px; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }

/* Sidebar sizes follow the window height, so the bars shrink in short windows and everything keeps fitting. */
:root { --rail-btn: clamp(32px, 5.2vh, 40px); --rail-face: calc(var(--rail-btn) - 6px);
  --rail-pad: calc(var(--rail-btn) / 6); --rail-bar: calc(var(--rail-btn) + 16px); }
/* The account menu: one column of icon buttons, the same width as the bars, names on hover. */
#account-menu > [data-popover] { width: var(--rail-bar); min-width: 0; padding: 6px 0; border: 0; border-radius: calc(var(--rail-bar) / 2);
  overflow: visible; box-shadow: 0 6px 14px color-mix(in srgb, var(--foreground) 9%, transparent); }
#account-menu [role=menu] { display: grid; justify-items: center; gap: 2px; }
#account-menu [role=menu] > [role=group] { display: grid; justify-items: center; gap: 2px; }
#account-menu [role=menu] > hr { width: 24px; margin: 4px auto; }
#account-menu :is([role=menuitem],[role=menuitemradio]) { display: grid; place-items: center; width: var(--rail-btn); height: var(--rail-btn);
  padding: 0; border: 0; border-radius: 50%; background: none; color: var(--primary); cursor: pointer; overflow: visible; }
#account-menu :is([role=menuitem],[role=menuitemradio]):is(:hover,:focus-visible,[aria-selected=true]) { background: var(--accent); }
#account-menu [data-tooltip]::before { font-weight: 500; }

/* Segmented choices (Profile: light or dark and the color scheme). */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 999px; background: var(--muted); }
.seg > button { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border: 0;
  border-radius: 999px; background: none; color: var(--muted-foreground); font: inherit; font-size: 13px; cursor: pointer; }
.seg > button svg { width: 15px; height: 15px; }
.seg > button:hover { color: var(--foreground); }
.seg > button:is([aria-checked=true], [aria-selected=true]) { background: var(--background); color: var(--foreground);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--foreground) 14%, transparent); }
/* Empty inline spans collapse; these are flex items and also need an explicit box. */
.palette-swatch { display: inline-block; width: 14px; height: 14px; min-width: 14px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px #00000033; }
.palette-swatch[data-swatch=amethyst] { background: #5A2E7A; }
.palette-swatch[data-swatch=srg] { background: #CD9933; }
.palette-swatch[data-swatch=brand] { background: var(--brand-accent, #5A2E7A); }
/* Profile's pattern pick: a tiny preview of the ambient field. */
.pattern-swatch { display: inline-block; width: 14px; height: 14px; min-width: 14px; border-radius: 4px;
  box-shadow: inset 0 0 0 1px #00000033; background-color: var(--background); }
.pattern-swatch[data-swatch=dots] {
  background-image: radial-gradient(circle, color-mix(in srgb, var(--foreground) 45%, transparent) .7px, transparent 1px);
  background-size: 4px 4px; background-position: 1px 1px; }
.pattern-swatch[data-swatch=crosses] {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='5' height='5' fill='none' stroke='%23666' stroke-width='1' stroke-linecap='round'%3E%3Cpath d='M2.5 1v3M1 2.5h3'/%3E%3C/svg%3E");
  background-size: 5px 5px; }

/* Phone: the sidebar is a drawer with labels; the account menu opens above its row. */
.sidebar .nav-hint { display: none; }
@media (max-width: 767px) {
  .sidebar .brand { padding: 6px 5px; border: 0; background: none; font: inherit; color: inherit; text-align: left; }
  .sidebar .brand[data-tooltip]::before { display: none; }
  .sidebar nav li > a { height: 36px; font-size: 14px; }
  .sidebar nav li > a[data-tooltip]::before { display: none; }
  .sidebar nav > footer .dropdown-menu { display: flex; width: 100%; }
  .sidebar nav > footer .dropdown-menu > button { width: 100%; padding: 8px 5px; }
  .sidebar nav > footer .dropdown-menu > button[data-tooltip]::before { display: none; }
  .sidebar nav > footer .dropdown-menu > [data-popover] { left: 0; translate: none; margin-bottom: 6px; }
}

/* Desktop: floating logo and account only; hover/pin reveals icons, labels are tooltips. */
@media (min-width: 768px) {
  :root { --sidebar-width: calc(var(--rail-bar) + 20px); }
  .sidebar nav { z-index: 50; align-items: center; padding: 12px 10px; background: transparent !important;
    background-color: transparent !important; border: 0; overflow: visible; box-shadow: none; filter: none; }
  /* The logo and account capsules sit on a frosted sidebar tint so they read as floating. */
  .sidebar nav { --rail-surface: color-mix(in srgb, var(--sidebar) 78%, transparent);
    --rail-edge: color-mix(in srgb, var(--sidebar-border) 70%, transparent); }
  /* Dark pages are already the sidebar color; a step lighter keeps the capsules visible. */
  .dark .sidebar nav { --rail-surface: color-mix(in srgb, var(--sidebar-accent) 72%, transparent);
    --rail-edge: var(--sidebar-border); }
  .sidebar nav > header, .sidebar nav > section, .sidebar nav > footer { width: var(--rail-bar); padding: 0;
    background: var(--rail-surface) !important; border: 0; box-shadow: none;
    -webkit-backdrop-filter: blur(10px) saturate(1.2); backdrop-filter: blur(10px) saturate(1.2); }
  /* A hairline edge: the open logo capsule draws it around header + list as one shape, no seam. */
  .sidebar nav > footer { box-shadow: 0 0 0 1px var(--rail-edge); }
  .sidebar nav > header { box-shadow: -1px 0 0 var(--rail-edge), 1px 0 0 var(--rail-edge), 0 -1px 0 var(--rail-edge); }
  .sidebar nav > section { box-shadow: -1px 0 0 var(--rail-edge), 1px 0 0 var(--rail-edge), 0 1px 0 var(--rail-edge); }
  html:not([data-nav-pin], [data-nav-hold]) .sidebar nav:not(:has(> header:hover, > section:hover)) > header {
    box-shadow: 0 0 0 1px var(--rail-edge); }
  /* The initial avatar is the same lavender as the capsule; a white face keeps it a distinct disc. */
  .sidebar nav > footer .avatar:not(:has(img)) { background: var(--background);
    box-shadow: inset 0 0 0 1px var(--sidebar-border); }
  /* Logo above the page list; hairline only while the list is open. */
  .sidebar nav > header { align-items: center; gap: 0; padding: calc(var(--rail-pad) + 3px) 0 0; border-bottom: 0; border-radius: calc(var(--rail-bar) / 2) calc(var(--rail-bar) / 2) 0 0; }
  .sidebar nav > header::after { content: ""; width: 24px; height: 1px; margin-top: 8px;
    background: color-mix(in srgb, var(--foreground) 14%, transparent); }
  .sidebar nav > section { flex: 0 1 auto; align-items: center; gap: 0; padding: 6px 0 8px; overflow: visible;
    border-top: 0; border-radius: 0 0 calc(var(--rail-bar) / 2) calc(var(--rail-bar) / 2); }
  .sidebar nav > section > [role=group] { align-items: center; padding: 2px 0; }
  .sidebar nav > section > [role=group] + [role=group] { width: 24px; margin: 4px 0; padding-top: 6px; }
  .sidebar nav > section ul { align-items: center; gap: 4px; }
  .sidebar .brand { justify-content: center; width: var(--rail-btn); height: var(--rail-btn); border-radius: 50%; }
  .sidebar .brand .mark, .sidebar .brand img { width: var(--rail-face); height: var(--rail-face); }
  .sidebar .brand .mark.org.wide, .sidebar .brand .mark.org.wide img { width: var(--rail-face); height: var(--rail-face);
    object-fit: cover; object-position: left center; }
  .sidebar .wordmark { display: none; }
  .sidebar nav > section ul li > a { justify-content: center; width: var(--rail-btn); height: var(--rail-btn); padding: 0;
    border-radius: 50%; overflow: visible; }
  .sidebar nav > section ul li > a:hover { background: color-mix(in srgb, var(--foreground) 8%, transparent); }
  .sidebar nav > section ul li > a > span:last-child { display: none; }
  .sidebar nav [data-tooltip]::before { font-weight: 500; }
  /* Rests as just the logo. Hover opens the page list; click pins it (html[data-nav-pin]). */
  .sidebar nav > header { transition: padding .2s ease, border-radius .2s ease; }
  .sidebar nav > header::after { transition: margin .2s ease, opacity .2s ease; }
  .sidebar nav > section { max-height: 70vh; transition: max-height .25s cubic-bezier(.4, 0, .2, 1), padding .25s ease,
    opacity .2s ease, visibility 0s; }
  html:not([data-nav-pin], [data-nav-hold]) .sidebar nav:not(:has(> header:hover, > section:hover)) > header {
    padding: var(--rail-pad) 0 4px; border-radius: calc(var(--rail-bar) / 2); transition-delay: .15s; }
  html:not([data-nav-pin], [data-nav-hold]) .sidebar nav:not(:has(> header:hover, > section:hover)) > header::after {
    height: 0; margin-top: 0; opacity: 0; }
  html:not([data-nav-pin], [data-nav-hold]) .sidebar nav:not(:has(> header:hover, > section:hover)) > section {
    max-height: 0; padding-block: 0; border-width: 0; opacity: 0; visibility: hidden; overflow: clip;
    transition-delay: 0s, 0s, 0s, .25s; }
  .sidebar .nav-hint { display: grid; place-items: center; height: 0; overflow: hidden; color: var(--muted-foreground);
    opacity: 0; pointer-events: none; transition: height .2s ease, opacity .15s ease; }
  .sidebar .nav-hint svg { width: 14px; height: 14px; }
  html:not([data-nav-pin], [data-nav-hold]) .sidebar nav:not(:has(> header:hover, > section:hover)) > header .nav-hint {
    height: 12px; opacity: .55; transition-delay: .15s; }
  .sidebar .brand { padding: 0; border: 0; background: none; cursor: pointer; }
  .sidebar .brand:hover, .sidebar .brand[aria-pressed=true] {
    background: color-mix(in srgb, var(--foreground) 8%, transparent); }
  /* Account avatar floats at the bottom; its menu keeps a solid sheet when open. */
  .sidebar nav > footer { margin-top: auto; align-items: center; padding: var(--rail-pad) 0;
    border-radius: calc(var(--rail-bar) / 2); gap: 0; transition: padding .2s ease, border-radius .2s ease; }
  .sidebar nav > footer .dropdown-menu > button { justify-content: center; width: var(--rail-btn); height: var(--rail-btn); padding: 0;
    border-radius: 50%; background: transparent; }
  .sidebar nav > footer .dropdown-menu > button:hover,
  .sidebar nav > footer .dropdown-menu > button[aria-expanded=true] {
    background: color-mix(in srgb, var(--foreground) 8%, transparent); }
  .sidebar nav > footer .dropdown-menu > button[aria-expanded=true]::before { display: none; }
  .sidebar nav > footer .text { display: none; }
  .sidebar nav > footer .dropdown-menu > button .avatar { width: var(--rail-face); height: var(--rail-face); font-size: 13px; }
  .sidebar nav > footer:not(:has([aria-expanded=true])) { padding-top: 4px; }
  .sidebar nav > footer:not(:has([aria-expanded=true])) .nav-hint { height: 12px; opacity: .55; transition-delay: .15s; }
  #account-menu > [data-popover] { margin-bottom: calc(var(--rail-pad) * 2); }
}
/* Account menu opens upward out of the avatar (two items). */
@media (min-width: 768px) {
  .sidebar nav > footer:has([aria-expanded=true]) { padding-top: 0; border-radius: 0 0 calc(var(--rail-bar) / 2) calc(var(--rail-bar) / 2);
    box-shadow: -1px 0 0 var(--rail-edge), 1px 0 0 var(--rail-edge), 0 1px 0 var(--rail-edge); }
  #account-menu > [data-popover] { margin-bottom: 0; padding-bottom: 0; background: var(--rail-surface);
    box-shadow: -1px 0 0 var(--rail-edge), 1px 0 0 var(--rail-edge), 0 -1px 0 var(--rail-edge);
    -webkit-backdrop-filter: blur(10px) saturate(1.2); backdrop-filter: blur(10px) saturate(1.2);
    border-radius: calc(var(--rail-bar) / 2) calc(var(--rail-bar) / 2) 0 0; }
  #account-menu [role=menu]::after { content: ""; width: 24px; height: 1px; margin: 6px auto 0; background: var(--sidebar-border); }
}
svg.lucide { width: 18px; height: 18px; flex: none; }
@media (max-width: 767px) {
  .topbar { display: flex; }
  .page { padding: 20px 16px 80px; }
}

/* Centered single-card pages: landing, sign-in, CRM connect */
.centered { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.centered .card { width: min(400px, 92vw); text-align: center; }
.centered .card > section { display: grid; gap: 12px; justify-items: center; }
.centered .card form { display: grid; gap: 10px; width: 100%; }
.centered .logo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; overflow: hidden; }
.centered .wordmark { font-size: 30px; }
.landing { display: flex; align-items: center; gap: 20px; }

/* Web chat (installable PWA): a full-height thread between a header and the composer. */
.chat { position: fixed; left: 0; right: 0; top: var(--app-top, 0px); height: 100dvh;
  height: var(--app-height, 100dvh); display: flex; flex-direction: column; overflow: hidden;
  overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
.chat > header { flex: none; display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; border-bottom: 1px solid var(--border);
  background: var(--card); }
.chat > header .avatar { width: 50px; height: 50px; }
.chat #log { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain; padding: 14px 16px 12px; display: flex; flex-direction: column; }
.chat .thread { width: 100%; max-width: 720px; margin: 0 auto; flex: 1 1 auto; display: flex; flex-direction: column; }
.chat .row { display: flex; width: 100%; margin: 1px 0; align-items: flex-end; }
.chat .row.user { justify-content: flex-end; }
.chat .row.bot { justify-content: flex-start; gap: 8px; }
.chat .row.start { margin-top: 12px; }
.chat .msg { position: relative; max-width: 76%; min-width: 0; padding: 9px 15px; border-radius: 20px;
  line-height: 1.36; font-size: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat .msg.user { background: var(--primary); color: var(--primary-foreground); }
.chat .msg.bot { background: var(--secondary); color: var(--secondary-foreground); }
/* Bubble tails: a coloured fin plus a page-coloured carve, so the page background stays flat. */
.chat .msg.tail.user { border-bottom-right-radius: 4px; }
.chat .msg.tail.bot { border-bottom-left-radius: 4px; }
.chat .msg.tail::before, .chat .msg.tail::after { content: ""; position: absolute; bottom: 0; }
.chat .msg.tail.user::before { right: -7px; width: 16px; height: 17px; background: var(--primary);
  border-bottom-left-radius: 16px 15px; }
.chat .msg.tail.user::after { right: -15px; width: 15px; height: 18px; background: var(--background);
  border-bottom-left-radius: 14px; }
.chat .msg.tail.bot::before { left: -7px; width: 16px; height: 17px; background: var(--secondary);
  border-bottom-right-radius: 16px 15px; }
.chat .msg.tail.bot::after { left: -15px; width: 15px; height: 18px; background: var(--background);
  border-bottom-right-radius: 14px; }
.chat .timesep { align-self: center; font-size: 11px; color: var(--muted-foreground); margin: 16px 0 10px; }
.chat .timesep b, .chat .receipt b { font-weight: 600; }
.chat .receipt { align-self: flex-end; font-size: 11px; color: var(--muted-foreground); margin: 3px 3px 2px 0; }
.chat .typing { padding: 12px 15px; }
.chat .typing span { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted-foreground);
  animation: blink 1.3s infinite both; }
.chat .typing span:nth-child(2) { animation-delay: .2s; }
.chat .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .35; transform: translateY(0); } 40% { opacity: .9; transform: translateY(-2px); } }
.chat > footer { flex: none; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border);
  background: var(--card); }
.chat > footer form { max-width: 720px; margin: 0 auto; }
.chat .composer { display: flex; align-items: flex-end; gap: 6px; background: var(--background);
  border: 1px solid var(--input); border-radius: 22px; padding: 5px 6px 5px 16px; }
.chat .composer:focus-within { border-color: var(--ring); box-shadow: 0 0 0 3px var(--chart-fill); }
.chat textarea { flex: 1 1 auto; resize: none; border: 0; padding: 6px 0; font: inherit; font-size: 16px;
  background: transparent; color: inherit; max-height: 140px; line-height: 1.35; outline: 0; }
.chat .send { flex: none; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--primary);
  color: var(--primary-foreground); font-size: 18px; font-weight: 700; display: grid; place-items: center; padding: 0;
  opacity: 0; transform: scale(.7); transition: opacity .12s ease, transform .12s ease; pointer-events: none; cursor: pointer; }
.chat .send.show { opacity: 1; transform: none; pointer-events: auto; }
.chat .send:disabled { opacity: .5; cursor: default; }
.chat .none { align-self: center; margin: auto 0; text-align: center; font-style: normal; }

/* Virginia Businesses cards in the chat: a business, a list, a map (vabusiness-cards.js). */
.chat .msg.card { max-width: min(92%, 560px); width: 100%; white-space: normal; padding: 12px 14px; }
.vacard { display: grid; gap: 8px; font-size: 14px; }
.vacard .vah { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.vacard .kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0; }
.vacard .kv dt { color: var(--muted-foreground); font-size: 12.5px; }
.vacard .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.vacard .valist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 320px; overflow-y: auto; }
.vacard .valist li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vacard .vaf { display: flex; gap: 12px; }
.vacard .vamap { height: 280px; border-radius: 12px; overflow: hidden; background: var(--muted); }
.vacard .vamap .leaflet-popup-content a { color: var(--primary); }
.vacard .vanote:empty { display: none; }

/* OpenStreetMap maps in the chat and on their own page (map-cards.js). */
.mapcard .mapgl { height: 300px; border: 1px solid var(--border); }
.msg.card.mapfull { border: 0; box-shadow: none; background: none; padding: 0; max-width: none; }
.mapcard .mapgl-full { height: min(70vh, 720px); }
.mapfull .mapcard .mlist { max-height: none; }
.mapcard .vaf { flex-wrap: wrap; align-items: baseline; justify-content: space-between; }
.mapcard .vaf a { color: inherit; }
.mapcard .mlist { counter-reset: none; gap: 0; max-height: 240px; }
.mapcard .mlist li { display: grid; grid-template-columns: 22px 1fr auto; align-items: baseline; gap: 2px 8px;
  padding: 6px 0; border-top: 1px solid var(--border); }
.mapcard .mlist li:first-child { border-top: 0; }
.mapcard .mlist-n { color: var(--muted-foreground); font-size: 12px; text-align: right; }
.mapcard .mlist-name { all: unset; cursor: pointer; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.mapcard .mlist-name:hover, .mapcard .mlist-name:focus-visible { text-decoration: underline; }
.mapcard .mlist-addr { grid-column: 2 / -1; }
.mpin { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; background: var(--primary, #5A2E7A);
  color: #fff; font: 600 11px/18px var(--font-sans, system-ui); text-align: center; padding: 0; cursor: pointer;
  box-shadow: 0 1px 3px rgb(0 0 0 / .35); }
.mpin-here { width: 16px; height: 16px; background: #fff; border: 4px solid var(--primary, #5A2E7A); }
.mpop { display: grid; gap: 2px; font-size: 13px; max-width: 220px; color: #222; }
.mapcard .maplibregl-ctrl-attrib a { color: inherit; }
@media (max-width: 520px) { .mapcard .mapgl { height: 240px; } }

/* Web chat profile */
.profile { min-height: 100dvh; padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.profile .nav { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px; background: var(--card); border-bottom: 1px solid var(--border); }
.profile .nav a { color: var(--primary); font-size: 16px; display: inline-flex; align-items: center; gap: 3px; }
.profile .nav .done { font-weight: 600; }
.profile .wrap { max-width: 640px; margin: 0 auto; padding: 8px 16px; display: grid; gap: 24px; }
.profile .hero { display: grid; justify-items: center; gap: 6px; padding: 18px 0 0; text-align: center; }
.profile .hero .avatar { width: 92px; height: 92px; }
.profile .hero h1 { margin: 4px 0 0; }
.profile .item { align-items: center; }
.profile .item .edit { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 15px;
  color: inherit; text-align: right; padding: 6px 4px; border-radius: 8px; -webkit-appearance: none; appearance: none; }
.profile .item .edit:focus { outline: 0; background: var(--muted); }
.profile .item .edit::placeholder { color: var(--muted-foreground); }
.profile .foot { text-align: center; color: var(--muted-foreground); font-size: 12px; }

/* Activity: one card per agent turn, its reasoning thread filling in live (static/activity.js). */
.live-state { display: inline-flex; align-items: center; gap: 7px; }
.live-state > span { width: 7px; height: 7px; border-radius: 50%; background: var(--warn);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 18%, transparent); }
.live-state[data-state=live] > span { background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }
.avatar > .mark { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit;
  overflow: hidden; background: transparent; }
/* Matilda at work: an arc circles the portrait (data-working); it always turns, only fading. */
.avatar::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; pointer-events: none; opacity: 0;
  background: conic-gradient(from 0deg, transparent 0 15%, color-mix(in srgb, var(--primary) 30%, transparent) 45%, var(--primary));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px));
  animation: m-orbit 1.4s linear infinite paused; transition: opacity .45s ease; }
.avatar[data-working]::after { opacity: 1; animation-play-state: running; }
@keyframes m-orbit { to { transform: rotate(1turn); } }
/* Matilda at her computer: a monitor on the portrait's rim (macros.computer_badge). */
.avatar > .m-computer { position: absolute; right: -3%; bottom: -3%; z-index: 2; display: grid; place-items: center;
  width: 40%; aspect-ratio: 1; border-radius: 50%; background: var(--primary); color: var(--primary-foreground);
  box-shadow: 0 0 0 2px var(--background); opacity: 0; transform: scale(.4); pointer-events: none;
  transition: opacity .2s ease, transform .3s cubic-bezier(.2, .9, .3, 1.3); }
.avatar > .m-computer svg { width: 56%; height: 56%; }
.avatar[data-computer] > .m-computer { opacity: 1; transform: scale(1); }
@keyframes m-breathe { 50% { transform: scale(.94); } }
.turns { display: grid; gap: 12px; }
/* /watch: the feed alone, for a phone (templates/watch.html). */
.watch-page { max-width: 760px; margin: 0 auto; padding: 16px 16px 40px; display: grid; gap: 14px; }
.watch-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; padding: 10px 0; background: var(--background); }
.watch-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.watch-brand > div { display: grid; line-height: 1.25; }
.watch-brand b { font-size: 16px; }
.watch-brand .mark { width: 36px; height: 36px; flex: none; border-radius: 50%; overflow: hidden; }
.watch-scope { display: inline-flex; justify-self: start; padding: 3px; gap: 2px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--card); }
.watch-scope a { padding: 4px 14px; border-radius: 999px; font-size: 13px; color: var(--muted-foreground); text-decoration: none; }
.watch-scope a[aria-current=page] { background: var(--primary); color: var(--primary-foreground); }
.watch-foot { text-align: center; margin: 0; }
.watch-foot a { color: inherit; text-decoration: underline; }

/* The reasoning thread (thread.js): a 28px avatar rail; steps fold when done, answer is heavy. */
.thread-wrap { min-width: 0; }
.thread { list-style: none; margin: 0; padding: 0; display: grid; min-width: 0; }
.thread-item { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 10px;
  min-width: 0; }
.thread-item[hidden] { display: none; }
.thread-item.enter { animation: thread-in .3s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes thread-in { from { opacity: 0; transform: translateY(6px); } }
.thread-rail { display: flex; flex-direction: column; align-items: center; min-height: 28px; }
/* The hairline runs from this avatar's center to the next one's; the avatars sit on top of it. */
.thread-dot { position: relative; z-index: 1; flex: none; height: 28px; display: grid; place-items: center; }
.thread-rail::after { content: ""; flex: 1 1 auto; width: 1px; min-height: 6px; margin: -14px 0 -14px;
  background: var(--border); }
.thread-item:last-child > .thread-rail::after { display: none; }
.thread-avatar { width: 20px; height: 20px; flex: none; display: grid; place-items: center; overflow: hidden;
  border: 1px solid var(--border); border-radius: 50%; background: var(--background); color: var(--muted-foreground);
  font-size: 11px; font-weight: 500; line-height: 1;
  transition: width .3s ease, height .3s ease, border-color .3s ease, color .3s ease; }
.thread-avatar svg { width: 11px; height: 11px; }
.thread-avatar .ficon { width: 12px; height: 12px; }
.thread-item[data-status=running] .thread-avatar { width: 28px; height: 28px; border-color: var(--foreground);
  color: var(--foreground); }
.thread-item[data-status=running] .thread-avatar svg { width: 14px; height: 14px; }
.thread-item[data-status=error] .thread-avatar { color: var(--destructive);
  border-color: color-mix(in srgb, var(--destructive) 45%, var(--border)); }
.thread-item[data-kind=user_message] .thread-avatar { width: 28px; height: 28px; background: var(--muted);
  color: var(--foreground); font-size: 12px; }
.thread-avatar.filled { width: 28px; height: 28px; border-color: var(--foreground); background: var(--foreground);
  color: var(--background); font-size: 13px; }
.thread-more .thread-avatar { border-style: dashed; }
.thread-body { min-width: 0; padding-bottom: 6px; }
.thread-item:last-child > .thread-body { padding-bottom: 0; }
.thread-head { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 28px; margin: 0; padding: 0;
  border: 0; border-radius: 6px; background: none; color: var(--muted-foreground); font: inherit; font-size: 13.5px;
  text-align: left; }
button.thread-head { cursor: pointer; }
button.thread-head[aria-disabled] { cursor: default; }
button.thread-head:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
button.thread-head:not([aria-disabled]):hover .thread-label { color: var(--foreground); }
.thread-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 400; transition: color .15s ease; }
.thread-meta { flex: none; font-size: 12px; color: var(--muted-foreground); }
.thread-meta:empty { display: none; }
.thread-item[data-status=error] .thread-meta { color: var(--destructive); }
/* While it runs the label is medium and a light passes over it. */
.thread-item[data-status=running] .thread-label { font-weight: 500; color: transparent;
  background: linear-gradient(90deg, var(--foreground) 0 35%, var(--muted-foreground) 50%, var(--foreground) 65% 100%)
    0 0 / 300% 100%;
  -webkit-background-clip: text; background-clip: text; animation: thread-shimmer 2.4s linear infinite; }
@keyframes thread-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
/* The member's words read in full, as written. */
.thread-item[data-kind=user_message] .thread-head { align-items: flex-start; }
.thread-item[data-kind=user_message] .thread-label { padding: 4px 0 2px; white-space: pre-wrap; overflow-wrap: anywhere;
  color: var(--foreground); font-size: 14.5px; line-height: 1.5; }
.thread-item[data-kind=attachment] .thread-label { color: var(--foreground); }
/* When a message was sent: small, at the right of the member's row and under her answer at the left. */
.thread-item[data-kind=user_message] .thread-meta { padding-top: 7px; font-size: 11px; }
.thread-time { display: block; margin-top: 1px; font-size: 11px; color: var(--muted-foreground); }
.thread-time:empty { display: none; }
.thread-item[data-pending] .thread-label { opacity: .6; }
.thread-item[data-failed] .thread-label { opacity: .5; }
/* Opening and folding: the row grows from nothing to its content, so nothing below jumps. */
.thread-detail { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s cubic-bezier(.2, .8, .2, 1); }
.thread-item[data-open] > .thread-body > .thread-detail { grid-template-rows: 1fr; }
.thread-detail-in { min-height: 0; overflow: hidden; }
.thread-detail-in > :first-child { margin-top: 2px; }
.thread-detail-in > :last-child { margin-bottom: 6px; }
/* The answer: no header, full-size text. */
.thread-answer { padding: 3px 0 2px; font-size: 15px; line-height: 1.55; color: var(--foreground);
  white-space: pre-wrap; overflow-wrap: anywhere; }
.thread-answer a { color: inherit; text-decoration: underline; }
.thread-answer.card { white-space: normal; padding: 0; background: none; }
.thread-answer.rich { white-space: normal; }
/* Her Markdown as rich text (richtext.js): spacing over boxes, hairlines, fills only on code. */
.rich > :first-child { margin-top: 0; }
.rich > :last-child { margin-bottom: 0; }
.rich p { margin: 0 0 .7em; }
.rich strong { font-weight: 600; }
.rich a { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: 2px; }
.rich a:hover { text-decoration-color: currentColor; }
.rich h4, .rich h5, .rich h6 { margin: 1.1em 0 .4em; font-size: 1em; font-weight: 600; line-height: 1.4; }
.rich h4 { font-size: 1.08em; }
.rich ul, .rich ol { margin: 0 0 .7em; padding-left: 1.35em; display: grid; gap: .3em; }
.rich ul { list-style: disc; }
.rich ol { list-style: decimal; }
.rich li > ul, .rich li > ol { margin: .3em 0 0; }
.rich ul ul { list-style: circle; }
.rich li::marker { color: var(--muted-foreground); }
.rich ol > li::marker { font-variant-numeric: tabular-nums; }
.rich ul.tasks { padding-left: 0; }
.rich li.task { list-style: none; }
.rich li.task label { display: inline-flex; align-items: flex-start; gap: .55em; cursor: pointer; }
.rich li.task input { flex: none; width: 1em; height: 1em; margin: .28em 0 0; accent-color: var(--primary); cursor: pointer; }
.rich li.task input:checked + span { color: var(--muted-foreground); text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, currentColor 50%, transparent); }
.rich ul:not(.tasks) > li.task { margin-left: -1.35em; }
.rich blockquote { margin: 0 0 .7em; padding-left: .9em; border-left: 2px solid var(--border); color: var(--muted-foreground); }
.rich hr { margin: 1em 0; border: 0; border-top: 1px solid var(--border); }
.rich code { padding: .1em .35em; border-radius: 5px; background: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .86em; }
.rich pre { margin: 0 0 .7em; padding: 10px 12px; border-radius: 8px; background: var(--muted); overflow-x: auto; }
.rich pre code { padding: 0; background: none; font-size: .84em; white-space: pre; }
.rich .rich-table { margin: .2em 0 .8em; max-width: 100%; overflow-x: auto; }
/* Words in a cell never split; a table wider than the reply scrolls sideways instead. */
.rich table { border-collapse: collapse; font-size: .93em; font-variant-numeric: tabular-nums; overflow-wrap: normal; }
.rich td[style], .rich th[style] { white-space: nowrap; }
.rich th, .rich td { padding: 6px 14px 6px 0; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.rich th { font-weight: 600; color: var(--muted-foreground); font-size: .92em; border-bottom-color: color-mix(in srgb, var(--foreground) 22%, var(--border)); }
.rich th:last-child, .rich td:last-child { padding-right: 0; }
.rich tbody tr:last-child td { border-bottom: 0; }
.thread-show { color: var(--muted-foreground); font-size: 13px; }
.thread-show:hover { color: var(--foreground); text-decoration: underline; }
.thread-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* What an open step shows: a file, a query, result rows, a calculation, an email, or plain text. */
.td-file { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 360px; margin: 0; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: inherit; font: inherit;
  text-align: left; }
button.td-file { cursor: pointer; transition: border-color .15s ease; }
button.td-file:hover, button.td-file:focus-visible {
  border-color: color-mix(in srgb, var(--foreground) 28%, var(--border)); outline: 0; }
.td-ficon { flex: none; width: 26px; height: 26px; display: grid; place-items: center; }
.td-ficon .ficon, .td-ficon svg { width: 22px; height: 22px; }
.td-fmain { flex: 1 1 auto; display: grid; min-width: 0; line-height: 1.35; }
.td-fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; color: var(--foreground); }
.td-fsub { font-size: 12px; color: var(--muted-foreground); }
.td-fsub:empty { display: none; }
.td-out { flex: none; display: grid; color: var(--muted-foreground); }
.td-out svg { width: 14px; height: 14px; }
.td-pic { display: block; width: 100%; max-width: 220px; margin-top: 8px; padding: 0; overflow: hidden;
  border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; }
.td-pic img { display: block; width: 100%; height: auto; max-height: 280px; object-fit: cover; object-position: top; }
.td-query { display: flex; align-items: baseline; gap: 8px; min-width: 0; margin: 0 0 6px; }
.td-src { flex: none; font-size: 12px; color: var(--muted-foreground); }
.td-query code, .td-calc code { padding: 0; background: none; color: var(--foreground); font-family: var(--font-mono);
  font-size: 12.5px; overflow-wrap: anywhere; }
.td-rows { max-width: 460px; margin: 0; border-top: 1px solid var(--border); }
.td-rows > div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--border);
  font-size: 13px; }
.td-rows dt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--foreground); }
.td-rows dd { flex: none; margin: 0; color: var(--muted-foreground); }
.td-rows a { color: inherit; text-decoration: none; }
.td-rows a:hover { text-decoration: underline; }
.td-note { margin: 6px 0 0; font-size: 12px; color: var(--muted-foreground); }
.td-error { margin: 0 0 6px; font-size: 13px; color: var(--destructive); overflow-wrap: anywhere; }
.td-calc { margin: 0; }
.td-mail { display: grid; gap: 2px; max-width: 460px; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 13px; }
.td-mail p { margin: 0; min-width: 0; }
.td-mail .td-src { margin-right: 6px; }
.td-subject { color: var(--foreground); }
.td-first { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted-foreground); }
.td-text { margin: 0; font-size: 13px; color: var(--muted-foreground); white-space: pre-wrap; overflow-wrap: anywhere; }
.td-extra { margin-top: 6px; }
.td-extra > summary { display: inline-flex; align-items: center; gap: 4px; list-style: none; cursor: pointer;
  font-size: 12px; color: var(--muted-foreground); }
.td-extra > summary::-webkit-details-marker { display: none; }
.td-extra > summary svg { width: 12px; height: 12px; transition: transform .15s ease; }
.td-extra[open] > summary svg { transform: rotate(90deg); }
.td-extra pre { max-height: 260px; margin: 6px 0 0; padding: 8px 10px; overflow: auto; border: 1px solid var(--border);
  border-radius: 8px; font-family: var(--font-mono); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* In a feed (the chat's panel, /watch, /dashboard/live): one card per turn, who and where above it. */
.tcard { display: grid; gap: 10px; min-width: 0; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--radius, 10px); background: var(--card); transition: border-color .2s ease; }
.tcard[data-status=working] { border-color: color-mix(in srgb, var(--foreground) 24%, var(--border)); }
.tcard-head { display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; min-width: 0; font-size: 13px; }
.tcard-who { font-weight: 500; overflow-wrap: anywhere; }
.tcard-meta { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; font-size: 12px;
  color: var(--muted-foreground); }
.tcard-meta svg { width: 12px; height: 12px; }
.tcard-state { margin-left: auto; font-size: 12px; color: var(--muted-foreground); }
.tcard-state[data-status=failed] { color: var(--destructive); }
/* A picture in a thread's avatar (her portrait, a member's photo) fills its circle. */
.thread-avatar > img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.thread-avatar.pic, .thread-avatar:has(> img) { overflow: hidden; border-color: transparent; background: none; }
.tcard .thread-answer { font-size: 14px; }
.tcard-peek { display: none; }
/* Her panel: each turn one line (state, what started it, when); the picked one opens as its card. */
.mchat-panel .turns { gap: 2px; }
.mchat-panel .tcard-peek { display: none; }
.mchat-panel .tcard[data-folded] { gap: 0; padding: 0; border-color: transparent; background: none; }
.mchat-panel .tcard[data-folded] > .thread-wrap { display: none; }
.mchat-panel .tcard:not([data-folded]) { margin: 4px 0 8px; box-shadow: 0 6px 18px -12px color-mix(in srgb, var(--foreground) 30%, transparent); }
.mchat-panel .tcard-head { flex-wrap: nowrap; gap: 10px; padding: 7px 8px; margin: -12px -14px 0; border-radius: 8px; cursor: pointer;
  transition: background .15s ease; }
.mchat-panel .tcard[data-folded] .tcard-head { margin: 0; }
.mchat-panel .tcard[data-folded] .tcard-head:hover { background: var(--muted); }
.mchat-panel .tcard-head:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.tcard-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--chart-muted); opacity: .7; }
.tcard-dot[data-status=working] { background: var(--primary); opacity: 1; animation: m-breathe 1.2s ease-in-out infinite; }
.tcard-dot[data-status=failed] { background: var(--destructive); opacity: 1; }
.tcard-line { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mchat-panel .tcard-head > time { flex: none; font-size: 12px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.tcard .thread-avatar:not(.filled) { background: var(--card); }
.tcard .thread-item[data-kind=user_message] .thread-avatar { background: var(--muted); }
.tcard .thread-item[data-kind=user_message] .thread-label { display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden; font-size: 13.5px; }
/* In the chat itself each turn is a row of its own. */
.mchat-thread .row.turn { display: block; margin: 12px 0; }
/* The memory card (memory-card.js): on the turn rail; folds to one line when done. */
.memrow .thread-item[data-status=done] .mem-head[aria-disabled] { cursor: default; }
.memrow .thread-item[data-status=done] .thread-label { flex: 0 1 auto; }
.memrow .thread-item[data-status=done] .thread-meta { flex: 1 1 auto; }
.memrow.mem-settled .thread-avatar { animation: mem-settle 1.4s ease-out; }
@keyframes mem-settle { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 45%, transparent); border-color: var(--primary); color: var(--primary); }
  100% { box-shadow: 0 0 0 10px transparent; } }
.mem-live { display: grid; grid-template-rows: 0fr; opacity: 0;
  transition: grid-template-rows .5s cubic-bezier(.2, .8, .2, 1), opacity .35s ease; }
.memrow[data-live] .mem-live { grid-template-rows: 1fr; opacity: 1; }
.mem-live-in { min-height: 0; overflow: hidden; display: grid; gap: 8px; max-width: 520px; }
.memrow[data-live] .mem-live-in { padding: 4px 0 4px; }
.mem-scan { position: relative; height: 116px; overflow: hidden; border: 1px solid var(--border); border-radius: 12px;
  background: var(--card); }
.mem-scan[hidden] { display: none; }
.mem-window { position: absolute; inset: 0; overflow: hidden;
  -webkit-mask-image: linear-gradient(transparent, #000 26%, #000 74%, transparent);
  mask-image: linear-gradient(transparent, #000 26%, #000 74%, transparent); }
.mem-lines { padding: 0 14px; animation: mem-drift var(--mem-d, 24s) linear infinite; }
.mem-lines p { margin: 0; padding: 5px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12.5px; line-height: 1.4; color: var(--muted-foreground); }
@keyframes mem-drift { to { transform: translateY(-50%); } }
/* The scan line: a soft wash with a bright lower edge, passing down over the lines again and again. */
.mem-beam { position: absolute; left: 0; right: 0; top: 0; height: 36px; pointer-events: none;
  background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--primary) 16%, transparent));
  border-bottom: 1.5px solid color-mix(in srgb, var(--primary) 75%, transparent);
  box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--primary) 55%, transparent);
  animation: mem-sweep 2.8s cubic-bezier(.45, 0, .55, 1) infinite; }
@keyframes mem-sweep { from { transform: translateY(-38px); } to { transform: translateY(118px); } }
/* Once she is writing up the conversation the reading is over: the scan rests. */
.memrow[data-status=writing] .mem-beam { animation-play-state: paused; opacity: 0; transition: opacity .4s ease; }
.memrow[data-status=writing] .mem-window { opacity: .45; transition: opacity .4s ease; }
.memrow[data-status=writing] .mem-lines { animation-play-state: paused; }
.mem-found { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.mem-found:empty { display: none; }
.mem-chip { display: flex; align-items: baseline; gap: 9px; min-width: 0; padding: 5px 10px; border: 1px solid var(--border);
  border-radius: 9px; background: var(--card); font-size: 12.5px; line-height: 1.45; }
.mem-chip.enter { animation: mem-lift .55s cubic-bezier(.2, .8, .2, 1) both; }
.mem-chip.leaving { animation: mem-leave .3s ease both; }
@keyframes mem-lift { from { opacity: 0; transform: translateY(-16px) scale(.97);
  border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); } }
@keyframes mem-leave { to { opacity: 0; transform: translateY(-6px); } }
.mem-chip-k { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase; color: var(--primary); }
.mem-chip-k svg { width: 12px; height: 12px; align-self: center; }
.mem-chip-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--foreground); }
.mem-groups { display: grid; gap: 14px; max-width: 560px; padding: 6px 0 4px; }
.mem-group h5 { display: flex; align-items: center; gap: 6px; margin: 0 0 4px; font-size: 11px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted-foreground); }
.mem-group h5 svg { width: 12px; height: 12px; }
.mem-group ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.mem-line { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 10px; padding: 6px 0;
  border-bottom: 1px solid var(--border); font-size: 13.5px; line-height: 1.45; }
.mem-line[data-busy] { opacity: .5; pointer-events: none; }
.mem-line-t { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; color: var(--foreground); }
.mem-line-op { flex: none; padding-top: 2px; font-size: 11px; color: var(--muted-foreground); }
.mem-line[data-op=dropped] .mem-line-t, .mem-line[data-gone] .mem-line-t { color: var(--muted-foreground);
  text-decoration: line-through; }
.mem-acts { flex: none; display: flex; gap: 2px; margin: -2px 0; opacity: 0; transition: opacity .15s ease; }
.mem-acts[hidden], .mem-line-t[hidden], .mem-line-op[hidden] { display: none; }
.mem-line:hover .mem-acts, .mem-line:focus-within .mem-acts { opacity: 1; }
@media (hover: none) { .mem-acts { opacity: 1; } }
.mem-act { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px;
  background: none; color: var(--muted-foreground); cursor: pointer; }
.mem-act:hover { background: var(--muted); color: var(--foreground); }
.mem-act:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.mem-act svg { width: 13px; height: 13px; }
.mem-edit { flex: 1 1 100%; display: grid; gap: 6px; }
.mem-edit textarea { width: 100%; min-height: 58px; resize: vertical; padding: 8px 10px; border: 1px solid var(--input);
  border-radius: 8px; background: var(--card); color: var(--foreground); font: inherit; outline: 0; }
.mem-edit textarea:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--ring) 40%, transparent); }
.mem-edit-bar { display: flex; gap: 6px; }
.mem-note { flex: 1 1 100%; margin: 0; font-size: 12px; color: var(--destructive); }
.mem-foot { margin: 0; }
.mem-all { padding: 0; border: 0; background: none; color: var(--muted-foreground); font: inherit; font-size: 12.5px;
  text-decoration: underline; cursor: pointer; }
.mem-all:hover { color: var(--foreground); }
@media (prefers-reduced-motion: reduce) {
  .mem-lines, .mem-beam, .mem-chip.enter, .mem-chip.leaving, .memrow.mem-settled .thread-avatar { animation: none; }
  .mem-beam { display: none; }
  .mem-live { transition: none; }
}
@media (prefers-reduced-motion: reduce) {
  .thread-detail, .thread-avatar { transition: none; }
  .thread-item[data-status=running] .thread-label { background: none; color: var(--foreground); }
}

/* Join page: pick where Matilda reaches you */
.centered .card.join-card { width: min(520px, 92vw); }
.join-channels { display: grid; gap: 10px; width: 100%; text-align: left; }
.join-channel { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--card); }
.join-channel .join-logo { width: 32px; height: 32px; border-radius: 8px; object-fit: contain; flex: none; }
.join-channel .join-body { flex: 1 1 auto; min-width: 0; }
.join-channel .join-body p { margin: 2px 0 0; }
.join-channel code { font-size: 12px; padding: 1px 6px; border-radius: 6px; background: var(--secondary); white-space: nowrap; }

/* Member web chat (dashboard) */

/* Onboarding (/welcome): city panel (welcome-city.js) beside a chat; panel stays light in dark. */
/* The conversation is a snug column; the city takes whatever width is left. */
.wl { height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) clamp(520px, 44vw, 760px); background: var(--background); }
.wl-side { position: relative; height: 100dvh; overflow: hidden; color: var(--wl-ink, #2B1540);
  background:
    radial-gradient(120% 80% at 50% 40%, var(--wl-glow, #FBF8FC) 0%, var(--wl-paper, #F4EEF7) 55%, var(--wl-edge, #EEE5F3) 100%); }
/* Before the city draws (and wherever it can't): the site plan's faint drafting grid. */
.wl-side::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--wl-grid, rgb(91 57 102 / .06)) 1px, transparent 1px),
    linear-gradient(90deg, var(--wl-grid, rgb(91 57 102 / .06)) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 30%, transparent 75%);
  transition: opacity .8s ease; }
.wl-city.has-city ~ .wl-brand { text-shadow: 0 0 12px var(--wl-glow, #FBF8FC); }
.wl-side:has(.has-city)::before { opacity: .35; }
.wl-city { position: absolute; inset: 0; }
/* No line between the city and the conversation: the paper dissolves into the page. */
.wl-side::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 120px; z-index: 2;
  pointer-events: none; background: linear-gradient(to right, color-mix(in srgb, var(--background) 0%, transparent),
    color-mix(in srgb, var(--background) 55%, transparent) 55%, var(--background)); }
/* A city in a new color is drawn on a canvas of its own, over the old one, which then goes. */
.wl-city canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; visibility: hidden; opacity: 0;
  transition: opacity .9s ease; }
.wl-city canvas.is-ready { visibility: visible; opacity: 1; }
.wl-brand { position: absolute; top: 28px; left: 32px; z-index: 1; display: flex; align-items: center; gap: 10px; }
.wl-brand .wordmark { font-size: 24px; color: var(--wl-ink, #2B1540); }
.wl-mark { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 3px #FFFFFFB3; }
.wl-story { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; display: grid; gap: 20px;
  padding: 72px 32px 32px;
  background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--wl-edge, #EEE5F3) 90%, transparent) 46%, var(--wl-edge, #EEE5F3)); }
.wl-line { margin: 0; max-width: 22ch; font-family: var(--font-brand); font-weight: 600; font-size: 28px;
  line-height: 1.2; letter-spacing: -.01em; color: var(--wl-ink, #2B1540); text-wrap: balance;
  animation: wl-in .7s cubic-bezier(.2, .7, .2, 1) both; }
.wl-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.wl-steps li { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--wl-mid, #6E5E7A); }
.wl-steps li.done { color: var(--wl-accent, #5A2E7A); }
.wl-steps li.current { color: var(--wl-ink, #2B1540); font-weight: 600; }
.wl-dot { width: 18px; height: 18px; flex: none; display: grid; place-items: center; border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--wl-accent, #5A2E7A) 35%, #fff); background: #FFFFFFB3; }
.wl-dot svg { width: 11px; height: 11px; stroke-width: 3; }
.wl-steps li.done .wl-dot { background: var(--wl-accent, #5A2E7A); border-color: var(--wl-accent, #5A2E7A); color: #fff; }
.wl-steps li.current .wl-dot { border-color: var(--wl-accent, #5A2E7A);
  box-shadow: inset 0 0 0 3px #FFFFFF, inset 0 0 0 9px var(--wl-accent, #5A2E7A); }
@keyframes wl-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* The conversation column: the thread scrolls and the reply docks when it outgrows the pane. */
.wl-main { --wl-col: 680px; --wl-pad: 40px; height: 100dvh; min-height: 0; }
.wl-main .wl-who { display: none; }
.wl-main .wl-log { flex: 0 1 auto; margin-top: auto; padding: 0 var(--wl-pad); mask-image: none; -webkit-mask-image: none; }
.wl-main .wl-thread { max-width: var(--wl-col); min-height: 0; padding: 24px 0 8px; justify-content: flex-start; }
.wl-thread .row.turn { margin: 14px 0; }
.thread-avatar > .mark { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; }
/* Her lines: paragraphs, not the chat's pre-wrapped text. */
.wl-says { white-space: normal; display: grid; gap: 8px; }
.wl-says p { margin: 0; }
.wl-aside { margin: 8px 0 0; font-size: 15px; line-height: 1.55; }
/* What an answer is picked from sits under her question, on her side of the rail. */
.wl-card, .wl-pick, .wl-tools, .wl-channels, .wl-review { margin-top: 12px; }
.wl-card { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--card); }
.wl-enter-in { animation: wl-in .4s cubic-bezier(.2, .7, .2, 1) both; }
.wl-hint { font-size: 12.5px; color: var(--muted-foreground); }
.wl-label { font-size: 13px; font-weight: 500; margin-top: 6px; }
.wl-form { display: grid; gap: 8px; max-width: 420px; }
.wl-input { height: 44px; border-radius: 12px; font-size: 15px; }
.wl-go { margin-top: 10px; justify-self: start; min-width: 120px; border-radius: 12px; }
.wl-enter { font-size: 12.5px; color: var(--muted-foreground); }

/* Where they answer. The chat's composer when the answer is typed; replies to tap above it. */
.wl-reply { flex: none; display: grid; gap: 8px; margin-bottom: auto; padding: 4px var(--wl-pad) 0; }
.wl-reply > * { width: 100%; max-width: var(--wl-col); margin-left: auto; margin-right: auto; }
.wl-reply .alert section { overflow-wrap: anywhere; }
.wl-reply .wl-composer { width: 100%; max-width: var(--wl-col); margin: 0 auto; }
.wl-composer .wl-text { flex: 1 1 auto; min-width: 0; height: 38px; padding: 0 6px 0 10px; border: 0; outline: 0;
  background: transparent; color: inherit; font: inherit; font-size: 15px; }
.wl-composer .wl-text::placeholder { color: var(--muted-foreground); }
.wl-composer .attach { grid-area: attach; display: grid; place-items: center; width: 38px; height: 38px; cursor: pointer; border: 0; border-radius: 50%; background: none; color: var(--muted-foreground); }
.wl-composer .attach + .mchat-input .wl-text { padding-left: 2px; }
.wl-composer .mchat-files { grid-area: files; padding: 2px 4px 6px; }
.wl-composer .mchat-files[hidden] { display: none; }
/* Under her words: the rail (28px) and its gap (10px) in. */
.wl-quick { display: flex; align-items: center; justify-content: flex-start; gap: 8px; flex-wrap: wrap; padding-left: 38px; }
.wl-quick .btn { border-radius: 999px; }
.wl-reply[data-busy] { opacity: .55; pointer-events: none; transition: opacity .2s ease; }
.wl-foot { flex: none; margin: 0 auto; padding: 8px var(--wl-pad) 14px; font-size: 12px; color: var(--muted-foreground); text-align: center; }
.wl-sending [data-pending] .thread-label { opacity: 1; }

/* Pills to pick from. */
.wl-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.wl-chip { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--card); font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease; }
.wl-chip:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.wl-chip input { position: absolute; opacity: 0; pointer-events: none; }
.wl-chip svg { width: 15px; height: 15px; }
.wl-chip:has(input:checked) { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.wl-chip:has(input:focus-visible) { outline: 2px solid var(--ring); outline-offset: 2px; }

/* Her tools: one row each, with its Connect. */
.wl-tools { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.wl-tools.wl-one { grid-template-columns: minmax(0, 420px); }
.wl-tool { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border: 1px solid var(--border);
  border-radius: 14px; background: var(--card); transition: border-color .15s ease, box-shadow .15s ease; }
.wl-tool:hover { border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
  box-shadow: 0 6px 18px -14px color-mix(in srgb, var(--foreground) 50%, transparent); }
.wl-tool-logo { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px;
  background: var(--background); border: 1px solid var(--border); }
.wl-tool-logo img { width: 20px; height: 20px; object-fit: contain; }
.wl-tool-body { flex: 1; min-width: 0; display: grid; gap: 1px; }
.wl-tool-body strong { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-tool-body span { font-size: 12px; color: var(--destructive); }
.wl-tool-body em { font-style: normal; font-size: 12.5px; color: var(--muted-foreground); }
.wl-tool > form, .wl-tool > .btn, .wl-tool-done { flex: none; }
.wl-tool.is-on { background: color-mix(in srgb, var(--ok) 6%, var(--card)); border-color: color-mix(in srgb, var(--ok) 30%, var(--border)); }
.wl-tool-done { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 6px;
  font-size: 13px; font-weight: 600; color: var(--ok); }
.wl-tool-done svg { width: 15px; height: 15px; stroke-width: 2.5; }
.wl-channels { display: grid; gap: 10px; }
.wl-channel { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 14px; background: var(--card); transition: border-color .15s ease; }
.wl-channel:hover { border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.wl-channel-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.wl-channel-body strong { font-size: 14.5px; font-weight: 600; }
.wl-channel-body > span { font-size: 13px; line-height: 1.45; color: var(--muted-foreground); }
.wl-channel .btn { flex: none; }
.wl-channel-logo { width: 36px; height: 36px; flex: none; border-radius: 10px; object-fit: contain; }
.wl-channel code { font-size: 12px; padding: 1px 6px; border-radius: 6px; background: var(--secondary); white-space: nowrap; }

/* Her team: as what the next person is added (their email goes in the composer), then the people invited. */
.wl-as { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted-foreground); }
.wl-as .select { height: 36px; border-radius: 10px; }
.wl-people { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.wl-people li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--background); }
.wl-person-mark { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 50%;
  background: var(--secondary); color: var(--primary); font-weight: 600; font-size: 13px; }
.wl-person { flex: 1; min-width: 0; display: grid; }
.wl-person strong { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-person span { font-size: 12.5px; color: var(--muted-foreground); }

/* What she learned from the website, to apply as the firm's profile. */
.wl-review { display: grid; gap: 14px; padding: 18px; border: 1px solid var(--border); border-radius: 16px; background: var(--card);
  box-shadow: 0 16px 40px -24px color-mix(in srgb, var(--foreground) 40%, transparent); }
.wl-review-head { display: flex; align-items: center; gap: 14px; }
.wl-review-head > div { display: grid; gap: 2px; min-width: 0; }
.wl-review-head strong { font-size: 18px; font-weight: 650; letter-spacing: -.015em; }
.wl-review-head span { font-size: 13px; color: var(--muted-foreground); }
.wl-review-logo { width: 48px; height: 48px; flex: none; display: grid; place-items: center; padding: 6px; border-radius: 12px;
  border: 1px solid var(--border); background: #fff; }
.wl-review-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.wl-review-summary { margin: 0; font-size: 14px; line-height: 1.55; }
.wl-review-facts { margin: 0; display: grid; gap: 8px; }
.wl-review-facts div { display: grid; grid-template-columns: 110px 1fr; gap: 12px; font-size: 13px; }
.wl-review-facts dt { color: var(--muted-foreground); }
.wl-review-facts dd { margin: 0; }
.wl-review-uses { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--border); padding-top: 14px; }
.wl-review-uses .wl-chip { padding: 8px 14px; font-size: 13px; }
.wl-swatch { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .12); }

@media (prefers-reduced-motion: reduce) {
  .wl-line, .wl-enter-in, .wl-thread .thread-item.enter { animation: none; }
}
/* Narrow screens: the panel becomes a slim header (no city), the conversation takes the page. */
@media (max-width: 899px) {
  .wl { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .wl-side { height: auto; min-height: 0; display: flex;
    align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
  .wl-city, .wl-line, .wl-side::after { display: none; }
  .wl-brand, .wl-story { position: static; padding: 0; background: none; }
  .wl-brand .wordmark { font-size: 20px; }
  .wl-mark { width: 28px; height: 28px; }
  .wl-steps { gap: 6px; }
  .wl-steps li { gap: 0; font-size: 0; }
  .wl-steps li.current { font-size: 12.5px; gap: 6px; }
  /* The thread from the top and the reply docked at the bottom: centering fights the keyboard. */
  .wl-main { --wl-pad: 16px; height: auto; }
  .wl-main .wl-log { flex: 1 1 auto; margin-top: 0; }
  .wl-main .wl-thread { padding-top: 16px; }
  .wl-reply { margin-bottom: 0; }
  .wl-quick { padding-left: 0; }
  .wl-review-facts div { grid-template-columns: 1fr; gap: 2px; }
  .wl-tools { grid-template-columns: 1fr; }
  .wl-channel { flex-wrap: wrap; }
}

/* Dashboard chat: a full-height thread with no card, Matilda floating at the top, her activity in a side panel. */
.page.page-flush { max-width: none; padding: 0; }
.mchat { display: flex; height: 100dvh; min-height: 0; }
.mchat-main { position: relative; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; overflow: hidden;
  /* Dot grid lives on shell main so every page shares it; chat stays clear so it shows through. */
  background: transparent; }
/* Orb row: 40px action/recent circles with a shared gap on either side of her 64px portrait. */
.mchat-main { --orb-size: 40px; --orb-gap: 10px; --orb-avatar: 64px; }
.mchat-who { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 3; display: grid;
  justify-items: center; gap: 0; border: 0; padding: 0; background: transparent; color: inherit; cursor: pointer; }
.mchat-who .avatar { width: 64px; height: 64px; background: transparent; box-shadow: none;
  transition: transform .15s ease; }
.mchat-who .avatar > .mark { filter: drop-shadow(0 2px 8px #0003); }
.mchat-who:hover .avatar { transform: scale(1.04); }
.mchat-who:focus-visible { outline: none; }
.mchat-who:focus-visible .avatar { outline: 2px solid var(--ring); outline-offset: 3px; }
/* Her quick actions slide out left of her portrait on hover or focus, staggered, and fold back. */
.mchat-wheel { position: absolute; top: 14px; left: 50%; z-index: 2; width: 64px; height: 64px; translate: -50% 0;
  pointer-events: none; }
/* While open, an invisible strip joins the portrait to the buttons so the row stays open. */
.mchat-wheel::before { content: ""; position: absolute; right: 50%; top: 0; width: 340px; height: 64px;
  pointer-events: none; }
.mchat-main.wheel-open .mchat-wheel::before { pointer-events: auto; }
.mchat-wheel > * { position: absolute; top: 12px; left: 12px; display: grid; place-items: center;
  width: var(--orb-size); height: var(--orb-size);
  padding: 0; border: 0; border-radius: 50%; background: var(--background); color: var(--foreground); cursor: pointer;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--foreground) 16%, transparent); pointer-events: none;
  opacity: 0; transform: translate(0, 0) scale(.4);
  transition: transform .26s cubic-bezier(.2, .9, .3, 1.25), opacity .16s ease, background .15s ease;
  transition-delay: calc((3 - var(--i, 0)) * 25ms); }
.mchat-wheel > * svg { width: 18px; height: 18px; }
.mchat-wheel > * img { width: 18px; height: 18px; }
.mchat-wheel > *:hover { background: var(--accent); }
.mchat-wheel > *:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.mchat-main:is(.wheel-open, :has(.mchat-wheel:focus-within)) .mchat-wheel > * { pointer-events: auto; }
.mchat-main:is(.wheel-open, :has(.mchat-wheel:focus-within)) .mchat-wheel > * {
  opacity: 1; transform: translate(var(--x), var(--y)) scale(1); transition-delay: calc(var(--i, 0) * 35ms); }
.mchat[data-panel] .mchat-wheel { display: none; }
@media (hover: none) { .mchat-wheel { display: none; } }
.mchat-log { position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 24px;
  mask-image: linear-gradient(to bottom, transparent 0, #000 110px); -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 110px); }
.mchat-thread { max-width: 760px; min-height: 100%; margin: 0 auto; padding: 116px 0 16px; display: flex;
  flex-direction: column; justify-content: flex-end; }
.mchat-thread .msg { min-width: 0; padding: 12px 18px; border-radius: 22px; font-size: 15px; line-height: 1.55;
  white-space: pre-wrap; overflow-wrap: anywhere; }
.mchat-thread .msg a { color: inherit; text-decoration: underline; }
.mchat-thread .timesep { align-self: center; margin: 18px 0 8px; font-size: 12px; color: var(--muted-foreground); }

/* Chat motion: a time line fades in, and a message that failed to send offers retry. */
.mchat-thread .timesep.enter { animation: fade-in .4s ease both; }
@keyframes fade-in { from { opacity: 0; } }
.mchat-retry { margin: 4px 6px 2px; padding: 0; border: 0; background: none; color: var(--destructive);
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; animation: fade-in .25s ease both; }
.mchat-retry:hover { text-decoration: underline; }

/* The document viewer (doc-viewer.js): every page of a file as it is right now, over whatever page is open. */
.docview { width: min(920px, calc(100vw - 32px)); height: min(calc(100dvh - 48px), 1200px); max-width: none;
  max-height: none; margin: auto; padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 16px;
  background: var(--card); color: var(--card-foreground); box-shadow: 0 24px 64px #0005; }
.docview::backdrop { background: color-mix(in srgb, #000 55%, transparent); }
.docview[open] { animation: docview-in .18s ease; }
.docview-box { display: flex; flex-direction: column; height: 100%; }
.docview-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 16px;
  border-bottom: 1px solid var(--border); }
.docview-icon { flex: none; display: grid; place-items: center; width: 28px; height: 28px; }
.docview-icon svg, .docview-icon .ficon, .docview-icon img { width: 22px; height: 22px; }
.docview-title { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.docview-title h2 { margin: 0; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.docview-sub { min-height: 1.3em; font-size: 12.5px; color: var(--muted-foreground); }
.docview-pages { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; align-items: center;
  gap: 16px; padding: 24px 16px 40px; background: #3B3540; outline: none; }
/* Each page at its own shape, as wide as on paper but never wider than the dialog. */
.docview-page { display: block; flex: none; width: min(var(--w, 816px), 100%); height: auto;
  background: #fff; box-shadow: 0 4px 24px #0006; }
.docview-page:not([data-loaded]) { background: color-mix(in srgb, #fff 92%, #3B3540); }
.docview-page.docview-image { width: auto; max-width: 100%; }
.docview-wait { margin: auto 0; color: #E9E3EE; font-size: 14px; }
.docview-gap { margin: 0; color: #E9E3EE; font-size: 13px; }
.docview-dots { display: inline-flex; gap: 3px; margin-right: 6px; vertical-align: middle; }
.docview-dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor;
  animation: libview-dot 1s infinite ease-in-out; }
.docview-dots i:nth-child(2) { animation-delay: .15s; } .docview-dots i:nth-child(3) { animation-delay: .3s; }
.docview-none { margin: auto 0; display: grid; justify-items: center; gap: 10px; color: #E9E3EE; }
.docview-none svg { width: 48px; height: 48px; stroke-width: 1.2; }
.docview-none p { margin: 0; }
@keyframes docview-in { from { opacity: 0; transform: translateY(8px) scale(.99); } }
@media (max-width: 640px) {
  .docview { width: 100vw; height: 100dvh; border: 0; border-radius: 0; }
  .docview-pages { padding: 8px 0 24px; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { .docview[open], .docview-dots i { animation: none; } }
.mchat-empty { margin: auto; max-width: 360px; text-align: center; color: var(--muted-foreground); }
/* The ask box: a pill; data-tall (set by the chat page) widens the words, buttons drop to a row. */
.mchat-composer { flex: none; display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "files files files" "attach input end"; align-items: end; column-gap: 8px;
  width: calc(100% - 48px); max-width: 820px; margin: 8px auto 20px; padding: 8px;
  border: 1px solid var(--border); border-radius: 30px; background: var(--secondary); }
.mchat-composer[data-tall] { grid-template-areas: "files files files" "input input input" "attach . end";
  border-radius: 24px; }
.mchat-composer[data-tall] .mchat-input { padding: 0 8px 2px; }
.mchat-composer:focus-within { border-color: var(--ring); }
.mchat-composer textarea { flex: 1 1 auto; resize: none; border: 0; outline: 0; padding: 9px 0; background: transparent;
  color: inherit; font: inherit; font-size: 15px; line-height: 1.4; max-height: 160px; }
.mchat-composer textarea::placeholder { color: var(--muted-foreground); }
/* The message box: reads like a text field, holds @mentions as chips (static/mentions.js). */
.mchat-text { flex: 1 1 auto; min-width: 0; padding: 9px 0; outline: 0; background: transparent; color: inherit;
  font-size: 15px; line-height: 1.4; min-height: calc(1.4em + 18px); max-height: min(40dvh, 384px); overflow-y: auto;
  white-space: pre-wrap; overflow-wrap: anywhere; cursor: text; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--foreground) 22%, transparent) transparent; }
.mchat-text[data-empty]::before { content: attr(data-placeholder);
  color: var(--muted-foreground); pointer-events: none; }
.mchat-composer[data-listening] .mchat-text[data-empty]::before { color: var(--destructive); }
/* Only a pencil's chip in the box (static/ask-bar.js): what to write follows it. */
.mchat-text[data-hint]::after { content: attr(data-placeholder); color: var(--muted-foreground); pointer-events: none; }
/* A mention: one thing they pointed her at, in the box and in the sent message. */
.mention { display: inline-flex; align-items: center; gap: 4px; max-width: min(100%, 280px); margin: 0 1px; padding: 0 6px 0 5px;
  border-radius: 6px; background: color-mix(in srgb, var(--primary) 11%, transparent); color: var(--foreground);
  font-weight: 500; line-height: 1.45; vertical-align: bottom; white-space: nowrap; text-decoration: none; user-select: all; }
.mention .ficon { width: 14px; height: 14px; }
.mention-name { overflow: hidden; text-overflow: ellipsis; }
a.mention:hover { background: color-mix(in srgb, var(--primary) 20%, transparent); }
a.mention:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
/* The list @ opens, over the page beside the box it belongs to. */
.mpick { position: fixed; z-index: 70; overflow-y: auto; padding: 4px 6px 6px; border: 1px solid var(--border);
  border-radius: 14px; background: var(--popover, var(--background)); color: var(--popover-foreground, var(--foreground));
  box-shadow: 0 12px 32px -12px rgb(0 0 0 / .28), 0 2px 6px rgb(0 0 0 / .06); }
.mpick[hidden] { display: none; }
.mpick-label { margin: 8px 8px 2px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted-foreground); }
.mpick-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 9px; cursor: pointer; }
.mpick-row[aria-selected="true"] { background: color-mix(in srgb, var(--primary) 12%, transparent); }
.mpick-icon { flex: none; display: grid; place-items: center; width: 22px; height: 22px; }
.mpick-icon .ficon { width: 18px; height: 18px; }
.mpick-main { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.mpick-name { font-size: 14px; color: var(--foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mpick-sub { font-size: 12px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mpick-row mark { background: none; color: inherit; font-weight: 650; }
.mpick-empty { margin: 0; padding: 14px 10px; font-size: 13px; color: var(--muted-foreground); text-align: center; }
.mchat-input { grid-area: input; position: relative; min-width: 0; display: flex; }
/* Her guess at their next message: greyed where they type, until they take it. */
/* The greyed ask lets clicks through to the box; only its Tab chip takes it. */
.mchat-suggest { position: absolute; inset: 0; display: flex; align-items: flex-start; gap: 10px; padding: 9px 0;
  font-size: 15px; line-height: 1.4; color: color-mix(in srgb, var(--muted-foreground) 80%, transparent);
  pointer-events: none; }
.mchat-suggest[hidden] { display: none; }
.mchat-suggest-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mchat-suggest-take { flex: none; pointer-events: auto; padding: 0; border: 0; background: none; cursor: pointer; }
.mchat-suggest-take kbd, .mchat-suggest-take span { display: inline-block; padding: 1px 6px; border: 1px solid var(--border);
  border-radius: 5px; font: 500 11px/1.5 var(--font-sans); color: var(--muted-foreground); background: var(--background); }
.mchat-suggest-take span { display: none; }
@media (hover: none) { .mchat-suggest-take kbd { display: none; } .mchat-suggest-take span { display: inline-block; } }
.mchat-composer .send { flex: none; display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0;
  border-radius: 50%; background: var(--primary); color: var(--primary-foreground); cursor: pointer; overflow: hidden;
  opacity: .35; transform: scale(.9); transition: opacity .18s ease, transform .22s cubic-bezier(.2, .9, .3, 1.3); }
.mchat-composer .send.show { opacity: 1; transform: scale(1); }
.mchat-composer .send.show:hover { transform: scale(1.06); }
.mchat-composer .send.show:active { transform: scale(.92); }
/* On send the arrow flies up and a fresh one rises in. */
.mchat-composer .send.sent svg { animation: send-fly .42s cubic-bezier(.4, 0, .2, 1); }
@keyframes send-fly { 45% { transform: translateY(-22px); opacity: 0; } 46% { transform: translateY(18px); opacity: 0; }
  100% { transform: none; opacity: 1; } }
.mchat-composer { transition: border-color .2s ease, box-shadow .2s ease, border-radius .2s ease; }
.mchat-composer:focus-within { box-shadow: 0 0 0 4px color-mix(in srgb, var(--ring) 12%, transparent); }
.mchat-composer .send:disabled { opacity: .35; cursor: default; }
.mchat-composer .send svg { width: 18px; height: 18px; }
/* Attachments: a paperclip before the text, picked files as chips above it, and in the sent bubble. */
.mchat-composer .attach { flex: none; display: grid; place-items: center; width: 38px; height: 38px; padding: 0;
  border: 0; border-radius: 50%; background: none; color: var(--muted-foreground); cursor: pointer; }
.mchat-composer .attach:hover { background: color-mix(in srgb, var(--foreground) 6%, transparent); color: var(--foreground); }
.mchat-composer .attach:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.mchat-composer .attach svg { width: 18px; height: 18px; }
/* The paperclip's menu: the computer or Google Drive. Opens upward, above the box. */
.mattach { grid-area: attach; position: relative; }
.mattach-menu { position: absolute; left: 0; bottom: calc(100% + 10px); z-index: 20; display: grid; gap: 2px;
  min-width: 210px; padding: 6px; border: 1px solid var(--border); border-radius: 14px; background: var(--popover);
  box-shadow: 0 12px 32px -12px color-mix(in srgb, var(--foreground) 35%, transparent);
  transform-origin: 16px 100%; animation: menu-in .16s cubic-bezier(.2, .9, .3, 1.2); }
.mattach-menu[hidden] { display: none; }
@keyframes menu-in { from { opacity: 0; transform: translateY(6px) scale(.96); } }
.mattach-menu button { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 9px;
  background: none; color: var(--popover-foreground); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.mattach-menu button:hover, .mattach-menu button:focus-visible { background: var(--accent); outline: none; }
.mattach-menu svg, .mattach-menu img { width: 18px; height: 18px; flex: none; color: var(--muted-foreground); }

/* The Google Drive picker */
.drive-picker > div { width: min(560px, calc(100vw - 32px)); }
.drive-picker header { display: grid; gap: 12px; }
.drive-picker h2 { display: flex; align-items: center; gap: 10px; }
.drive-picker h2 img, .drive-picker h2 svg { display: block; width: 22px; height: 22px; }
.drive-picker h2 svg { color: var(--primary); }
.drive-picker section { min-height: 300px; max-height: min(420px, 60vh); overflow-y: auto; }
.drive-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; transition: opacity .15s ease; }
.drive-list[aria-busy] { opacity: .55; }
.drive-list li { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; cursor: pointer;
  animation: fade-in .2s ease both; }
.drive-list li:hover { background: color-mix(in srgb, var(--foreground) 4%, transparent); }
.drive-list li:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.drive-list li[aria-selected=true] { background: var(--accent); }
.drive-list .ficon { width: 22px; height: 22px; }
.drive-meta { flex: 1 1 auto; min-width: 0; display: grid; }
.drive-meta b { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-meta .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-tick { flex: none; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border);
  transition: background .15s ease, border-color .15s ease; }
.drive-list li[aria-selected=true] .drive-tick { border-color: var(--primary); background: var(--primary)
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 14px no-repeat; }
.drive-note { margin: 24px 8px; text-align: center; }
.drive-picker footer { align-items: center; }
.drive-picker footer .small { margin-right: auto; }
/* Talking: the mic sits beside send; listening it turns red with a slow ring, and the box glows. */
.mchat-composer .mic, .mchat-composer .send { grid-area: end; }
.mchat-composer .mic { position: relative; flex: none; display: grid; place-items: center; width: 38px; height: 38px;
  padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted-foreground); cursor: pointer;
  transition: background .2s ease, color .2s ease, transform .2s cubic-bezier(.2, .9, .3, 1.3); }
.mchat-composer .mic[hidden], .mchat-composer .send[hidden] { display: none; }
/* Mic and send share one place; whichever appears pops in. */
.mchat-composer .mic, .mchat-composer .send { animation: btn-pop .22s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes btn-pop { from { opacity: 0; transform: scale(.6) rotate(-20deg); } }
.mchat-composer .mic:hover { background: color-mix(in srgb, var(--foreground) 6%, transparent); color: var(--foreground); }
.mchat-composer .mic:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.mchat-composer .mic svg { position: relative; z-index: 1; width: 18px; height: 18px; }
.mchat-composer .mic .mic-ring { position: absolute; inset: 0; border-radius: 50%; opacity: 0; pointer-events: none; }
.mchat-composer .mic[aria-pressed=true] { background: var(--destructive); color: #fff; transform: scale(1.04); }
.mchat-composer .mic[aria-pressed=true] .mic-ring { background: var(--destructive);
  animation: mic-ring 1.6s cubic-bezier(.2, .6, .4, 1) infinite; }
@keyframes mic-ring { 0% { opacity: .45; transform: scale(1); } 100% { opacity: 0; transform: scale(1.9); } }
.mchat-composer[data-listening] { border-color: color-mix(in srgb, var(--destructive) 55%, var(--border));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--destructive) 12%, transparent); }
.mchat-composer[data-listening] textarea::placeholder { color: var(--destructive); }
.mchat-files { grid-area: files; display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; padding: 4px 6px 2px; }
.mchat-files[hidden] { display: none; }
/* A long paste, kept beside the box as a text file: its name, how long it is, and it opens to read. */
.mfile-open { display: inline-flex; align-items: center; gap: 6px; min-width: 0; padding: 0; border: 0;
  background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.mfile-open > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mfile-open .mfile-meta { flex: none; color: var(--muted-foreground); }
.mfile-open:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 4px; }
.mfile-paste:hover { border-color: color-mix(in srgb, var(--foreground) 24%, var(--border)); }
.paste-view > div { width: min(680px, calc(100vw - 32px)); max-width: none; }
.paste-view header h2 { display: flex; align-items: center; gap: 10px; }
.paste-view header .ficon { width: 22px; height: 22px; }
.paste-view section { min-height: 0; overflow-y: auto; max-height: min(60vh, 560px); }
.paste-text { margin: 0; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--secondary); font: 13.5px/1.6 var(--font-sans); white-space: pre-wrap; overflow-wrap: anywhere; }
.paste-view footer { align-items: center; }
.paste-view footer .btn:first-child { margin-right: auto; }
.mfile { display: inline-flex; align-items: center; gap: 6px; max-width: 260px; padding: 5px 6px 5px 10px;
  border-radius: 10px; background: var(--background); border: 1px solid var(--border); font-size: 13px; line-height: 1.2; }
.ficon { display: block; flex: none; width: 16px; height: 16px; }
.ficon-lg { width: 40px; height: 40px; }
.library-icon .ficon { width: 22px; height: 22px; }
.mfile > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mfile-x { flex: none; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: none;
  color: var(--muted-foreground); font-size: 16px; line-height: 1; cursor: pointer; }
.mfile-x:hover { background: color-mix(in srgb, var(--foreground) 8%, transparent); color: var(--foreground); }
.mchat-main[data-drop] .mchat-composer { border-color: var(--ring); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ring) 18%, transparent); }
.mchat-panel { position: relative; flex: 0 0 400px; min-width: 0; overflow-x: hidden; overflow-y: auto; display: flex; flex-direction: column;
  gap: 14px; padding: 28px 20px 24px; border-left: 1px solid var(--border); background: var(--background); }
.mchat-panel[hidden] { display: none; }
/* Clicking her picture slides the panel in from the right as the thread makes room, and back out on close. */
.mchat-panel.opening { animation: panel-in .34s cubic-bezier(.2, .8, .2, 1) both; }
.mchat-panel.closing { animation: panel-out .28s cubic-bezier(.4, 0, .6, 1) both; pointer-events: none; }
@keyframes panel-in { from { margin-right: -400px; opacity: 0; } 40% { opacity: 1; } }
@keyframes panel-out { to { margin-right: -400px; opacity: 0; } }
/* Portrait arrives by flight — don't fade it up or it blinks on landing. */
.mchat-panel.opening .mchat-hero > *:not(.mchat-hero-pic),
.mchat-panel.opening .mchat-tools, .mchat-panel.opening .mchat-home {
  animation: fade-up .34s cubic-bezier(.2, .8, .2, 1) both; }
.mchat-panel.opening .mchat-hero > :nth-child(2) { animation-delay: .04s; }
.mchat-panel.opening .mchat-hero > :nth-child(3) { animation-delay: .08s; }
.mchat-panel.opening .mchat-hero > :nth-child(n+4) { animation-delay: .12s; }
.mchat-panel.opening .mchat-home { animation-delay: .14s; }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } }
.mchat-close { position: absolute; top: 12px; right: 12px; }
/* Top of her panel: the portrait centred with her tools in a row beneath. */
.mchat-hero { display: grid; justify-items: center; gap: 12px; padding: 4px 0 2px; text-align: center; }
.mchat-panel .mchat-tools { margin: 0; }
.mchat-panel .mchat-tool { width: 36px; height: 36px; }
.live-dot { display: none; }
.mchat-hero-pic { position: relative; display: inline-grid; flex: none; }
.mchat-hero .avatar { width: 84px; height: 84px; background: transparent; box-shadow: none; }
.mchat-hero .avatar > .mark { filter: drop-shadow(0 2px 10px #0003); }
/* Read aloud, never shown (the Basecoat bundle here has no Tailwind utilities). */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.mchat-sec-head { display: flex; align-items: center; justify-content: space-between; }
.mchat-sec-head .eyebrow { margin: 0; }
.mchat-sec-link { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  color: var(--muted-foreground); }
.mchat-sec-link:hover { background: var(--muted); color: var(--foreground); }
.mchat-sec-link svg { width: 15px; height: 15px; }
.mchat-none { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 18px 0 0; color: var(--muted-foreground);
  font-size: 13px; }
.mchat-none svg { width: 22px; height: 22px; opacity: .5; }
/* Docked here, her callouts read as Updates and step aside when there are none. */
.mchat-hero h2 { margin: 0; font-size: 22px; }
.mchat-panel .eyebrow { margin: 6px 0 0; }
.mchat-panel .link { align-self: center; }
/* Open, the portrait over the thread steps aside instantly: the flyer carries the motion. */
.mchat-who { transition: none; }
.mchat[data-panel] .mchat-who { opacity: 0; transform: translateX(-50%) scale(.85); pointer-events: none; }
/* One portrait in flight (chat.html, matilda-panel.js): both real faces stay hidden. */
body > .mchat-ghost { position: fixed; z-index: 70; margin: 0; pointer-events: none; transform-origin: 0 0;
  filter: drop-shadow(0 6px 14px #0002); will-change: transform; }
.mchat.mchat-flying .mchat-hero-pic,
.mchat.mchat-flying-back .mchat-hero-pic { visibility: hidden; animation: none; }
.mchat.mchat-flying-back .mchat-who { opacity: 0; }
/* Soul, Memory and Computer: buttons under her name, each opening its page in the panel. */
/* One row of round icons under her name; each names itself on hover. */
.mchat-tools { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 14px; }
.mchat-tool { display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0;
  border-radius: 50%; background: color-mix(in srgb, var(--foreground) 5%, transparent); color: var(--foreground);
  cursor: pointer; transition: background .15s ease, color .15s ease; }
.mchat-tool svg { width: 17px; height: 17px; }
.mchat-tool img { width: 18px; height: 18px; }
.mchat-tool:hover { background: var(--accent); }
.mchat-tool[aria-pressed=true] { background: var(--primary); color: var(--primary-foreground); }
.mchat-tool:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.mchat-home, .mchat-view { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.mchat-home[hidden], .mchat-view[hidden] { display: none; }
.mchat-view-head { display: flex; align-items: center; gap: 6px; }
.mchat-view-head h3 { display: flex; align-items: center; gap: 8px; margin: 0 auto 0 0; font-size: 16px; }
.mchat-view-head h3 svg { width: 17px; height: 17px; color: var(--primary); }
.mchat-view > p { margin: 0; }
.mchat-view .eyebrow { margin: 4px 0 -6px; }
.mchat-panel .mchat-view .link { align-self: auto; }
/* Computer in the panel: one live screen (static/screen.js), the panel widened for it. */
.mchat-panel:has(.mchat-view[data-view=computer]:not([hidden])),
.matilda-shell-panel:has(.mchat-view[data-view=computer]:not([hidden])) { flex-basis: var(--comp-w); }
:root { --comp-w: min(780px, 58vw); }
@media (min-width: 768px) {
  html[data-matilda-panel]:has(.matilda-shell-panel .mchat-view[data-view=computer]:not([hidden])) .askbar { right: var(--comp-w); }
}
.mcomp { position: relative; display: grid; gap: 10px; min-width: 0; }
.mcomp-picks { display: flex; gap: 4px; flex-wrap: wrap; }
.mcomp-picks button { padding: 4px 10px; border: 0; border-radius: 999px; background: none; color: var(--muted-foreground);
  font: inherit; font-size: 12.5px; cursor: pointer; }
.mcomp-picks button:hover { background: var(--muted); color: var(--foreground); }
.mcomp-picks button[aria-selected=true] { background: var(--muted); color: var(--foreground); font-weight: 600; }
.mcomp-screen { position: relative; aspect-ratio: 1280 / 840; border-radius: 14px; overflow: hidden; color: #fff;
  background: radial-gradient(120% 90% at 50% 40%, #1d1428, #0d0a12); box-shadow: inset 0 0 0 1px #ffffff10; }
.mcomp-screen[role=button] { cursor: pointer; }
.mcomp-screen:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.mcomp-view { position: absolute; inset: 0; }
.mcomp-view canvas { width: 100% !important; height: 100% !important; object-fit: contain; }
.mcomp-power { position: absolute; inset: 0; margin: auto; display: grid; place-items: center; width: 52px; height: 52px; padding: 0;
  border: 0; border-radius: 50%; color: #ffffffa6; background: #ffffff14; cursor: pointer;
  transition: opacity .25s ease, transform .25s ease, background .15s ease; }
.mcomp-power:disabled { cursor: default; color: #ffffff59; background: #ffffff0d; }
.mcomp-power svg { width: 22px; height: 22px; }
.mcomp-power:not(:disabled):hover, .mcomp-screen[role=button]:hover .mcomp-power { color: #fff; background: #ffffff26; transform: scale(1.06); }
.mcomp-screen:is([data-state=live], [data-state=taking]) .mcomp-power { opacity: 0; transform: scale(.8); pointer-events: none; }
.mcomp-screen:is([data-state=starting], [data-state=connecting]) .mcomp-power { pointer-events: none; animation: m-breathe 1.2s ease-in-out infinite; }
.mcomp-note { position: absolute; left: 0; right: 0; top: calc(50% + 38px); text-align: center; font-size: 13px; color: #ffffffa6; }
.mcomp-screen[data-state=live] .mcomp-note, .mcomp-screen[data-state=taking] .mcomp-note { top: auto; bottom: 14px; }
.mcomp-note:empty { display: none; }
.mcomp-screen[data-state=live] .mcomp-note:not(:empty), .mcomp-screen[data-state=taking] .mcomp-note {
  justify-self: center; width: max-content; max-width: calc(100% - 24px); margin: 0 auto; padding: 5px 12px; border-radius: 999px; background: #000000b3; color: #fff; }
/* The slim bar over the screen: who has control, and one action. */
.mcomp-ctl { position: absolute; top: 0; left: 0; right: 0; height: 40px; display: flex; align-items: center; gap: 8px;
  padding: 0 6px 0 14px; background: #0d0a12; font-size: 12.5px; }
.mcomp-screen:not([data-state=live], [data-state=taking]) .mcomp-ctl { display: none; }
/* The bar sits above the desk, never over its browser's address bar. */
.mcomp-screen:is([data-state=live], [data-state=taking]) .mcomp-view { top: 40px; }
.mcomp-who { font-weight: 600; }
.mcomp-who::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%;
  background: var(--primary); vertical-align: 1px; }
.mcomp-screen[data-control] .mcomp-who::before { background: #3fd17a; }
.mcomp-keep { color: #ffffff99; }
.mcomp-screen:not([data-manual]) .mcomp-keep { display: none; }
.mcomp-act { margin-left: auto; padding: 5px 12px; border: 0; border-radius: 8px; background: #fff; color: #111;
  font: inherit; font-weight: 600; cursor: pointer; }
.mcomp-act:hover { background: #ffffffd9; }
.mcomp-pop { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; color: #ffffffb3; }
.mcomp-act[hidden] + .mcomp-pop { margin-left: auto; }
.mcomp-pop:hover { background: #ffffff1f; color: #fff; }
.mcomp-pop svg { width: 15px; height: 15px; }
.mcomp-btn { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: var(--muted-foreground); }
.mcomp-btn:hover { background: var(--muted); color: var(--foreground); }
.mcomp-btn svg { width: 15px; height: 15px; }
.mcomp-settings { justify-self: start; }
/* The task page: the same screen, as large as the page allows. */
#ctask > .mcomp-screen { width: 100%; max-width: 1280px; }
@media (max-width: 767px) {
  /* A phone: the screen fills the panel sheet; the bar stays on top of it. */
  .mchat-view[data-view=computer] .mcomp-screen { aspect-ratio: auto; height: calc(100dvh - 250px); min-height: 240px; }
  .mcomp-act { padding: 8px 14px; }
}
/* Logins: one row per site; a row opens its change form, the add row opens the add form. */
.mlogin-list { display: grid; gap: 2px; margin: 8px 0 0; padding: 0; list-style: none; }
.mlogin { display: flex; align-items: flex-start; gap: 6px; padding: 8px 0; border-top: 1px solid var(--border); }
.mlogin details { flex: 1; min-width: 0; }
.mlogin summary { display: grid; gap: 2px; cursor: pointer; list-style: none; min-height: 30px; align-content: center; }
.mlogin summary::-webkit-details-marker { display: none; }
.mlogin summary:has(svg) { display: flex; align-items: center; gap: 8px; color: var(--muted-foreground); }
.mlogin summary svg { width: 15px; height: 15px; }
.mlogin-host { overflow-wrap: anywhere; }
.mlogin .who-edit-stack { margin-top: 8px; }
.mlogin .who-edit-stack .btn { justify-self: start; }
/* Goals: a ring that fills with the plan, her line under the title; a row opens its card in place. */
.goals { display: grid; gap: 14px; max-width: 720px; margin: 0 auto; }
.goals-bar { display: flex; justify-content: flex-end; }
.mgoal-list { display: grid; margin: 0; padding: 0; list-style: none; }
.mgoal { border-top: 1px solid var(--border); }
.mgoal:first-child { border-top: 0; }
.mgoal summary { display: flex; align-items: flex-start; gap: 11px; padding: 10px 2px; cursor: pointer; list-style: none;
  border-radius: 10px; }
.mgoal summary::-webkit-details-marker { display: none; }
.mgoal summary:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.mgoal-ring { flex: none; display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%;
  color: var(--primary-foreground);
  background: conic-gradient(var(--primary) calc(var(--p) * 1%), color-mix(in srgb, var(--foreground) 9%, transparent) 0);
  -webkit-mask: radial-gradient(circle, transparent 5.5px, #000 6px); mask: radial-gradient(circle, transparent 5.5px, #000 6px); }
.mgoal[data-done] .mgoal-ring { background: var(--primary); -webkit-mask: none; mask: none; }
.mgoal-ring svg { width: 12px; height: 12px; stroke-width: 3; }
.mgoal-main { display: grid; gap: 2px; min-width: 0; }
.mgoal-title { font-size: 14px; font-weight: 550; line-height: 1.35; overflow-wrap: anywhere; }
.mgoal[data-done] .mgoal-title { color: var(--muted-foreground); text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--muted-foreground) 50%, transparent); }
.mgoal-dot { display: inline-block; width: 6px; height: 6px; margin: 0 0 2px 7px; border-radius: 50%; background: var(--primary);
  vertical-align: middle; }
.mgoal-line { font-size: 12.5px; color: var(--muted-foreground); line-height: 1.4; display: -webkit-box;
  -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.mgoal-line.late, .mgoal-meta .late { color: var(--destructive); }
.mgoal-card { display: grid; gap: 12px; padding: 0 2px 14px 31px; font-size: 13px; }
.mgoal-muted { margin: 0; color: var(--muted-foreground); line-height: 1.5; }
.mchat-doc-none { margin: 0; color: var(--muted-foreground); font-size: 13px; }
.mgoal-steps { display: grid; gap: 1px; margin: 0; padding: 0; list-style: none; }
.mgoal-steps form { margin: 0; }
.mgoal-step { display: flex; align-items: flex-start; gap: 9px; width: 100%; padding: 5px 6px 5px 0; border: 0; background: none;
  color: var(--foreground); font: inherit; line-height: 1.4; text-align: left; cursor: pointer; border-radius: 6px; }
.mgoal-step:disabled { cursor: default; }
.mgoal-step:focus-visible { outline: 2px solid var(--ring); }
.mgoal-box { flex: none; display: grid; place-items: center; width: 16px; height: 16px; margin-top: 1px; border-radius: 5px;
  border: 1.5px solid color-mix(in srgb, var(--foreground) 28%, transparent); color: transparent; }
.mgoal-box svg { width: 11px; height: 11px; stroke-width: 3; }
.mgoal-step:not(:disabled):hover .mgoal-box { border-color: var(--primary); }
.mgoal-step[aria-checked=true] .mgoal-box { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.mgoal-step[aria-checked=true] > span:last-child { color: var(--muted-foreground); text-decoration: line-through; }
.mgoal-meta { display: grid; gap: 5px; margin: 0; }
.mgoal-meta div { display: flex; align-items: flex-start; gap: 9px; }
.mgoal-meta dt { flex: none; display: grid; place-items: center; width: 16px; height: 19px; color: var(--muted-foreground); }
.mgoal-meta dt svg { width: 13px; height: 13px; }
.mgoal-meta dd { margin: 0; line-height: 1.45; }
.mgoal-days { display: grid; gap: 3px; padding-left: 10px; border-left: 1px solid var(--border); }
.mgoal-day { margin: 6px 0 1px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted-foreground); }
.mgoal-day:first-child { margin-top: 0; }
.mgoal-act { display: flex; gap: 8px; margin: 0; font-size: 12.5px; line-height: 1.45; }
.mgoal-act time { flex: none; min-width: 52px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.mgoal-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0; }
.mgoal-acts form { display: contents; }
.mgoal-acts .btn svg { width: 14px; height: 14px; }
.mgoal-acts .mchat-doc-act { margin-left: auto; }
.mgoal-acts form:last-child .mchat-doc-act:hover { color: var(--destructive); }
.mgoal-plan { display: grid; gap: 8px; padding: 12px; border-radius: 12px; background: var(--accent); }
.mgoal-plan-h { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; }
.mgoal-plan-h svg { width: 14px; height: 14px; color: var(--primary); }
.mgoal-plan ol { display: grid; gap: 3px; margin: 0; padding-left: 18px; line-height: 1.45; }
.mgoal-plan .mgoal-acts { margin-top: 2px; }
.mgoals-done > summary { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 0; cursor: pointer; list-style: none;
  font-size: 12.5px; color: var(--muted-foreground); }
.mgoals-done > summary::-webkit-details-marker { display: none; }
.mgoals-done > summary svg { width: 13px; height: 13px; transition: transform .15s ease; }
.mgoals-done[open] > summary svg { transform: rotate(90deg); }
/* Soul and Memory views: a title, then its few quiet buttons. */
.mchat-doc-view .mchat-view-head { gap: 2px; }
.mchat-doc-view .mchat-view-head h3 { font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.mchat-doc-act { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0;
  border-radius: 8px; background: none; color: var(--muted-foreground); cursor: pointer; }
.mchat-doc-act:hover, .mchat-doc-act[aria-pressed=true] { background: var(--muted); color: var(--foreground); }
.mchat-doc-act svg { width: 15px; height: 15px; }
/* Soul and Memory (_haze.html): soft fragments, sharp on hover, focus or tap; older memories fainter. */
/* One column no wider than the panel: a long address or link wraps instead of widening it. */
.haze { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; margin: 0 -8px; padding: 0; list-style: none; }
.haze-item { --f: 0; --tint: var(--chart-1); display: flex; align-items: baseline; gap: 10px; padding: 7px 8px;
  border-radius: 10px; font-size: 13.5px; line-height: 1.55; outline: none; cursor: default; transition: background .3s ease; }
.haze-item > span { min-width: 0; overflow-wrap: anywhere; filter: blur(calc(.35px + var(--f) * 1.6px)); opacity: calc(.92 - var(--f) * .45);
  text-shadow: 0 0 12px color-mix(in srgb, var(--tint) 50%, transparent);
  transition: filter .4s ease, opacity .4s ease, text-shadow .4s ease; }
.haze-item > svg { flex: none; width: 12px; height: 12px; color: var(--tint); opacity: calc(.9 - var(--f) * .4); translate: 0 1px; }
.haze-item:is(:hover, :focus, [aria-pressed=true]) { background: color-mix(in srgb, var(--tint) 9%, transparent); }
.haze-item:is(:hover, :focus, [aria-pressed=true]) > span { filter: none; opacity: 1; text-shadow: none; }
.haze-item:focus-visible { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--tint) 60%, transparent); }
.haze-item[data-scope=chat] { --tint: var(--chart-4); }
.haze-item[data-scope=team] { --tint: var(--chart-5); }
/* Her soul: one even veil, in her serif. */
.haze[data-haze=soul] .haze-item { --f: .45; --tint: var(--primary); font-family: var(--font-brand); font-size: 14.5px; line-height: 1.6; }
.haze[data-haze=soul] .haze-item[data-head] { --f: .15; margin-top: 10px; font-family: var(--font-sans); font-size: 11px;
  font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-foreground); }
.haze[data-haze=soul] .haze-item[data-head]:first-child { margin-top: 0; }
@media (prefers-reduced-motion: reduce) { .haze-item > span { transition: none; } }
@media (max-width: 767px) {
  .mchat { height: calc(100dvh - 57px); }
  .mchat-log { padding: 0 14px; }
  .mchat-composer { width: calc(100% - 24px); margin-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .mchat-panel { position: fixed; inset: 0; z-index: 40; flex: none; border-left: 0; }
  .mchat-panel.opening { animation-name: panel-in-phone; }
  .mchat-panel.closing { animation-name: panel-out-phone; }
  @keyframes panel-in-phone { from { transform: translateX(100%); } }
  @keyframes panel-out-phone { to { transform: translateX(100%); } }
}

/* Organization, Database: the read-only schema canvas (static/schema-map.js) */
.dbmap { display: flex; flex-direction: column; gap: 12px; }
.dbmap [data-domain="integrations"] { --dom: #2F6FD0; }
.dbmap [data-domain="team"] { --dom: #8A3FFC; }
.dbmap [data-domain="threads"] { --dom: #23907F; }
.dbmap [data-domain="assistant"] { --dom: #D0632B; }
.dbmap [data-domain="system"] { --dom: #7C7590; }
.dbmap [data-domain="other"] { --dom: #B0467F; }
html.dark .dbmap [data-domain="integrations"] { --dom: #6FA1F2; }
html.dark .dbmap [data-domain="team"] { --dom: #B48CFF; }
html.dark .dbmap [data-domain="threads"] { --dom: #4CC3AE; }
html.dark .dbmap [data-domain="assistant"] { --dom: #F0915E; }
html.dark .dbmap [data-domain="system"] { --dom: #A9A2BC; }
html.dark .dbmap [data-domain="other"] { --dom: #E07DB4; }
.dbmap-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.dbmap-search { width: 260px; max-width: 100%; }
.dbmap-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.dbmap-zoom { display: flex; gap: 6px; margin-left: auto; }
.dbmap-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted-foreground); }
.dbmap-chip { display: inline-flex; align-items: center; gap: 6px; }
.dbmap-chip i, .dbmap-info-head i { width: 10px; height: 10px; border-radius: 3px; background: var(--dom); }
.dbmap-canvas { position: relative; height: min(76vh, 860px); min-height: 420px; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius); cursor: grab; touch-action: none; user-select: none;
  background-color: var(--background);
  background-image: radial-gradient(circle, color-mix(in srgb, var(--muted-foreground) 28%, transparent) 1px, transparent 1.2px);
  background-size: 22px 22px; }
.dbmap-canvas:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.dbmap-canvas.is-panning { cursor: grabbing; }
.dbmap-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.dbmap-links { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.dbmap-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; }
.dbmap-zone { position: absolute; left: 0; top: 0; border-radius: 18px; pointer-events: none;
  background: color-mix(in srgb, var(--dom) 6%, transparent); border: 1px dashed color-mix(in srgb, var(--dom) 30%, transparent); }
.dbmap-zone-label { position: absolute; left: 18px; top: 10px; font-size: 15px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--dom); white-space: nowrap; }
.dbmap-card { position: absolute; left: 0; top: 0; width: 248px; border-radius: 10px; overflow: hidden; cursor: pointer;
  background: var(--card); color: var(--card-foreground); border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgb(0 0 0 / .06), 0 4px 14px rgb(0 0 0 / .05); transition: opacity .15s ease, box-shadow .15s ease; }
.dbmap-card:hover { box-shadow: 0 0 0 1px color-mix(in srgb, var(--dom) 45%, transparent), 0 6px 18px rgb(0 0 0 / .08); }
.dbmap-card.is-dragging { cursor: grabbing; z-index: 5; box-shadow: 0 10px 30px rgb(0 0 0 / .18); }
.dbmap-card.is-selected { z-index: 4; box-shadow: 0 0 0 2px var(--dom), 0 10px 26px rgb(0 0 0 / .14); }
.dbmap-card.is-related { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--dom) 60%, transparent), 0 4px 14px rgb(0 0 0 / .06); }
.dbmap-card.is-dim { opacity: .22; }
.dbmap-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 42px; padding: 0 12px;
  border-top: 4px solid var(--dom); background: color-mix(in srgb, var(--dom) 9%, var(--card));
  border-bottom: 1px solid var(--border); box-sizing: border-box; }
.dbmap-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbmap-rows { flex: none; font-size: 11px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.dbmap-cols { list-style: none; margin: 0; padding: 0 0 8px; }
.dbmap-col { display: flex; align-items: center; gap: 6px; height: 22px; padding: 0 12px 0 8px; font-size: 12px; }
.dbmap-col.is-match { background: color-mix(in srgb, var(--warn) 22%, transparent); }
.dbmap-col.is-linked { background: color-mix(in srgb, var(--dom) 14%, transparent); }
.dbmap-key { flex: none; width: 20px; font-size: 9px; font-weight: 700; letter-spacing: .02em; color: var(--muted-foreground); text-align: center; }
.dbmap-key.is-pk { color: var(--warn); }
.dbmap-key.is-fk { color: var(--dom); }
.dbmap-cname { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }
.dbmap-cname.is-null { color: color-mix(in srgb, var(--card-foreground) 78%, transparent); }
.dbmap-ctype { flex: none; font-size: 10.5px; color: var(--muted-foreground); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.dbmap-link .dbmap-line { fill: none; stroke: color-mix(in srgb, var(--muted-foreground) 55%, transparent); stroke-width: 1.4;
  vector-effect: non-scaling-stroke; transition: opacity .15s ease; }
.dbmap-link.is-implied .dbmap-line { stroke-dasharray: 5 4; }
.dbmap-link .dbmap-end { fill: var(--card); stroke: color-mix(in srgb, var(--muted-foreground) 70%, transparent); stroke-width: 1.4; }
.dbmap-link .dbmap-end.is-one { fill: color-mix(in srgb, var(--muted-foreground) 70%, transparent); }
.dbmap-link.is-active .dbmap-line { stroke: var(--primary); stroke-width: 2.4; }
.dbmap-link.is-active .dbmap-end { stroke: var(--primary); }
.dbmap-link.is-active .dbmap-end.is-one { fill: var(--primary); }
.dbmap-link.is-dim { opacity: .1; }
.dbmap-info { position: absolute; top: 12px; right: 12px; width: 280px; max-height: calc(100% - 24px); overflow-y: auto;
  padding: 12px 14px; border-radius: 10px; background: var(--popover); color: var(--popover-foreground);
  border: 1px solid var(--border); box-shadow: 0 10px 30px rgb(0 0 0 / .12); cursor: default; user-select: text; }
.dbmap-info p { margin: 4px 0; }
.dbmap-info h4 { margin: 12px 0 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-foreground); }
.dbmap-info-head { display: flex; align-items: center; gap: 8px; }
.dbmap-info-head strong { flex: 1 1 auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; word-break: break-all; }
.dbmap-jump { display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 5px 8px; border: 0; border-radius: 6px;
  background: transparent; color: inherit; text-align: left; cursor: pointer; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.dbmap-jump:hover { background: var(--accent); }
.dbmap-jump em { font: italic 11px var(--font-sans); }
@media (max-width: 767px) {
  .dbmap-zoom { margin-left: 0; }
  .dbmap-canvas { height: 70vh; }
  .dbmap-info { left: 12px; width: auto; max-height: 45%; top: auto; bottom: 12px; }
}

/* Matilda's icon sits where Chat's portrait does, top centre of the page column; callouts hang below (static/callouts.js).
   On Chat her portrait stands in: the script places the orb over it. */
.morb { --orb-size: 40px; --orb-gap: 10px; --orb-avatar: 64px; --tuck: -8px;
  position: fixed; z-index: 60; top: 14px; left: calc(50% + var(--sidebar-width) / 2); width: var(--orb-avatar);
  height: var(--orb-avatar); translate: -50% 0; transform-origin: 50% 0; pointer-events: none; }
.morb[data-page=chat] { translate: none; }
.morb > * { pointer-events: auto; }
/* Quick actions: a row to the left of her icon, timing and hover bridge as on Chat. */
.morb-wheel { position: absolute; top: 0; left: 50%; width: 100%; height: 100%; translate: -50% 0; pointer-events: none; }
.morb-wheel::before { content: ""; position: absolute; right: 50%; top: 0; width: 340px; height: 100%; pointer-events: none; }
.morb:is(.wheel-open, :has(.morb-wheel:focus-within)) .morb-wheel::before { pointer-events: auto; }
.morb-wheel > * { position: absolute; top: calc(50% - var(--orb-size) / 2); left: calc(50% - var(--orb-size) / 2);
  display: grid; place-items: center;
  width: var(--orb-size); height: var(--orb-size); padding: 0; border: 0; border-radius: 50%;
  background: var(--background); color: var(--foreground); cursor: pointer; pointer-events: none; opacity: 0;
  transform: translate(0, 0) scale(.4);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--foreground) 16%, transparent);
  transition: transform .26s cubic-bezier(.2, .9, .3, 1.25), opacity .16s ease, background .15s ease;
  transition-delay: calc((3 - var(--i, 0)) * 25ms); }
.morb:is(.wheel-open, :has(.morb-wheel:focus-within)) .morb-wheel > * { opacity: 1; pointer-events: auto;
  transform: translate(var(--x), var(--y)) scale(1); transition-delay: calc(var(--i, 0) * 35ms); }
.morb-wheel > *:hover { background: var(--accent); }
.morb-wheel > *:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.morb-wheel svg { width: 18px; height: 18px; }
.morb-wheel img { width: 18px; height: 18px; }
@media (hover: none) { .morb-wheel { display: none; } }
.morb-btn { position: relative; display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%;
  border: 0; padding: 0; cursor: pointer; background: transparent; box-shadow: none;
  transition: transform .15s ease; }
.morb-btn:hover { transform: scale(1.04); }
.morb-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; }
/* Transparent around the disc; shadow follows her silhouette, not a white plate. */
.morb-btn > .mark { border-radius: 50%; width: 100%; height: 100%; background: transparent; overflow: hidden;
  filter: drop-shadow(0 2px 8px #0003); }
/* Page + panel: same flex push as Chat — the panel takes 400px and the page makes room. */
.shell-stage { display: flex; align-items: flex-start; min-width: 0; min-height: 100dvh; }
.shell-stage > main { flex: 1 1 auto; min-width: 0; }
.matilda-shell-panel { position: sticky; top: 0; z-index: 5; flex: 0 0 400px; align-self: flex-start;
  height: 100dvh; max-height: 100dvh; }
.matilda-shell-panel[hidden] { display: none; }
/* A phone: the panel is the whole screen, whichever view it holds. */
@media (max-width: 767px) {
  .matilda-shell-panel, .matilda-shell-panel:has(.mchat-view[data-view=computer]:not([hidden])) { flex-basis: 100%; }
  html[data-matilda-panel] .shell-stage > main { display: none; }
}
/* On Chat the page already has its own panel; never show the shell copy. */
body:has(.morb[data-page=chat]) .matilda-shell-panel { display: none !important; }
/* Open: her orb steps aside instantly; only the flying copy moves. */
.morb { transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
html[data-matilda-panel] .morb { opacity: 0; scale: .85; pointer-events: none; }
html[data-matilda-flying] .matilda-shell-panel .mchat-hero-pic,
html[data-matilda-flying-back] .matilda-shell-panel .mchat-hero-pic { visibility: hidden; animation: none; }
html[data-matilda-flying-back] .morb { opacity: 0; transform: none; }
/* On Chat her portrait stands in from the first paint: no orb or wheel there, only the bubbles. */
.morb[data-page=chat] > .morb-btn, .morb[data-page=chat] > .morb-wheel { display: none; }
/* Room under her on every other page (Chat pads its thread), and under her recent work. */
body:has(.morb:not([data-page=chat])) .shell-stage > main > .page:not(.page-flush) { padding-top: 92px; }
@media (hover: hover) {
  body:has(.morb:not([data-page=chat]) > #orb-rail:not([hidden])) .shell-stage > main > .page:not(.page-flush) { padding-top: 144px; }
}
/* Her recent work under her icon as on Chat, spread rightwards on hover; hidden while she speaks. */
.morb > .morb-btn { z-index: 3; }
.morb > .mchat-rail:not([hidden]) { top: calc(100% + 8px); transition: opacity .2s ease, top .28s cubic-bezier(.2, .9, .3, 1.15),
  translate .28s cubic-bezier(.2, .9, .3, 1.15), padding .28s ease; }
.morb:is(.wheel-open, :has(.morb-wheel:focus-within), :has(.mchat-rail:focus-within)) > .mchat-rail:not([hidden]) {
  top: 0; height: 100%; translate: 0 0; padding-left: calc(var(--orb-avatar) / 2 + var(--orb-gap)); }
.morb:has(.mc-card) > .mchat-rail { opacity: 0; pointer-events: none; }
.morb:is(.wheel-open, :has(.morb-wheel:focus-within), :has(.mchat-rail:focus-within)) .rail-card {
  margin-left: var(--orb-gap); box-shadow: 0 3px 12px color-mix(in srgb, var(--foreground) 18%, transparent); }
.morb:is(.wheel-open, :has(.morb-wheel:focus-within), :has(.mchat-rail:focus-within)) .rail-card:first-child { margin-left: 0; }
.morb .rail-card { cursor: pointer; }
@media (hover: none) {
  .morb > .mchat-rail:not([hidden]) { top: 0; height: 100%; }
  .morb .rail-card { margin-left: var(--orb-gap); }
  .morb .rail-card:first-child { margin-left: 0; }
}
/* Basecoat sizes every span in an .avatar to fill it; the count is a small pill on the rim. */
.morb-btn > .morb-count { position: absolute; top: -3px; right: -3px; display: block; width: auto; min-width: 20px;
  height: 20px; padding: 0 5px; border-radius: 10px; background: var(--primary); color: var(--primary-foreground); font-size: 11px;
  font-weight: 600; line-height: 20px; text-align: center; box-shadow: 0 0 0 2px var(--background); }
.morb-btn > .morb-count[hidden] { display: none; }

/* A callout: one line, at most one action, a tail pointing at her; it grows out of her and folds back. */
.morb { --mc-edge: color-mix(in srgb, var(--foreground) 9%, transparent);
  --mc-shadow: 0 1px 1px #2B15400a, 0 4px 8px #2B15400d, 0 16px 40px -8px #2B154033; }
.dark .morb { --mc-edge: color-mix(in srgb, #fff 10%, transparent);
  --mc-shadow: 0 1px 1px #0006, 0 8px 16px #0005, 0 20px 48px -8px #000a; }
.morb-bubbles { position: absolute; left: 50%; top: calc(100% + 12px); translate: -50% 0;
  width: max-content; max-width: min(340px, calc(100vw - 32px)); pointer-events: none; }
.mc-card { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 14px; pointer-events: auto;
  border-radius: 18px; background: var(--popover); color: var(--popover-foreground);
  box-shadow: var(--mc-shadow), inset 0 0 0 1px var(--mc-edge);
  transform-origin: 50% -12px;
  opacity: 0; transform: var(--from, translateY(-12px) scale(.3));
  transition: transform .34s cubic-bezier(.2, .9, .3, 1.15), opacity .2s ease; }
.mc-card[data-state=in] { opacity: 1; transform: none; }
.mc-card[data-state=out] { pointer-events: none; transition-duration: .22s; }
/* The tail, pointing up at her. */
.mc-card::after { content: ""; position: absolute; left: calc(50% - 6px); top: -6px; width: 12px; height: 12px;
  border-radius: 3px 0 0; background: var(--popover); transform: rotate(45deg);
  box-shadow: -1px -1px 0 var(--mc-edge); }
.mc-dot { flex: none; align-self: flex-start; margin-top: 6px; width: 7px; height: 7px; border-radius: 50%;
  background: color-mix(in srgb, var(--muted-foreground) 55%, transparent); }
[data-kind=ok] > .mc-dot { background: var(--ok); }
[data-kind=bad] > .mc-dot { background: var(--destructive); }
[data-kind=ask] > .mc-dot { background: var(--primary); }
[data-kind=working] > .mc-dot { background: var(--primary); animation: mc-breathe 1.8s ease-in-out infinite; }
@keyframes mc-breathe { 50% { opacity: .35; } }
.mc-body { flex: 1 1 auto; min-width: 0; display: grid; gap: 1px; overflow-wrap: anywhere; }
.mc-line { font-size: 13.5px; font-weight: 500; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mc-text { font-size: 12.5px; line-height: 1.4; color: var(--muted-foreground);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mc-act { flex: none; max-width: 9.5em; padding: 5px 12px; border-radius: 999px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; font-size: 12.5px; font-weight: 500; color: inherit; text-decoration: none;
  background: color-mix(in srgb, var(--foreground) 8%, transparent); }
.mc-act:hover { background: color-mix(in srgb, var(--foreground) 14%, transparent); }
[data-kind=ask] > .mc-act { background: var(--primary); color: var(--primary-foreground); }
[data-kind=ask] > .mc-act:hover { background: color-mix(in srgb, var(--primary) 88%, #000); }
.mc-act:focus-visible, .mc-x:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.mc-x { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 50%;
  cursor: pointer; color: var(--muted-foreground); background: transparent; transition: background .15s ease, color .15s ease; }
.mc-x svg { width: 13px; height: 13px; }
.mc-x:hover { color: var(--foreground); background: color-mix(in srgb, var(--foreground) 10%, transparent); }

/* Scrolled off Chat (callouts.js sets data-scrolled), or on a full-height document: she tucks up small until wanted. */
:is(html[data-scrolled], html:has(.libview)):not([data-matilda-panel], [data-matilda-flying-back])
  .morb:not([data-page=chat], :hover, :has(:focus-visible), .wheel-open, :has(.mc-card)) { transform: translateY(var(--tuck)) scale(.6); }
:is(html[data-scrolled], html:has(.libview)):not([data-matilda-panel], [data-matilda-flying-back])
  .morb:not([data-page=chat], :hover, :has(:focus-visible), .wheel-open, :has(.mc-card)) > .mchat-rail { opacity: 0; pointer-events: none; }
@media (min-width: 768px) {
  body:has(.morb:not([data-page=chat])) .libview-title { max-width: calc(50% - 110px); margin-right: auto; }
}
/* A phone: below the menu bar as on Chat; scrolled, she sits in the bar. */
@media (max-width: 767px) {
  .morb { --tuck: -61px; top: 71px; left: 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .morb, .morb > .mchat-rail:not([hidden]) { transition: none; }
  .mc-card { --from: none; transition: opacity .2s ease; }
  .mc-dot { animation: none; }
  .avatar::after { animation: none; }
  .avatar > .m-computer { transition: none; }
}

/* The turn a callout opened in the chat, marked for a moment (chat.html, goToTurn). */
.row.turn.turn-flash { border-radius: 16px; animation: turn-flash 2.2s ease-out; }
@keyframes turn-flash { 0%, 35% { background: color-mix(in srgb, var(--primary) 7%, transparent); } 100% { background: transparent; } }

/* Library: every document Matilda touched, as small cards or a list, under one bar of tabs, search and sort. */
/* Used by the document, Drive and email pages' headers. */
.library-icon { flex: none; display: grid; place-items: center; color: var(--muted-foreground); }
.library-icon svg { width: 18px; height: 18px; }
.library-icon .ficon { width: 18px; height: 18px; }
.library-sub { font-size: 11.5px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* The Library: one row of icons, then a grid under day dividers; new slide in, changed glow. */
.lib { display: grid; gap: 20px; }
.lib-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 0; background: color-mix(in srgb, var(--background) 88%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.lib-gap { flex: 1; }
.lib-search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--muted); color: var(--muted-foreground); min-width: 0; width: 260px; }
.lib-search:focus-within { box-shadow: 0 0 0 2px color-mix(in srgb, var(--ring) 40%, transparent); }
.lib-search svg { width: 15px; height: 15px; flex: none; }
.lib-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; font-size: 13.5px;
  color: var(--foreground); }
/* A brand logo in an icon button keeps its size (a button squeezes an <img> to its padding). */
.seg-icons > button img { flex: none; width: 16px; height: 16px; min-width: 16px; max-width: none; }
.lib-show[hidden] { display: none; }
.lib-icon-btn, .lib-new { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0;
  border-radius: 50%; cursor: pointer; }
.lib-icon-btn { background: var(--muted); color: var(--muted-foreground); }
.lib-icon-btn:hover, .lib-icon-btn[aria-expanded=true] { color: var(--foreground); background: var(--accent); }
.lib-icon-btn svg, .lib-new svg { width: 16px; height: 16px; }
.lib-new { background: var(--primary); color: var(--primary-foreground);
  box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--primary) 60%, transparent); transition: transform .15s ease; }
.lib-new:hover { transform: scale(1.06); }
.lib-bar form { margin: 0; }
/* Storage: a small ring of how much of the workspace's allowance is used (storage.py). */
.lib-storage { position: relative; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 999px;
  color: var(--primary); text-decoration: none; }
.lib-storage[data-level=warn], .storage-head[data-level=warn] { color: var(--warn); }
.lib-storage[data-level=bad], .storage-head[data-level=bad] { color: var(--destructive); }
a.lib-storage:hover { background: var(--muted); }
.lib-storage svg, .storage-ring { width: 30px; height: 30px; transform: rotate(-90deg); }
.lib-storage-track, .lib-storage-fill { fill: none; stroke-width: 3.5; }
.lib-storage-track { stroke: color-mix(in srgb, var(--muted-foreground) 22%, transparent); }
.lib-storage-fill { stroke: currentColor; stroke-linecap: round; transition: stroke-dasharray .4s ease; }
.lib-storage-pct { position: absolute; font-size: 9px; font-weight: 600; color: var(--muted-foreground);
  font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.storage-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; color: var(--primary); }
.storage-head .storage-ring { width: 56px; height: 56px; }
.storage-used { font-size: 20px; color: var(--foreground); }
.storage-quota { display: flex; align-items: center; gap: 8px; margin: 0 0 0 auto; }
.storage-quota .input { width: 96px; }
.storage-bar-col { width: 22%; min-width: 80px; }
.storage-bar { display: block; height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--muted-foreground) 18%, transparent);
  overflow: hidden; position: relative; }
.storage-bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--share); min-width: 3px;
  border-radius: inherit; background: var(--primary); }
.storage-bar[style*="--share: 0.0%"]::after, .storage-bar[style*="--share: 0%"]::after { display: none; }
.lib-sort { position: relative; }
.lib-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; min-width: 180px; padding: 6px;
  border-radius: 12px; background: var(--popover); box-shadow: 0 10px 30px -10px color-mix(in srgb, var(--foreground) 35%, transparent),
  0 0 0 1px color-mix(in srgb, var(--foreground) 6%, transparent); }
.lib-menu[hidden] { display: none; }
.lib-menu button { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 8px 10px;
  border: 0; border-radius: 8px; background: none; font: inherit; font-size: 13px; color: var(--foreground); cursor: pointer; }
.lib-menu button:hover, .lib-menu button:focus-visible { background: var(--accent); outline: none; }
.lib-menu button[aria-checked=true]::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }

.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 22px 18px; align-items: start; }
/* A day of documents: its name, how many, and a chevron; a click folds it or opens it. */
.lib-group { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin: 8px 0 -6px; padding: 4px 0;
  border: 0; background: none; cursor: pointer; text-align: left; font: inherit; font-size: 11.5px;
  font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-foreground); }
.lib-group:hover { color: var(--foreground); }
.lib-group:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 6px; }
.lib-group > small { font-size: 11px; font-weight: 500; letter-spacing: 0; opacity: .7; }
.lib-group > svg { order: 3; width: 14px; height: 14px; transition: transform .2s ease; }
.lib-group[aria-expanded=false] > svg { transform: rotate(-90deg); }
.lib-group[aria-expanded=false] { margin-bottom: -14px; }
/* More of an open day than it shows at first. */
.lib-more { grid-column: 1 / -1; justify-self: center; margin-top: -6px; padding: 4px 12px; border: 0; border-radius: 999px;
  background: none; cursor: pointer; font-size: 12px; color: var(--muted-foreground); }
.lib-more:hover { color: var(--foreground); background: color-mix(in srgb, var(--foreground) 5%, transparent); }
.lib-group:first-child { margin-top: 0; }
.lib-group::after { content: ""; order: 4; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--border), transparent); }
.lib-card { position: relative; display: grid; gap: 9px; min-width: 0; color: inherit; text-decoration: none; }
.lib-card[hidden] { display: none; }
.lib-pic { position: relative; aspect-ratio: 4 / 5; overflow: hidden; border-radius: 14px; background: #fff;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--foreground) 8%, transparent),
              0 0 0 1px color-mix(in srgb, var(--foreground) 6%, transparent);
  transition: transform .22s cubic-bezier(.2, .8, .2, 1), box-shadow .22s ease; }
.lib-card:hover .lib-pic { transform: translateY(-3px);
  box-shadow: 0 12px 28px -14px color-mix(in srgb, var(--foreground) 40%, transparent),
              0 0 0 1px color-mix(in srgb, var(--primary) 25%, transparent); }
.lib-card:focus-visible { outline: none; }
.lib-card:focus-visible .lib-pic { box-shadow: 0 0 0 2px var(--ring); }
.lib-pic img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.lib-pic img[hidden], .lib-blank[hidden] { display: none; }
/* A landscape page shows whole on a quiet backdrop instead of cropped; data-wide is set on load. */
.lib-pic:is([data-mode=pdf], [data-mode=office]):has(> img[data-wide]) { background: color-mix(in srgb, var(--muted) 60%, #fff); }
.lib-pic:is([data-mode=pdf], [data-mode=office]) > img[data-wide] { object-fit: contain; object-position: center;
  padding: 10px; filter: drop-shadow(0 1px 2px #00000026); }
.lib-text { height: 100%; padding: 12px 13px; font-size: 7.5px; line-height: 1.5; color: #2B1540; overflow: hidden; }
.lib-text > * { display: block; min-height: .6em; }
.lib-text strong { font-size: 10px; margin: 1px 0 4px; }
.lib-empty { color: #A39EAE; font-style: italic; }
/* An email reads as one: a square of paper, who it goes to over a hairline, then its words. */
.lib-pic[data-mode=email] { aspect-ratio: 1 / 1; background: #FBFAFD; }
.lib-pic[data-mode=email] .lib-text { padding: 13px 14px; font-size: 8px; }
.lib-pic[data-mode=email] .lib-text > strong:first-child { margin: 0 0 7px; padding-bottom: 6px; font-size: 8px; font-weight: 600;
  color: #6E5E7E; border-bottom: 1px solid #ECE6F2; }
.lib-grid[data-view=list] .lib-pic[data-mode=email] { aspect-ratio: 1 / 1; }
.lib-blank { height: 100%; display: grid; place-items: center; background: color-mix(in srgb, var(--muted) 60%, #fff); }
.lib-blank .ficon-lg { width: 34px; height: 34px; }
.lib-src { position: absolute; left: 8px; bottom: 8px; display: grid; place-items: center; width: 26px; height: 26px;
  border-radius: 7px; background: #ffffffe6; color: #5F4A73; box-shadow: 0 1px 3px #0002; }
.lib-src img { flex: none; width: 16px; height: 16px; max-width: none; }
.lib-src svg { width: 13px; height: 13px; }
/* Talk to Matilda about this document: a round button on the page's top corner, shown on hover. */
.lib-ask { position: absolute; top: 8px; right: 8px; z-index: 2; display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 50%; cursor: pointer; color: var(--primary); background: color-mix(in srgb, var(--card) 94%, transparent);
  box-shadow: 0 1px 3px #0000002a, 0 0 0 1px color-mix(in srgb, var(--foreground) 6%, transparent);
  opacity: 0; transform: scale(.85); transition: opacity .15s ease, transform .15s ease, background .15s ease; }
.lib-ask svg { width: 15px; height: 15px; }
.lib-card:hover .lib-ask, .lib-ask:focus-visible { opacity: 1; transform: none; }
.lib-ask:hover { background: var(--primary); color: var(--primary-foreground); }
.lib-ask:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
@media (hover: none) { .lib-ask { opacity: 1; transform: none; } }
.lib-grid[data-view=list] .lib-card { padding-right: 46px; }
.lib-grid[data-view=list] .lib-ask { top: 50%; right: 8px; translate: 0 -50%; box-shadow: none; background: none; }
/* Changed in the last few minutes: a small pulsing dot in the corner. */
.lib-dot { position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary);
  box-shadow: 0 0 0 3px #fff; opacity: 0; transition: opacity .3s ease; }
.lib-card[data-fresh] .lib-dot { opacity: 1; animation: lib-pulse 2s ease-in-out infinite; }
@keyframes lib-pulse { 50% { box-shadow: 0 0 0 3px #fff, 0 0 0 7px color-mix(in srgb, var(--primary) 22%, transparent); } }
.lib-meta { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 7px; align-items: center; min-width: 0;
  padding: 0 2px; }
.lib-icon { display: grid; place-items: center; color: var(--muted-foreground); grid-row: span 2; }
.lib-icon svg, .lib-icon .ficon { width: 16px; height: 16px; }
.lib-name { font-size: 13px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-sub { font-size: 11.5px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Live: new ones slide in, changed ones glow, gone ones fade. */
.lib-card[data-arrive=new] { animation: lib-in .5s cubic-bezier(.2, .8, .2, 1) both; }
.lib-card[data-arrive=changed] .lib-pic { animation: lib-glow 1.6s ease both; }
.lib-card[data-leaving] { opacity: 0; transform: scale(.96); transition: opacity .25s ease, transform .25s ease; pointer-events: none; }
@keyframes lib-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes lib-glow { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 0%, transparent); }
  25% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 35%, transparent); } }
/* Key templates (library.html): the firm's OM and LOI and its kit, a row of small cards at the top. */
.kt { display: grid; gap: 10px; }
.kt-title { margin: 0; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted-foreground); }
.kt-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.kt-card { display: grid; gap: 10px; align-content: space-between; padding: 12px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--border); min-width: 0; }
.kt-open { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; align-items: center;
  color: inherit; text-decoration: none; text-align: left; font: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.kt-open:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 8px; }
.kt-icon { grid-row: span 2; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  background: var(--muted); color: var(--muted-foreground); overflow: hidden; }
.kt-icon svg { width: 18px; height: 18px; }
.kt-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kt-state { font-size: 12px; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kt-card[data-state=yours] .kt-state { color: var(--primary); font-weight: 500; }
.kt-card[data-state=reading] .kt-state { animation: lib-pulse-text 1.6s ease-in-out infinite; }
@keyframes lib-pulse-text { 50% { opacity: .45; } }
.kt-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.kt-actions .btn { padding-inline: 9px; font-size: 13px; }
.kt-actions form { display: contents; }
.kt-actions label.btn { cursor: pointer; }
.kt-swatch { background: var(--kt-accent, var(--muted)); }
.kt-swatch img { width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 4px; }
.kt-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; margin: 0; font-size: 12px; }
.kt-facts dt { color: var(--muted-foreground); }
.kt-facts dd { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kt-dialog > div { max-width: 560px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column; }
.kt-dialog > div > section { overflow-y: auto; min-height: 0; flex: 1; }
.kt-dialog > div > header, .kt-dialog > div > footer { flex: none; }
.kt-set { border: 0; padding: 0; margin: 0; min-width: 0; }
.kt-set legend { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.kt-brand { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kt-brand .kt-swatch { display: grid; width: 32px; height: 32px; border-radius: 8px; overflow: hidden; }
.kt-broker { display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 8px; align-items: center; }
.kt-broker label { display: flex; gap: 8px; align-items: center; min-width: 0; }
/* One key template's page: its structure beside its preview. */
.kt-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.kt-outline { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: kt; }
.kt-outline li { counter-increment: kt; display: grid; gap: 2px; }
.kt-outline strong::before { content: counter(kt) ". "; color: var(--muted-foreground); font-weight: 500; }
.kt-outline span { font-size: 12.5px; color: var(--muted-foreground); }
.kt-frame { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #8a8a8a; }
.kt-frame iframe { display: block; width: 1328px; height: 720px; border: 0; transform-origin: 0 0; }
.lib-none { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 56px 0; text-align: center;
  color: var(--muted-foreground); font-size: 13.5px; }
.lib-none[hidden] { display: none; }
.lib-none svg { width: 26px; height: 26px; opacity: .5; }

/* Surfaces (surfaces.py, surfaces.js): what Matilda made, under her answer; old cards fold. */
.surfaces { display: grid; gap: 10px; margin: 4px 0 6px 44px; max-width: 640px; }
.sf { border-radius: 16px; background: var(--card); overflow: hidden;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--foreground) 8%, transparent),
              0 0 0 1px color-mix(in srgb, var(--foreground) 7%, transparent); }
.sf[data-error]::after { content: attr(data-error); display: block; padding: 0 16px 12px; font-size: 12px; color: var(--destructive); }
.sf-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; }
.sf-icon { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
  color: var(--primary); background: color-mix(in srgb, var(--primary) 9%, transparent); }
.sf-icon svg, .sf-icon img { width: 16px; height: 16px; }
.sf-title { display: grid; min-width: 0; flex: 1; line-height: 1.3; }
.sf-title b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-title small { font-size: 12px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-open { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--muted-foreground); }
.sf-open:hover { background: var(--accent); color: var(--foreground); }
.sf-open svg { width: 15px; height: 15px; }
.sf-body { padding: 0 16px 14px; border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.sf-slot[data-folded] .sf-body, .sf-slot[data-folded] .sf[data-error]::after { display: none; }
.sf-slot[data-folded] .sf { box-shadow: 0 0 0 1px color-mix(in srgb, var(--foreground) 6%, transparent); }
.sf-note { margin: 10px 0 0; font-size: 13px; color: var(--muted-foreground); }
.sf-acts { display: flex; align-items: center; gap: 2px; }
.sf-acts button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px;
  background: none; color: var(--muted-foreground); cursor: pointer; }
.sf-acts button:hover { background: var(--accent); color: var(--foreground); }
.sf-acts svg { width: 15px; height: 15px; }
/* An email draft: the page's compose form, a little tighter. */
.sf .mail-compose { width: auto; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.sf-body:has(.mail-compose) { border-top: 0; }
.sf .mail-text { min-height: 120px; padding-top: 14px; }
.mail-undo { background: var(--muted); color: var(--foreground); }
/* A document: its first page, and undo. */
.sf-doc { display: flex; align-items: flex-end; gap: 14px; padding-top: 12px; }
.sf-page { display: block; width: 120px; aspect-ratio: 8.5 / 11; border-radius: 8px; overflow: hidden; background: var(--background);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--foreground) 8%, transparent); transition: transform .18s ease; }
.sf-page:hover { transform: translateY(-2px); }
.sf-page img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.sf-page img[data-wide] { object-fit: contain; object-position: center; }
.sf-lines { display: grid; gap: 3px; padding: 10px; font-size: 7px; line-height: 1.35; color: var(--muted-foreground); }
.sf-lines span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Her computer: the live screen, tap to watch. */
.sf-computer { padding-top: 12px; }
.sf-computer .mcomp-screen { margin: 0; }
.sf-steps { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 12.5px; color: var(--muted-foreground); }
.sf-steps li::before { content: "·"; margin-right: 6px; }
/* Deadlines and jobs: one row each, acted on in place. */
.sf-dues { margin: 0; padding: 6px 12px 10px; list-style: none; display: grid; }
.sf-dues li { display: flex; align-items: center; gap: 12px; padding: 6px 4px; }
.sf-dues li + li { border-top: 1px solid color-mix(in srgb, var(--border) 50%, transparent); }
.sf-dues li[data-status=done] .sf-title b, .sf-dues li[data-status=dismissed] .sf-title b { text-decoration: line-through; color: var(--muted-foreground); }
.sf-due-date { flex: none; width: 76px; white-space: nowrap; font-size: 12px; font-weight: 600; color: var(--due); }
.sf-date { width: 28px; height: 28px; padding: 0; border: 0; background: none; color: transparent; cursor: pointer; }
.sf-date::-webkit-calendar-picker-indicator { margin: 0; padding: 6px; cursor: pointer; opacity: .6; }
.sf-job { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sf-job .sf-note { margin: 10px 0 0; }
/* A change waiting for their OK: what it is, then Decline and Approve (Keep it and Delete for a deletion). */
.sf-asks { margin: 0; padding: 6px 12px 10px; list-style: none; display: grid; }
.sf-asks li { display: flex; align-items: center; gap: 12px; padding: 8px 4px; }
.sf-asks li + li { border-top: 1px solid color-mix(in srgb, var(--border) 50%, transparent); }
.sf-asks .sf-title b { white-space: normal; }
.sf-asks li:has(.sf-soul) { flex-wrap: wrap; }
.sf-soul { flex-basis: 100%; min-width: 0; }
.sf-soul summary { cursor: pointer; font-size: 12.5px; color: var(--muted-foreground); }
.sf-soul-text { margin-top: 6px; max-height: 320px; overflow: auto; padding: 10px 12px; border-radius: 10px;
  background: color-mix(in srgb, var(--muted) 55%, transparent); font-size: 13px; white-space: pre-wrap; }
.sf-soul-text:has(> *) { white-space: normal; }
.sf-verdict { display: flex; gap: 6px; flex: none; }
.sf-decided { flex: none; font-size: 12px; color: var(--muted-foreground); }
.sf-asks li[data-status=done] .sf-decided { color: var(--ok); }
.sf-asks li[data-status=failed] .sf-decided { color: var(--destructive); }
@media (max-width: 640px) { .surfaces { margin-left: 0; } .sf-asks li { flex-wrap: wrap; } }

/* Blocks (blocks.py, static/blocks.js): set like a document, with hairline rules and tabular figures. */
.thread-answer.blocks { display: grid; gap: 14px; white-space: normal; }
.thread-answer.blocks > .rich > :last-child { margin-bottom: 0; }
.blk { max-width: 640px; min-width: 0; padding-top: 10px; border-top: 1px solid color-mix(in srgb, var(--border) 80%, transparent); }
.blk-title { margin: 0 0 8px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-foreground); }
.blk-note { margin: 8px 0 0; font-size: 12px; line-height: 1.45; color: var(--muted-foreground); }
.blk-note::before { content: "¹ "; }
.blk[data-error]::after { content: attr(data-error); display: block; margin-top: 6px; font-size: 12px; color: var(--destructive); }
.blk-scroll { overflow-x: auto; }
.blk table { width: 100%; border-collapse: collapse; font-size: 13.5px; line-height: 1.4; }
.blk th { padding: 0 12px 6px 0; text-align: left; font-size: 12px; font-weight: 600; color: var(--muted-foreground); white-space: nowrap;
  border-bottom: 1px solid var(--foreground); }
.blk td { padding: 7px 12px 7px 0; vertical-align: top; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.blk th.num, .blk td.num { text-align: right; }
.blk tr > :last-child { padding-right: 0; }
.blk-more { margin-top: 6px; padding: 0; border: 0; background: none; font: inherit; font-size: 12.5px; color: var(--primary); cursor: pointer; }
.blk-compare tbody th { font-weight: 500; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); padding-top: 7px; }
.blk-compare [data-pick] { background: color-mix(in srgb, var(--primary) 5%, transparent); }
.blk-compare thead th[data-pick] { color: var(--foreground); }
.blk-compare th small { display: block; font-weight: 500; letter-spacing: 0; color: var(--primary); }
.blk-list { margin: 0; padding: 0; list-style: none; display: grid; }
.blk-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 7px 0; font-size: 14px; line-height: 1.4; }
.blk-list li + li { border-top: 1px solid color-mix(in srgb, var(--border) 50%, transparent); }
.blk-list-title { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.blk-list .badge { font-size: 11px; font-weight: 500; }
.blk-list-detail { flex-basis: 100%; font-size: 13px; color: var(--muted-foreground); }
.blk-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); margin: 0; }
.blk-stats > div { padding: 2px 16px 2px 0; }
.blk-stats > div + div { padding-left: 16px; border-left: 1px solid color-mix(in srgb, var(--border) 80%, transparent); }
.blk-stats dt { font-size: 12px; color: var(--muted-foreground); }
.blk-stats dd { margin: 2px 0 0; font-size: 24px; font-weight: 600; letter-spacing: -.01em; line-height: 1.15; }
.blk-stats .blk-delta { font-size: 12px; font-weight: 500; color: var(--ok); }
.blk-stats .blk-delta[data-sign=down] { color: var(--destructive); }
.blk [data-s="0"] { --s: var(--chart-1); } .blk [data-s="1"] { --s: var(--chart-2); } .blk [data-s="2"] { --s: var(--chart-3); }
.blk [data-s="3"] { --s: var(--chart-4); } .blk [data-s="4"] { --s: var(--chart-5); }
.blk-plot { display: block; width: 100%; height: auto; overflow: visible; }
.blk-plot text { font-size: 11px; fill: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.blk-grid line { stroke: color-mix(in srgb, var(--border) 80%, transparent); stroke-width: 1; }
.blk-plot rect { fill: var(--s); }
.blk-plot polyline { fill: none; stroke: var(--s); stroke-width: 2; stroke-linejoin: round; }
.blk-plot circle { fill: var(--card); stroke: var(--s); stroke-width: 2; }
.blk-unit { margin: 2px 0 0; font-size: 11px; color: var(--muted-foreground); }
.blk-donut { display: flex; align-items: center; gap: 20px; }
.blk-donut svg { width: 128px; flex: none; transform: rotate(-90deg); }
.blk-donut circle { fill: none; stroke: var(--s); stroke-width: 6; }
.blk-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0 0; padding: 0; list-style: none; font-size: 12.5px; }
.blk-donut .blk-legend { display: grid; margin: 0; }
.blk-legend i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 2px; background: var(--s); }
.blk-legend .num { color: var(--muted-foreground); }
.blk-time { margin: 0; padding: 0; list-style: none; display: grid; }
.blk-time li { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 6px 0; font-size: 13.5px; }
.blk-time li + li { border-top: 1px solid color-mix(in srgb, var(--border) 50%, transparent); }
.blk-time li > :first-child { font-size: 12.5px; color: var(--muted-foreground); }
.blk-time li[data-state=done] > :last-child { color: var(--muted-foreground); text-decoration: line-through; }
.blk-time li[data-state=next] > :first-child { color: var(--primary); font-weight: 600; }
.blk-time li[data-state=late] > :first-child { color: var(--destructive); font-weight: 600; }
.blk-sub { margin: 0 0 8px; font-size: 13px; color: var(--muted-foreground); }
.blk-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 20px; margin: 0; }
.blk-fields > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 13.5px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent); }
.blk-fields dt { color: var(--muted-foreground); }
.blk-fields dd { margin: 0; text-align: right; }
.blk-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.blk-gallery a { display: grid; gap: 4px; color: inherit; text-decoration: none; font-size: 12px; }
.blk-gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: var(--muted); }
.blk-gallery span { color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blk-check { margin: 0; padding: 0; list-style: none; display: grid; }
.blk-check li + li { border-top: 1px solid color-mix(in srgb, var(--border) 50%, transparent); }
.blk-check label { display: flex; align-items: flex-start; gap: 10px; padding: 7px 0; font-size: 14px; cursor: pointer; }
.blk-check input { margin-top: 3px; accent-color: var(--primary); }
.blk-check input:checked + span { color: var(--muted-foreground); text-decoration: line-through; }
.blk-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.blk-choices button:disabled { opacity: 1; }
.blk-choices button[data-variant=outline]:disabled { opacity: .45; }
.blk-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 14px; align-items: end; }
.blk-form label { display: grid; gap: 4px; font-size: 12px; color: var(--muted-foreground); }
.blk-form button { justify-self: start; }

/* Recent work as circular cards under her portrait; hovering her (wheel-open) fans them out to the right. */
.mchat-rail { display: none; }
.mchat-rail:not([hidden]) { display: flex; align-items: center; position: absolute; z-index: 2;
  top: 86px; left: 50%; translate: -50% 0; padding: 6px;
  transition: top .28s cubic-bezier(.2, .9, .3, 1.15), translate .28s cubic-bezier(.2, .9, .3, 1.15),
    padding .28s ease; }
.mchat[data-panel] .mchat-rail { display: none; }
.rail-list { margin: 0; padding: 0; list-style: none; display: flex; align-items: center; justify-content: center; }
.rail-card { position: relative; flex: none; width: var(--orb-size); height: var(--orb-size); margin-left: -14px;
  border-radius: 50%; background: var(--background); cursor: grab;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--foreground) 16%, transparent);
  transition: transform .28s cubic-bezier(.2, .9, .3, 1.15), margin .28s cubic-bezier(.2, .9, .3, 1.15),
    box-shadow .18s ease;
  transition-delay: calc(var(--i, 0) * 30ms); }
.rail-card:first-child { margin-left: 0; }
.rail-open { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%;
  color: inherit; text-decoration: none; overflow: hidden; }
.rail-pic { position: relative; display: grid; place-items: center; width: 100%; height: 100%;
  border-radius: 50%; overflow: hidden; background: var(--muted); }
.rail-pic img { width: 18px; height: 18px; }
.rail-pic .rail-thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  object-position: top; background: var(--background); }
/* Hovering her: cards rise beside her and spread to the right while quick actions line up on the left. */
.mchat-main:is(.wheel-open, :has(.mchat-wheel:focus-within), :has(.mchat-rail:focus-within)) .mchat-rail:not([hidden]) {
  /* Same edge gap past her portrait as the left actions use (half avatar + --orb-gap). */
  top: 14px; height: var(--orb-avatar); translate: 0 0;
  padding-left: calc(var(--orb-avatar) / 2 + var(--orb-gap)); }
.mchat-main:is(.wheel-open, :has(.mchat-wheel:focus-within), :has(.mchat-rail:focus-within)) .rail-card {
  margin-left: var(--orb-gap);
  box-shadow: 0 3px 12px color-mix(in srgb, var(--foreground) 18%, transparent); }
.mchat-main:is(.wheel-open, :has(.mchat-wheel:focus-within), :has(.mchat-rail:focus-within)) .rail-card:first-child { margin-left: 0; }
.rail-card:hover { box-shadow: 0 4px 14px color-mix(in srgb, var(--foreground) 20%, transparent); }
@media (hover: none) {
  .mchat-rail:not([hidden]) { top: 14px; height: var(--orb-avatar); translate: 0 0;
    padding-left: calc(var(--orb-avatar) / 2 + var(--orb-gap)); }
  .mchat-rail:not([hidden]) .rail-card { margin-left: var(--orb-gap); }
  .mchat-rail:not([hidden]) .rail-card:first-child { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .rail-card, .mchat-rail:not([hidden]) { transition: none; }
}

/* Deadlines (deadlines.py): four tones by closeness, and a quiet one waiting on an event's date. */
.lib-due-pop, .lib-cal, .lib-chip, .sf-dues { --late: var(--destructive); --soon: #C2410C; --near: var(--primary);
  --later: var(--muted-foreground); --none: var(--muted-foreground); }
.lib-cal[hidden], .lib-due-pop[hidden] { display: none; }
[data-tone=late] { --due: var(--late); } [data-tone=soon] { --due: var(--soon); } [data-tone=near] { --due: var(--near); }
[data-tone=later] { --due: var(--later); } [data-tone=none] { --due: var(--none); }
/* On a card: its most pressing deadline as a quiet mark (dot, words, how many more). */
.lib { position: relative; }
.lib-chip { position: absolute; left: 8px; bottom: 8px; z-index: 1; display: inline-flex; align-items: center; gap: 6px;
  max-width: calc(100% - 16px); height: 22px; padding: 0 9px 0 8px; border-radius: 999px; cursor: pointer;
  font-size: 11px; font-weight: 500; color: var(--foreground); background: color-mix(in srgb, var(--card) 92%, transparent);
  box-shadow: 0 1px 2px #0000001f, 0 0 0 1px color-mix(in srgb, var(--foreground) 6%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: box-shadow .15s ease; }
.lib-chip:hover, .lib-chip:focus-visible { outline: none; box-shadow: 0 2px 8px #0000002a, 0 0 0 1px color-mix(in srgb, var(--due) 40%, transparent); }
.lib-src ~ .lib-chip { left: 40px; max-width: calc(100% - 48px); }   /* beside the Drive or Gmail badge */
.lib-chip > i { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--due); }
.lib-chip > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-chip[data-tone=late] > span, .lib-chip[data-tone=soon] > span { color: var(--due); }
.lib-chip > b { flex: none; font-weight: 600; color: var(--muted-foreground); }
.lib-grid[data-view=list] .lib-chip { position: static; grid-column: 1 / -1; justify-self: start; margin-top: 4px; box-shadow: none;
  background: color-mix(in srgb, var(--foreground) 4%, transparent); -webkit-backdrop-filter: none; backdrop-filter: none; }
/* A card's deadlines, under its mark: date, what and when, the words it came from, and its actions. */
.lib-due-pop { position: absolute; z-index: 20; width: min(340px, 100%); padding: 6px; border-radius: 14px;
  background: var(--popover); color: var(--popover-foreground); animation: menu-in .14s ease-out;
  box-shadow: 0 1px 2px #0000000d, 0 10px 30px -6px #2B154033, 0 0 0 1px color-mix(in srgb, var(--foreground) 8%, transparent); }
.lib-due-list { list-style: none; margin: 0; padding: 0; display: grid; }
.lib-due-list > li { display: flex; align-items: flex-start; gap: 12px; padding: 9px 8px; border-radius: 10px; }
.lib-due-list > li + li { border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.lib-due-date { flex: none; display: grid; justify-items: center; width: 36px; padding: 3px 0; border-radius: 9px; line-height: 1.1;
  color: var(--due); background: color-mix(in srgb, var(--due) 10%, transparent); }
.lib-due-date b { font-size: 15px; font-weight: 650; }
.lib-due-date small { font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.lib-due-text { flex: 1; display: grid; gap: 1px; min-width: 0; line-height: 1.35; }
.lib-due-text b { font-size: 13px; font-weight: 600; }
.lib-due-text small { font-size: 12px; color: var(--muted-foreground); }
.lib-due-list > li[data-tone=late] .lib-due-text small { color: var(--late); }
.lib-due-text q { margin-top: 3px; font-size: 11.5px; color: var(--muted-foreground); font-style: italic; quotes: "\201C" "\201D";
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lib-due-acts { flex: none; display: flex; gap: 2px; }
.lib-due-acts > button, .lib-due-acts > label { position: relative; display: grid; place-items: center; width: 26px; height: 26px; padding: 0;
  border: 0; border-radius: 7px; background: none; color: var(--muted-foreground); cursor: pointer; }
.lib-due-acts > :hover { background: var(--accent); color: var(--foreground); }
.lib-due-acts svg { width: 14px; height: 14px; }
/* Move: the calendar glyph is the date field's face; the field itself sits invisible over it. */
.lib-due-acts input[type=date] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.lib-due-acts input[type=date]::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
/* From the calendar a deadline also names its documents; a crowded day's popover shows its date. */
.lib-due-head { margin: 4px 8px 2px; font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted-foreground); }
.lib-due-doc { display: flex; align-items: center; gap: 6px; min-width: 0; margin-top: 5px; font-size: 11.5px; color: var(--muted-foreground); }
.lib-due-doc > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-due-doc > i { display: grid; flex: none; }
.lib-due-doc svg { width: 12px; height: 12px; }
.lib-due-doc > button { flex: none; display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border: 0; border-radius: 6px;
  background: none; font: inherit; font-weight: 600; color: var(--primary); cursor: pointer; }
.lib-due-doc > button:hover { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.lib-due-doc > button svg { width: 11px; height: 11px; }

/* The month: dated deadlines by day with "+N more"; today ringed, weekends and past days recede. */
.lib-cal { display: grid; gap: 12px; }
.lib-cal-head { display: flex; align-items: center; gap: 8px; }
.lib-cal-head h2 { margin: 0; flex: 1; font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
.lib-cal-nav { display: flex; gap: 4px; }
.lib-cal-nav .lib-icon-btn { width: 32px; height: 32px; }
.lib-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.lib-cal-wd { padding: 0 8px 4px; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted-foreground); }
.lib-cal-day { display: flex; flex-direction: column; gap: 3px; min-height: 104px; min-width: 0; padding: 6px; border-radius: 10px;
  background: color-mix(in srgb, var(--foreground) 2.5%, transparent); }
.lib-cal-day.wkend { background: color-mix(in srgb, var(--foreground) 1.2%, transparent); }
.lib-cal-day.out { background: none; }
.lib-cal-day.out > * { opacity: .45; }
.lib-cal-day.today { background: color-mix(in srgb, var(--primary) 5%, transparent); box-shadow: inset 0 0 0 1.5px var(--primary); }
.lib-cal-n { align-self: flex-start; display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px;
  font-size: 12px; font-weight: 600; color: var(--foreground); }
.lib-cal-day.past:not(.today) .lib-cal-n, .lib-cal-day.out .lib-cal-n { color: var(--muted-foreground); }
.lib-cal-day.today .lib-cal-n { background: var(--primary); color: var(--primary-foreground); }
.lib-cal-item { display: flex; align-items: center; gap: 4px; width: 100%; min-width: 0; padding: 3px 7px; border: 0; border-radius: 6px;
  font: inherit; font-size: 11.5px; font-weight: 550; line-height: 1.35; text-align: left; cursor: pointer; color: var(--due);
  background: color-mix(in srgb, var(--due) 12%, transparent); box-shadow: inset 2px 0 0 var(--due); }
.lib-cal-item > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-cal-item > time { flex: none; font-weight: 650; font-variant-numeric: tabular-nums; }
.lib-cal-item > i { display: grid; flex: none; }
.lib-cal-item svg { width: 11px; height: 11px; }
.lib-cal-item:hover, .lib-cal-item:focus-visible { outline: none; background: color-mix(in srgb, var(--due) 22%, transparent); }
.lib-cal-item:focus-visible, .lib-cal-more:focus-visible { box-shadow: inset 2px 0 0 var(--due), 0 0 0 2px var(--ring, var(--primary)); }
.lib-cal-day.past:not(.today) .lib-cal-item[data-tone=later] { opacity: .7; }
.lib-cal-more { align-self: flex-start; padding: 1px 7px; border: 0; border-radius: 6px; background: none; font: inherit; font-size: 11.5px;
  font-weight: 600; color: var(--muted-foreground); cursor: pointer; }
.lib-cal-more:hover { background: var(--accent); color: var(--foreground); }
.lib-cal-none { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; padding: 8px;
  font-size: 13px; color: var(--muted-foreground); }
.lib-cal-none[hidden] { display: none; }
@media (max-width: 640px) {
  .lib-cal-grid { gap: 3px; }
  .lib-cal-wd { padding: 0 2px 2px; font-size: 10px; text-align: center; }
  .lib-cal-day { min-height: 58px; padding: 4px 3px; align-items: center; }
  .lib-cal-n { align-self: center; }
  .lib-cal-item { width: 100%; height: 5px; padding: 0; font-size: 0; box-shadow: none; background: var(--due); }
  .lib-cal-item > *, .lib-cal-item > i { display: none; }
  .lib-cal-more { padding: 0 2px; font-size: 10px; }
  .lib-cal-more > span { display: none; }
}

/* As a list: one quiet row each, a tiny page beside the name, hairlines between. */
.lib-grid[data-view=list] { grid-template-columns: 1fr; gap: 0; }
.lib-grid[data-view=list] .lib-group { margin: 18px 0 6px; }
.lib-grid[data-view=list] .lib-group:first-child { margin-top: 0; }
.lib-grid[data-view=list] .lib-card { grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 12px;
  padding: 8px 6px; border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent); border-radius: 8px; }
.lib-grid[data-view=list] .lib-card:hover { background: color-mix(in srgb, var(--foreground) 3%, transparent); }
.lib-grid[data-view=list] .lib-pic { width: 34px; aspect-ratio: 4 / 5; border-radius: 6px; }
.lib-grid[data-view=list] .lib-card:hover .lib-pic { transform: none; }
.lib-grid[data-view=list] .lib-text { padding: 3px; font-size: 2.2px; }
.lib-grid[data-view=list] .lib-text strong { font-size: 3px; }
.lib-grid[data-view=list] .lib-empty, .lib-grid[data-view=list] .lib-src { display: none; }
.lib-grid[data-view=list] .lib-blank .ficon-lg { width: 16px; height: 16px; }
.lib-grid[data-view=list] .lib-pic > img[data-wide] { padding: 2px; }
.lib-grid[data-view=list] .lib-dot { top: -2px; right: -2px; width: 7px; height: 7px; }
.lib-grid[data-view=list] .lib-meta { grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; }
.lib-grid[data-view=list] .lib-icon { display: none; }
.lib-grid[data-view=list] .lib-name { font-size: 14px; }
.lib-grid[data-view=list] .lib-sub { font-size: 12.5px; grid-row: 1; grid-column: 2; }

@media (max-width: 640px) {
  .lib-grid:not([data-view=list]) { grid-template-columns: 1fr 1fr; gap: 18px 12px; }
  .lib-search { order: 9; flex-basis: 100%; width: auto; }
  .lib-gap { display: none; }
}

/* A Drive file in the app: Google's own view, full height. */
.libdrive-body { padding: 0; }
.libdrive-frame { flex: 1; width: 100%; border: 0; background: #fff; }
.libdrive-note { margin: 0; padding: 6px 16px; border-top: 1px solid var(--border); }
.libview-head .btn .ficon { width: 15px; height: 15px; }

/* The Library viewer (library_view.html): the document full height, a slim header, Ask Matilda below. */
.libview { display: flex; flex-direction: column; height: 100dvh; min-height: 0; }
/* A preview page is the page itself: no backdrop or rules stopping short at the sidebar. */
.libview-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--background); }
.libview-title { flex: 1; min-width: 0; }
.libview-name { display: block; width: 100%; margin: 0; padding: 2px 6px; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: inherit; font: inherit; font-size: 1rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.libview-head .library-sub { padding: 0 6px; }
input.libview-name:hover { border-color: var(--border); }
input.libview-name:focus { outline: none; border-color: var(--ring); background: var(--card); }
.libview-actions { display: flex; align-items: center; gap: 6px; flex: none; }
#libview-status.bad { color: var(--destructive); }
.libview-body { flex: 1; min-height: 0; display: flex; }
.libview-pages { position: relative; flex: 1; min-width: 0; min-height: 0; overflow: auto; display: flex;
  flex-direction: column; align-items: center; gap: 16px; padding: 24px 16px 40px; outline: none;
  overscroll-behavior: contain; }
/* Each page at its own shape (from /pages), never wider than the view; flex: none stops squeeze. */
.libview-page { display: block; flex: none; box-sizing: border-box; width: min(100%, var(--w, 816px)); max-width: 100%;
  height: auto; background: #fff; border-radius: 3px;
  box-shadow: 0 1px 2px #0000000f, 0 6px 28px color-mix(in srgb, var(--foreground) 12%, transparent); }
.libview-page:not([data-loaded]):not(.libview-gap) { background: linear-gradient(100deg, #fff 40%, #f4f2f6 50%, #fff 60%) 0 0 / 300% 100%;
  animation: libview-sheen 1.6s ease-in-out infinite; }
@keyframes libview-sheen { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .libview-page:not([data-loaded]):not(.libview-gap) { animation: none; } }
.libview-gap { display: grid; place-content: center; justify-items: center; gap: 10px; padding: 24px; color: #6b6470;
  font-size: 13px; text-align: center; }
.libview-gap p { margin: 0; }
.libview-wait { margin: auto; color: var(--muted-foreground); font-size: 14px; }
.libview-more { margin: 0; color: var(--muted-foreground); font-size: 13px; }
/* A picture fits the view; a click shows a larger one at full size (data-zoom), to scroll. */
.libview-image { flex: 1; min-width: 0; min-height: 0; display: flex; padding: 24px; overflow: auto; }
.libview-image img { display: block; margin: auto; max-width: 100%; max-height: 100%; object-fit: contain;
  box-shadow: 0 4px 24px #0002; cursor: zoom-in; }
.libview-image[data-zoom] img { max-width: none; max-height: none; cursor: zoom-out; }
.libview-text { flex: 1; width: min(860px, 100% - 32px); margin: 24px auto; padding: 48px 56px; resize: none; overflow: auto;
  border: 1px solid var(--border); border-radius: 12px; background: var(--card); color: var(--card-foreground);
  font: 15px/1.65 Inter, system-ui, sans-serif; white-space: pre-wrap; word-break: break-word;
  box-shadow: 0 2px 16px color-mix(in srgb, var(--foreground) 6%, transparent); }
.libview-text:focus { outline: none; border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.libview-none { flex: 1; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--muted-foreground); }
.libview-none > .ficon-lg { width: 48px; height: 48px; }
.libview-none p { margin: 0; }
.libview-dots { display: inline-flex; gap: 3px; margin-right: 6px; vertical-align: middle; }
.libview-dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: libview-dot 1s infinite ease-in-out; }
.libview-dots i:nth-child(2) { animation-delay: .15s; } .libview-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes libview-dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
/* The phone layout has a 57px top bar above the page, as for Chat (.mchat). */
@media (max-width: 767px) {
  .libview { height: calc(100dvh - 57px); }
}
@media (max-width: 640px) {
  .libview-pages { padding: 8px 8px 24px; gap: 8px; }
  .libview-image { padding: 8px; }
  .libview-text { width: calc(100% - 16px); margin: 8px auto; padding: 20px; font-size: 16px; }
  .libview-head .library-sub { display: none; }
}

/* An email draft (mail_draft.html): Gmail's compose window as a quiet sheet. */
.mail-body { overflow: auto; align-items: flex-start; }
.mail-compose { width: min(860px, 100% - 32px); margin: 24px auto; padding: 8px 40px 18px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--card); color: var(--card-foreground);
  box-shadow: 0 2px 16px color-mix(in srgb, var(--foreground) 6%, transparent); }
.mail-row { display: flex; align-items: center; gap: 12px; min-height: 44px; border-bottom: 1px solid var(--border); }
.mail-row[hidden] { display: none; }
.mail-row label { flex: none; width: 56px; font-size: 13px; color: var(--muted-foreground); }
.mail-row input { flex: 1; min-width: 0; padding: 10px 0; border: 0; background: none; color: inherit;
  font: 14.5px/1.4 Inter, system-ui, sans-serif; outline: none; }
.mail-row input[readonly] { cursor: default; }
.mail-reveal { flex: none; display: flex; gap: 4px; }
.mail-reveal button { padding: 2px 6px; border: 0; border-radius: 6px; background: none; color: var(--muted-foreground);
  font-size: 13px; cursor: pointer; }
.mail-reveal button:hover { color: var(--foreground); background: var(--muted); }
.mail-text { display: block; width: 100%; min-height: 240px; margin: 0; padding: 20px 0 12px; border: 0; resize: none;
  overflow: hidden; background: none; color: inherit; font: 15px/1.65 Inter, system-ui, sans-serif; outline: none; }
.mail-quoted { margin: 0 0 12px; }
.mail-quoted summary { display: inline-block; padding: 0 8px; border-radius: 8px; background: var(--muted);
  color: var(--muted-foreground); font-size: 13px; letter-spacing: .1em; cursor: pointer; list-style: none; }
.mail-quoted summary::-webkit-details-marker { display: none; }
.mail-quoted pre { margin: 10px 0 0; padding-left: 12px; border-left: 2px solid var(--border); color: var(--muted-foreground);
  font: 13.5px/1.55 Inter, system-ui, sans-serif; white-space: pre-wrap; word-break: break-word; }
.mail-attach { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 12px; }
.mail-attach:empty { display: none; }
.mail-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 6px 4px 10px;
  border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.mail-chip a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; text-decoration: none; }
.mail-chip a:hover { text-decoration: underline; }
.mail-chip small { flex: none; color: var(--muted-foreground); }
.mail-chip button { flex: none; width: 20px; height: 20px; border: 0; border-radius: 6px; background: none;
  color: var(--muted-foreground); font-size: 15px; line-height: 1; cursor: pointer; }
.mail-chip button:hover { background: var(--muted); color: var(--foreground); }
.mail-foot { display: flex; align-items: center; gap: 8px; padding-top: 14px; border-top: 1px solid var(--border); }
.mail-status { flex: 1; min-width: 0; }
.mail-status.bad { color: var(--destructive); }
.mail-done { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted-foreground); }
.mail-done svg { width: 14px; height: 14px; }
.mail-picker section { display: grid; gap: 10px; }
.mail-picker-list { display: grid; max-height: 320px; margin: 0; padding: 0; overflow: auto; list-style: none;
  border-top: 1px solid var(--border); }
.mail-picker-list li { border-bottom: 1px solid var(--border); }
.mail-picker-list li.muted { padding: 10px 2px; border: 0; }
.mail-picker-list button { display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 9px 2px; border: 0;
  background: none; color: inherit; text-align: left; font: inherit; cursor: pointer; }
.mail-picker-list button:hover { background: var(--muted); }
.mail-pick-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.mail-picker-list small { flex: none; color: var(--muted-foreground); }
@media (max-width: 640px) {
  .mail-compose { width: 100%; margin: 0; padding: 4px 16px 14px; border: 0; border-radius: 0; box-shadow: none; }
  .mail-row input, .mail-text { font-size: 16px; }
  .mail-hide-sm { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .mchat-thread .timesep.enter, .mchat-retry,
  .mchat-composer .send.sent svg, .mchat-panel.opening, .mchat-panel.closing,
  .mchat-panel.opening .mchat-hero > *, .mchat-panel.opening .mchat-tools, .mchat-panel.opening .mchat-home { animation: none; }
  .mchat-composer .send, .mchat-who { transition: none; }
  .mchat-composer .mic[aria-pressed=true] .mic-ring { animation: none; opacity: .25; transform: scale(1.3); }
  .mchat-composer .mic, .mchat-composer .send, .mattach-menu, .drive-list li, .library-menu { animation: none; }
}

/* /dashboard/chat/demo: the reasoning thread on a scripted turn (templates/dashboard/chat_demo.html). */
.thread-demo { max-width: 680px; padding: 8px 0 40px; }
.thread-demo-runs { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--card); }
.thread-demo-runs button { padding: 3px 12px; border: 0; border-radius: 999px; background: none; color: var(--muted-foreground);
  font: inherit; font-size: 13px; cursor: pointer; }
.thread-demo-runs button[aria-checked=true] { background: var(--foreground); color: var(--background); }

/* Firm profile (org_profile.py): min-width: 0 lets the people table scroll inside the card. */
#firm-profile, #firm-profile > section, .firm-draft > *, .firm-draft fieldset > * { min-width: 0; }
.tabs, .tabs > [role=tabpanel] { min-width: 0; }
/* A long row of tabs (Organization has eleven) scrolls on its own on a phone. */
.tabs > nav[role=tablist] { max-width: 100%; overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
.firm-draft fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.firm-draft legend { font-weight: 600; font-size: 14px; margin-bottom: 4px; padding: 0; }
.firm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.firm-grid > * { min-width: 0; }
.firm-notes { margin: 0; padding: 10px 14px 10px 28px; border-left: 2px solid var(--warn);
  background: color-mix(in srgb, var(--warn) 8%, transparent); border-radius: 0 6px 6px 0; }
.firm-people td { padding-top: 4px; padding-bottom: 4px; vertical-align: middle; }
.firm-people td .input:not([type=checkbox]) { min-width: 110px; height: 32px; }
.firm-people td:first-child { width: 28px; }
.firm-people tr.firm-add .input:not([type=checkbox]) { border-style: dashed; }
.firm-people tr:has(> td:first-child input:not(:checked)) td:not(:first-child) { opacity: .45; }
.firm-soul { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.5; }
.firm-logo { display: inline-grid; place-items: center; width: 56px; height: 56px; padding: 4px;
  border: 1px solid var(--border); border-radius: 10px; background: #FFFFFF; }
.firm-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.firm-mark-pair { display: inline-flex; gap: 6px; }
.firm-mark-tile { display: inline-grid; place-items: center; width: 56px; height: 56px; border: 1px solid var(--border); border-radius: 8px; }
.firm-mark-tile img { width: 44px; height: 44px; }
.firm-color { width: 44px; height: 32px; padding: 2px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--card); cursor: pointer; }
.firm-swatch { width: 22px; height: 22px; border-radius: 50%; border: 0; cursor: pointer;
  box-shadow: inset 0 0 0 1px #00000033; }
.firm-swatch:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.firm-pages { margin: 8px 0 0; padding-left: 18px; }

/* Their Gmail signature under a draft's text as it will go out; quieter, not editable. */
.mail-sig { padding: 4px 0 18px; font-size: 13px; line-height: 1.5; color: var(--muted-foreground); overflow-wrap: anywhere; }
.mail-sig::before { content: "--"; display: block; margin-bottom: 4px; }
.mail-sig a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.mail-sig img { max-width: 100%; height: auto; max-height: 120px; }
.mail-sig table { border-collapse: collapse; }
.mail-sig td { padding: 0 8px 0 0; vertical-align: top; }
.mail-sig-add { display: inline-block; margin: 0 0 16px; font-size: 12px; color: var(--muted-foreground); text-decoration: underline; text-underline-offset: 2px; }

/* Search (search.py, static/search.js) */
/* A Spotlight panel: one floating sheet over a blurred page, matches grouped under quiet labels. */
.spot { position: fixed; inset: 0; z-index: 80; display: flex; justify-content: center; align-items: flex-start;
  padding: min(16vh, 140px) 16px 16px; background: color-mix(in srgb, var(--foreground) 10%, transparent);
  -webkit-backdrop-filter: blur(6px) saturate(1.1); backdrop-filter: blur(6px) saturate(1.1); opacity: 0; transition: opacity .14s ease; }
.spot.on { opacity: 1; }
.spot[hidden] { display: none; }
.spot-panel { width: min(640px, 100%); max-height: min(560px, calc(100dvh - 32px)); display: flex; flex-direction: column;
  border-radius: 18px; overflow: hidden; background: color-mix(in srgb, var(--card) 92%, transparent);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  box-shadow: 0 24px 60px -20px color-mix(in srgb, var(--foreground) 40%, transparent),
              0 0 0 1px color-mix(in srgb, var(--foreground) 8%, transparent);
  transform: translateY(-6px) scale(.985); transition: transform .16s ease; }
.spot.on .spot-panel { transform: none; }
.spot-bar { display: flex; align-items: center; gap: 12px; padding: 14px 18px; }
.spot-glass { display: flex; color: var(--muted-foreground); }
.spot-glass svg { width: 20px; height: 20px; }
.spot-input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--foreground);
  font: inherit; font-size: 19px; letter-spacing: -.01em; }
.spot-input::placeholder { color: var(--muted-foreground); }
.spot-kbd { font: 11px/1 inherit; padding: 4px 6px; border-radius: 6px; color: var(--muted-foreground);
  background: var(--muted); }
.spot-list { overflow-y: auto; padding: 0 8px 8px; }
.spot-list:not(:empty) { border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent); padding-top: 6px; }
.spot-label { margin: 8px 10px 2px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted-foreground); }
.spot-row { display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: 10px; cursor: pointer; }
.spot-row[aria-selected="true"] { background: color-mix(in srgb, var(--primary) 12%, transparent); }
.spot-icon { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--muted); color: var(--muted-foreground); }
.spot-row[aria-selected="true"] .spot-icon { background: var(--primary); color: var(--primary-foreground); }
.spot-icon svg { width: 16px; height: 16px; }
.spot-main { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.spot-title { font-size: 14px; color: var(--foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spot-sub { font-size: 12px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spot-row mark { background: none; color: inherit; font-weight: 650; }
.spot-meta { flex: none; font-size: 11.5px; color: var(--muted-foreground); }
.spot-empty { margin: 0; padding: 18px 12px; font-size: 13px; color: var(--muted-foreground); text-align: center; }
@media (max-width: 767px) {
  .spot { padding-top: 12px; }
  .spot-panel { max-height: calc(100dvh - 24px); }
  .spot-input { font-size: 17px; }
  .spot-kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) { .spot, .spot-panel { transition: none; } }

/* Hover labels (data-tooltip) sit on top: the hovered element rises over its neighbours. */
[data-tooltip]:is(:hover, :focus-visible) { z-index: 100; }
[data-tooltip]::before { z-index: 100; }

/* A brand logo standing in for an icon (ui.BRAND_ICONS: Gmail for email): its container's icon size. */
img.brand-icon { flex: none; width: 16px; height: 16px; object-fit: contain; }
.thread-avatar > img.brand-icon { width: 11px; height: 11px; border-radius: 0; object-fit: contain; }
.thread-item[data-status=running] .thread-avatar > img.brand-icon { width: 14px; height: 14px; }
.library-icon img.brand-icon { width: 18px; height: 18px; }

/* ── Feed (feed.html, _feed_card.html): one centered column of posts, hairlines, no boxes ── */
.fd-wrap { display: grid; gap: 0; width: 100%; max-width: 880px; margin: 0 auto; min-width: 0; }
.fd-list { display: grid; min-width: 0; }
.fd-card { position: relative; display: flex; gap: 14px; min-width: 0; padding: 20px 4px;
  border-bottom: 1px solid var(--border); transition: opacity .25s ease, transform .25s ease; }
.fd-list > .fd-card:last-child { border-bottom: 0; }
.fd-card[data-arrive] { animation: fd-arrive .6s ease-out; }
.fd-card[data-leaving] { opacity: 0; transform: translateY(-4px); pointer-events: none; }
@keyframes fd-arrive { from { opacity: 0; transform: translateY(6px); } }
.fd-avatar { width: 40px; height: 40px; border-radius: 50%; color: var(--primary); }
.fd-avatar svg { width: 18px; height: 18px; color: var(--primary); }
.fd-avatar img { width: 20px; height: 20px; }
.fd-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.fd-head { display: flex; align-items: center; gap: 4px 6px; flex-wrap: wrap; font-size: 13px; color: var(--muted-foreground); }
.fd-src { font-weight: 600; color: var(--foreground); }
.fd-sent { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--primary); }
.fd-sent svg { width: 12px; height: 12px; }
.fd-new { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.fd-title { margin: 2px 0 0; font-size: 16px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.fd-body { margin: 0; font-size: 15px; line-height: 1.55; color: var(--foreground); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.fd-why { display: flex; align-items: flex-start; gap: 6px; margin: 6px 0 0; padding: 8px 12px; border-radius: 10px;
  background: var(--muted); font-size: 13.5px; line-height: 1.45; color: var(--secondary-foreground); }
.fd-why svg { flex: none; width: 14px; height: 14px; margin-top: 2px; color: var(--primary); }
/* A "Needs a date" card: the event's date, given right here. */
.fd-date { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 10px 0 2px; }
.fd-date .input { width: auto; min-width: 0; height: 32px; }
.fd-date .btn { gap: 6px; }
.fd-date .btn svg { width: 14px; height: 14px; }
.fd-date-err { flex-basis: 100%; margin: 0; font-size: 12.5px; color: var(--destructive); }
.fd-date-err[hidden] { display: none; }
.fd-actions { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; margin: 4px 0 0 -10px; }
.fd-actions form { display: contents; }
.fd-actions .btn { color: var(--muted-foreground); gap: 6px; }
.fd-actions .btn:hover { color: var(--foreground); }
.fd-actions .btn svg { width: 14px; height: 14px; }
.fd-empty { margin: 48px 0; text-align: center; color: var(--muted-foreground); }
.fd-earlier { justify-self: center; margin: 16px 0 8px; font-size: 13.5px; color: var(--muted-foreground); }
.fd-earlier:hover { color: var(--foreground); }
/* Each working day starts a new day; within it, a connector's items stack into one card that opens. */
.fd-day { margin: 28px 0 0; padding: 0 4px 10px; font-size: 13px; font-weight: 600; letter-spacing: .02em;
  text-transform: uppercase; color: var(--muted-foreground); border-bottom: 1px solid var(--border); }
.fd-list > .fd-day:first-child { margin-top: 8px; }
.fd-pile { min-width: 0; }
.fd-pile-top { display: grid; gap: 4px; list-style: none; cursor: pointer; border-radius: 12px; }
.fd-pile-top::-webkit-details-marker { display: none; }
.fd-pile-top:focus-visible { outline: 2px solid var(--ring, var(--primary)); outline-offset: 4px; }
.fd-count { font-size: 12.5px; font-weight: 600; color: var(--primary); }
.fd-stack[data-unread] .fd-count::before { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 5px 1px 0;
  border-radius: 50%; background: var(--primary); vertical-align: middle; }
.fd-stack-names { margin: 0; font-size: 14.5px; color: var(--muted-foreground); overflow-wrap: anywhere; }
/* The top item, with the rest of the pile peeking out beneath it. */
.fd-sheet { position: relative; margin: 8px 0 14px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--card); box-shadow: 0 1px 2px rgb(0 0 0 / .04); }
.fd-sheet::before, .fd-sheet::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -6px; z-index: -1; height: 12px;
  border: 1px solid var(--border); border-top: 0; border-radius: 0 0 12px 12px; background: var(--muted); }
.fd-sheet::after { left: 20px; right: 20px; bottom: -11px; z-index: -2; opacity: .7; }
.fd-pile-top { isolation: isolate; }
.fd-sheet-title { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.fd-sheet-body { margin: 2px 0 0; font-size: 14.5px; line-height: 1.5; color: var(--foreground); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fd-pile-top:hover .fd-sheet { border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.fd-pile-more { display: inline-flex; align-items: center; gap: 6px; justify-self: start; font-size: 13.5px; font-weight: 500; color: var(--primary); }
.fd-pile-more svg { width: 14px; height: 14px; transition: transform .2s ease; }
.fd-pile-hide, .fd-pile[open] .fd-pile-show, .fd-pile[open] .fd-sheet { display: none; }
.fd-pile[open] .fd-pile-hide { display: inline; }
.fd-pile[open] .fd-pile-more svg { transform: rotate(180deg); }
.fd-pile[open] .fd-pile-more { margin-top: 4px; }
.fd-rows { list-style: none; margin: 10px 0 0; padding: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  background: var(--card); }
.fd-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 14px;
  border-top: 1px solid var(--border); transition: opacity .25s ease; }
.fd-row:first-child { border-top: 0; }
.fd-row[data-leaving] { opacity: 0; pointer-events: none; }
.fd-row-main { min-width: 0; display: grid; gap: 2px; }
.fd-row-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0; font-size: 14.5px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.fd-row-title .fd-new { margin-left: 0; flex: none; }
.fd-row:not([data-unread]) .fd-row-title { font-weight: 500; }
.fd-row-body { margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted-foreground); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fd-row .fd-why { margin-top: 4px; }
.fd-row > .fd-when { font-size: 12.5px; color: var(--muted-foreground); white-space: nowrap; }
.fd-row-actions { grid-column: 1 / -1; display: flex; gap: 2px; margin: 2px 0 0 -8px; }
.fd-row-actions form { display: contents; }
.fd-row-actions .btn { color: var(--muted-foreground); }
.fd-row-actions .btn:hover { color: var(--foreground); }
.fd-row-actions .btn svg { width: 14px; height: 14px; }
@media (hover: hover) and (min-width: 641px) {
  .fd-row { grid-template-columns: minmax(0, 1fr) auto auto; align-items: start; }
  .fd-row-actions { grid-column: auto; margin: -4px -6px 0 0; opacity: 0; transition: opacity .15s ease; }
  .fd-row:hover .fd-row-actions, .fd-row:focus-within .fd-row-actions { opacity: 1; }
}
/* An unread Feed: a dot on its sidebar icon. */
.sidebar nav li > a { position: relative; }
.nav-dot { position: absolute; top: 7px; left: 24px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary); box-shadow: 0 0 0 2px var(--sidebar); pointer-events: none; }
@media (min-width: 768px) { .nav-dot { top: 6px; left: auto; right: 6px; } }
@media (max-width: 640px) {
  .fd-card { padding: 16px 0; gap: 10px; }
  .fd-avatar { width: 32px; height: 32px; }
}
@media (prefers-reduced-motion: reduce) { .fd-card[data-arrive] { animation: none; } .fd-pile-more svg { transition: none; } }

/* A shared session (sessions.py): who it is shared with sits above the box; files in her panel. */
.mchat-session { flex: none; display: flex; align-items: center; gap: 10px; width: calc(100% - 48px); max-width: 820px;
  margin: 8px auto 0; padding: 6px 8px 6px 6px; border: 1px solid var(--border); border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 6%, var(--background)); min-width: 0; }
.mchat-session-back { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%;
  color: var(--muted-foreground); }
.mchat-session-back:hover { background: var(--muted); color: var(--foreground); }
.mchat-session-back svg { width: 16px; height: 16px; }
.mchat-session-faces { display: flex; flex: none; }
.mchat-session-faces .avatar { width: 26px; height: 26px; font-size: 11px; border: 2px solid var(--background); }
.mchat-session-faces .avatar + .avatar { margin-left: -8px; }
.mchat-session-faces .avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.mchat-session-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; line-height: 1.25; }
.mchat-session-text b, .mchat-session-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mchat-session-text b { font-size: 13px; }
.mchat-session-acts { display: flex; gap: 4px; flex: none; }
.mchat-session + .mchat-composer { margin-top: 8px; }
@media (max-width: 600px) { .mchat-session { width: calc(100% - 32px); } }
.mchat-session-files { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mchat-session-files li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mchat-session-files li a { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; color: inherit;
  text-decoration: none; padding: 6px 8px; border-radius: 8px; }
.mchat-session-files li a:hover { background: var(--muted); }
.mchat-session-files li a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.mchat-session-files .ficon { width: 18px; height: 18px; flex: none; }
.mchat-session-files li.mchat-none { font-size: 13px; text-align: center; }
/* The card a shared session leaves in each person's own chat. */
.mchat-thread .thread-answer.card[data-card-kind="session"] { border: 0; box-shadow: none; background: none; padding: 0;
  max-width: min(100%, 460px); }
.mchat-thread .msg a.session-card, .thread-answer a.session-card { text-decoration: none; }
.session-card { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 16px;
  background: var(--background); color: inherit; text-decoration: none; }
.session-card:hover { border-color: var(--ring); }
.session-card-eyebrow { font-size: 12px; color: var(--muted-foreground); }
.session-card-title { font-size: 15px; }
.session-card-people { font-size: 13px; color: var(--muted-foreground); }
.session-card-open { justify-self: start; margin-top: 6px; padding: 4px 12px; border-radius: 999px; font-size: 13px;
  background: var(--primary); color: var(--primary-foreground); }

/* Chat box on every page but Chat (_ask_bar.html, ask-bar.js): Chat's pill in the page column. */
.askbar { position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; pointer-events: none;
  padding: 0 0 env(safe-area-inset-bottom); }
.askbar > .askbar-form { pointer-events: auto; margin: 0 auto 18px; width: calc(100% - 48px); max-width: 760px;
  background: color-mix(in srgb, var(--secondary) 92%, transparent);
  box-shadow: 0 6px 24px -10px color-mix(in srgb, var(--foreground) 28%, transparent); transform-origin: 50% 100%;
  transition: border-color .2s ease, box-shadow .2s ease, border-radius .2s ease,
    max-width .3s cubic-bezier(.2, .8, .2, 1), transform .3s cubic-bezier(.2, .8, .2, 1); }
/* Scrolled: a small pill until it is used. */
html[data-scrolled]:not([data-matilda-panel]) .askbar > .askbar-form:not(:focus-within, :has(.send.show), :has(.askbar-ctx)) {
  max-width: 300px; transform: scale(.82); }
.askbar-form .mchat-input { padding-left: 10px; align-items: center; gap: 6px; }
.askbar-ctx { flex: 0 1 auto; max-width: 60%; min-width: 0; margin: 0; }
.askbar-ctx button { flex: none; padding: 0 2px; border: 0; background: none; color: inherit; font-size: 15px; line-height: 1; cursor: pointer; opacity: .6; }
.askbar-ctx button:hover { opacity: 1; }
.askbar-form[data-tall] .mchat-input { padding-left: 8px; }
.askbar[data-asked] > .askbar-form, #composer[data-asked] { animation: askbar-asked .6s ease; }
@keyframes askbar-asked { 40% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--ring) 30%, transparent); } }
@media (min-width: 768px) {
  .askbar { left: var(--sidebar-width); }
  html[data-matilda-panel] .askbar { right: 400px; }
}
@media (max-width: 767px) {
  .askbar > .askbar-form { width: calc(100% - 24px); margin-bottom: 12px; }
  .askbar-form:has(.askbar-ctx) .mchat-text[data-empty]::before { content: none; }
  /* Her panel covers the page on a phone; the box stays over its foot. */
  body:has(#askbar) .matilda-shell-panel { padding-bottom: 88px; }
}
/* Room under every page for the box. */
body:has(#askbar) .shell-stage > main > .page { padding-bottom: 128px; }
body:has(#askbar) .shell-stage > main > .page.page-flush { padding-bottom: 96px; }
@media (prefers-reduced-motion: reduce) {
  .askbar[data-asked] > .askbar-form, #composer[data-asked] { animation: none; }
  .askbar > .askbar-form { transition: none; }
}

/* The platform admin's view of an organization (shell.html). */
.platform-view { position: fixed; top: 10px; right: 16px; z-index: 60; max-width: min(380px, calc(100vw - 32px));
  padding: 8px 14px; border-radius: var(--radius-md, 8px); background: var(--secondary);
  color: var(--secondary-foreground); font-size: 13px; box-shadow: 0 1px 6px rgb(0 0 0 / 0.12); }
.platform-view a { margin-left: 8px; font-weight: 600; text-decoration: underline; }

/* The platform admin's site (templates/admin). */
.page > .platform-top { align-items: center; gap: 12px 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.platform-brand { font-weight: 700; font-size: 18px; text-decoration: none; }
.platform-nav { display: flex; flex-wrap: wrap; gap: 16px; }
.platform-nav a { text-decoration: none; }
.platform-nav a[aria-current="page"] { font-weight: 600; text-decoration: underline; }
.platform-me { margin-left: auto; font-size: 13px; }
.platform-form { display: grid; gap: 10px; max-width: 420px; }
.platform .cluster > .input { flex: 1 1 220px; width: auto; max-width: 360px; }
.platform :is(input, textarea)::placeholder { color: var(--muted-foreground); opacity: .55; }
.platform-field { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) auto; gap: 10px; align-items: center; margin: 8px 0; }
@media (max-width: 640px) { .platform-field { grid-template-columns: 1fr; } }
.platform-members { display: grid; gap: 8px; }
.platform-member { border: 1px solid var(--border); border-radius: 10px; background: var(--card); }
.platform-member > summary { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 10px 14px; cursor: pointer; list-style: none; }
.platform-member > summary::-webkit-details-marker { display: none; }
.platform-member > summary .pm-who { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
.platform-member[open] > summary { border-bottom: 1px solid var(--border); }
.platform-member .pm-body { display: grid; gap: 14px; padding: 12px 14px 16px; }
.platform-member .pm-body h3 { font-size: 13px; font-weight: 600; margin: 0; color: var(--muted-foreground); }
.platform-member .pm-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; max-width: 560px; }

/* The memory space (memory-space.js): a slow cloud of light under her orb; the hazy list when flat. */
.page.mspace-page { padding: 0 !important; }
.mspace { position: relative; height: 100dvh; overflow: hidden; touch-action: none;
  background: radial-gradient(80% 70% at 50% 45%, color-mix(in srgb, var(--primary) 7%, transparent), transparent 70%); }
.mspace-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
.mspace-list { display: none; }
.mspace[data-flat] { height: auto; min-height: 100dvh; overflow: visible; touch-action: auto; }
.mspace[data-flat] .mspace-canvas { display: none; }
.mspace[data-flat] .mspace-list { display: block; max-width: 680px; margin: 0 auto; padding: 180px 24px 220px; }
.mspace:not([data-flat]) .mspace-list { display: block; position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); }
.mspace-list .haze-item { cursor: pointer; font-size: 15px; }
.mspace-tip { position: absolute; z-index: 2; max-width: min(300px, 70vw); padding: 8px 12px; border-radius: 12px;
  font-size: 13px; line-height: 1.5; pointer-events: none; color: var(--foreground);
  background: color-mix(in srgb, var(--popover) 82%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 6px 24px -12px color-mix(in srgb, var(--foreground) 40%, transparent); animation: mspace-in .25s ease; }
.mspace-tip[data-scope=soul] { font-family: var(--font-brand); font-size: 14px; }
.mspace-tray { position: absolute; z-index: 3; left: 50%; bottom: 96px; translate: -50% 0; display: grid; gap: 6px;
  width: calc(100% - 48px); max-width: 640px; max-height: 42dvh; margin: 0; padding: 0; overflow: auto; list-style: none; }
body:not(:has(#askbar)) .mspace-tray { bottom: 24px; }
.mspace-tray li { --tint: var(--chart-1); display: flex; align-items: flex-start; gap: 10px; padding: 10px 10px 10px 14px;
  border-radius: 14px; font-size: 14px; line-height: 1.5; background: color-mix(in srgb, var(--popover) 88%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border: 1px solid color-mix(in srgb, var(--tint) 22%, transparent);
  animation: mspace-in .3s ease; }
.mspace-tray li::before { content: ""; flex: none; width: 7px; height: 7px; margin-top: 7px; border-radius: 50%;
  background: var(--tint); box-shadow: 0 0 10px var(--tint); }
.mspace-tray li > span { flex: 1 1 auto; min-width: 0; }
.mspace-tray li[data-scope=chat] { --tint: var(--chart-4); }
.mspace-tray li[data-scope=team] { --tint: var(--chart-5); }
.mspace-tray li[data-scope=soul] { --tint: var(--primary); font-family: var(--font-brand); font-size: 15px; cursor: pointer; }
.mspace-tray button { flex: none; display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0;
  border-radius: 8px; background: none; color: var(--muted-foreground); cursor: pointer; }
.mspace-tray button:hover { background: var(--muted); color: var(--foreground); }
.mspace-tray button svg { width: 14px; height: 14px; }
@keyframes mspace-in { from { opacity: 0; transform: translateY(4px); } }
@media (max-width: 767px) {
  .mspace { height: calc(100dvh - 57px); }
  .mspace-tray { width: calc(100% - 24px); bottom: 84px; }
}
@media (prefers-reduced-motion: reduce) { .mspace-tip, .mspace-tray li { animation: none; } }

/* Password rule checklist (macros.html password_rules) and the show/hide toggle on reset.html. */
.pw-rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; text-align: left; font-size: 12.5px; color: var(--muted-foreground); }
.pw-rules li::before { content: "\25CB"; display: inline-block; width: 1.4em; }
.pw-rules li.ok { color: var(--foreground); }
.pw-rules li.ok::before { content: "\2713"; }
.pw-show { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted-foreground); }

/* Sign-in (login.html, reset.html): a bare form, no card; the onboarding city (.wl-side) beside it on wide screens. */
.signin-box { width: min(340px, 100%); display: grid; gap: 12px; justify-items: center; text-align: center; }
.signin-box form { display: grid; gap: 10px; width: 100%; }
.signin-box .wordmark { font-size: 34px; margin: 0 0 12px; }
.signin-or { display: flex; align-items: center; gap: 12px; color: var(--muted-foreground); font-size: 12.5px; }
.signin-or::before, .signin-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
@media (max-width: 899px) {
  .wl.signin { grid-template-rows: minmax(0, 1fr); }
  .wl.signin .wl-side { display: none; }
}
