/* =========================================================================
   VesselData — lean UI
   Visual source of truth: docs/design/vesseldata-lean-prototype.html
   Section numbers in comments refer to docs/design/UI-REDESIGN-SPEC.md
   ========================================================================= */

/* ---------- Self-hosted fonts (spec 1: no CDN in production) ---------- */
/* latin */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/assets/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/assets/fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('/assets/fonts/space-grotesk-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('/assets/fonts/space-grotesk-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-mono-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-mono-400-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-mono-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-mono-500-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Design tokens (spec 1, prototype :root) ---------- */
:root {
  color-scheme: light;

  --ink: #101820;
  --mut: #5B6B72;
  --faint: #8B979D;
  --paper: #F6F8F9;
  --card: #FFFFFF;
  --line: #E3E8EB;
  --line-soft: #EEF2F4;
  --accent: #42B0D5;
  --accent-hover: #3195B7;
  --accent-active: #217C9A;
  --accent-strong: #176B87;
  --accent-soft: #E6F5FA;
  --accent-mid: #B5E2F0;
  --success: #0F6B66;
  --success-strong: #0B5450;
  --success-soft: #E4F0EF;
  --success-mid: #CFE4E2;
  --data-task: var(--success);
  --data-task-strong: var(--success-strong);
  --data-time: var(--success);
  --data-outgoing: var(--success);
  --data-outgoing-soft: var(--success-soft);
  --red: #BC3A28;
  --red-soft: #F9E9E6;
  --amber: #9A6B12;
  --amber-soft: #F7EDD9;
  --blue: #2B5AA7;
  --blue-soft: #E8EEF8;

  --r: 10px;
  --r-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 32, .05), 0 4px 16px rgba(16, 24, 32, .05);
  --shadow-lg: 0 8px 40px rgba(16, 24, 32, .16);
  --ring: 0 0 0 3px var(--accent-strong);

  --surface-canvas: var(--paper);
  --surface-raised: var(--card);
  --surface-subtle: #F1F4F5;
  --surface-hover: #F8FAFA;
  --control-border: var(--line);
  --control-border-hover: #B9C4C9;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --page-pad: 28px;
  --control-h: 36px;
  --touch-target: 40px;
  --content-w: 880px;
  --content-wide-w: 1100px;
  --ease-standard: cubic-bezier(.2, .8, .2, 1);
  --duration-fast: 140ms;
  --duration-shell: 220ms;
  --duration-rail: 180ms;

  --ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --disp: 'Space Grotesk', var(--ui);
  --mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;

  --side-w: 236px;
  --rail-w: 64px;
  --drawer-w: min(clamp(440px, 36vw, 560px), 100%);
}

/* ---------- Reset & base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
}

body {
  font-family: var(--ui);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  height: 100vh;
  overflow: hidden;
  line-height: 1.5;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

body.non-production {
  background:
    linear-gradient(180deg, rgba(188, 58, 40, .10), rgba(246, 248, 249, 0) 180px),
    var(--paper);
}

.environment-banner {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10000;
  background: #BC3A28;
  color: #fff;
  text-align: center;
  font: 700 .78rem/1 var(--disp);
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 8px 12px;
  box-shadow: 0 2px 14px rgba(188, 58, 40, .28);
}

body.non-production .login-view,
body.non-production .app-shell {
  padding-top: 30px;
}

body.non-production .login-panel,
body.non-production .app-shell {
  outline: 3px solid rgba(188, 58, 40, .22);
  outline-offset: -3px;
}

button {
  font: inherit;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
  transition:
    color var(--duration-fast) ease,
    background-color var(--duration-fast) ease,
    border-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

button:focus-visible,
a:focus-visible,
[role='button']:focus-visible,
[role='tab']:focus-visible {
  position: relative;
  z-index: 1;
}

input,
textarea,
select {
  font: inherit;
  color: inherit;
}

::placeholder {
  color: var(--faint);
}

a {
  color: var(--accent-strong);
}

ul,
ol {
  list-style: none;
}

img {
  max-width: 100%;
}

h1 {
  font-family: var(--disp);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -.01em;
  line-height: 1.2;
}

h2 {
  font-family: var(--disp);
  font-weight: 600;
  font-size: 1.02rem;
  line-height: 1.3;
}

h3 {
  font-family: var(--disp);
  font-weight: 600;
  font-size: .95rem;
  line-height: 1.35;
}

h4 {
  font-family: var(--disp);
  font-weight: 600;
  font-size: .87rem;
}

.hidden,
[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Convention: mono = data, UI font = labels (spec 1) */
.mono {
  font-family: var(--mono);
}

.spacer {
  flex: 1;
}

.muted,
.sub {
  color: var(--mut);
  font-size: .86rem;
}

.meta {
  color: var(--faint);
  font-size: .78rem;
}

.empty-state,
.compact-empty,
.members-empty {
  color: var(--faint);
  font-size: .85rem;
  padding: 14px 0;
}

.empty-line {
  padding: 26px 18px;
  text-align: center;
  color: var(--faint);
  font-size: .86rem;
}

.error,
.error-text {
  color: var(--red);
  font-size: .83rem;
}

.error:empty {
  display: none;
}

.brand-logo {
  display: block;
  object-fit: contain;
}

/* =========================================================================
   Spec 2 — Application frame: sidebar, topbar, drawer
   ========================================================================= */
.app-shell {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  height: 100vh;
  background: var(--surface-canvas);
  transition: grid-template-columns var(--duration-rail) var(--ease-standard);
}

.app-shell.rail {
  grid-template-columns: var(--rail-w) 1fr;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--surface-raised);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: var(--space-5) var(--space-4) var(--space-4);
  min-height: 0;
}

.side-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 4px 16px 6px;
}

.sidebar-logo {
  height: 24px;
  width: auto;
  flex: none;
}

.logo-word {
  font-family: var(--disp);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: .01em;
  flex: 1;
  white-space: nowrap;
}

.logo-word b {
  color: var(--accent-strong);
}

.railbtn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--faint);
  flex: none;
}

.railbtn:hover {
  background: var(--paper);
  color: var(--ink);
}

.side-nav {
  display: flex;
  flex-direction: column;
}

/* Sidebar buttons: Home, New project, Settings, account actions */
.wide-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--mut);
  font-weight: 500;
  font-size: .89rem;
  margin-bottom: 2px;
}

.wide-button svg {
  flex: none;
}

.wide-button:hover:not(:disabled) {
  background: var(--paper);
  color: var(--ink);
}

.wide-button.active-nav,
.wide-button.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

.wide-button.danger-link {
  color: var(--red);
}

.wide-button.danger-link:hover {
  background: var(--red-soft);
}

.sidebar-label {
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 18px 10px 8px;
}

.sidebar-sub-label {
  padding-top: 14px;
}

.sidebar-projects {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.sidebar-filter {
  display: flex;
  gap: 4px;
  padding: 0 4px 8px;
}

.sidebar-filter button {
  font-size: .74rem;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 20px;
  color: var(--mut);
  border: 1px solid transparent;
}

.sidebar-filter button:hover {
  background: var(--paper);
}

.sidebar-filter button.active {
  background: var(--ink);
  color: #fff;
}

.project-list {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
}

.project-list > p {
  color: var(--faint);
  font-size: .82rem;
  padding: 8px 10px;
}

/* Project entries: name + client·number in mono, status dot, red badge */
.project {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  padding: 8px 9px 9px;
  border-radius: var(--r-sm);
  margin-bottom: 3px;
  cursor: pointer;
  position: relative;
}

.project:hover {
  background: var(--surface-hover);
}

.project-avatar {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: none;
  position: relative;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-family: var(--disp);
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .01em;
}

.project.active .project-avatar {
  background: var(--accent);
  color: var(--ink);
}

.project-status-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  border: 1.5px solid var(--card);
}

.project-status-dot.warn {
  background: var(--red);
}

.project-copy {
  min-width: 0;
  flex: 1;
}

.project.active {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent-strong);
}

.project .pname {
  font-weight: 650;
  font-size: .88rem;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 7px;
}

.project .pname .label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.project .pmeta {
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--faint);
  margin-top: 3px;
  display: grid;
  gap: 2px;
  line-height: 1.35;
  overflow: hidden;
}

.project .pnumber,
.project .pclient {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.project .pnumber {
  color: var(--mut);
}

.project .pclient {
  color: var(--faint);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  flex: none;
}

.dot.warn,
.dot.bad {
  background: var(--red);
}

.badge {
  margin-left: auto;
  font-family: var(--mono);
  font-size: .68rem;
  background: var(--red-soft);
  color: var(--red);
  border-radius: 20px;
  padding: 1px 7px;
  font-weight: 500;
  min-width: 20px;
  text-align: center;
  flex: none;
}

.sidebar-account {
  margin-top: auto;
  border-top: 1px solid var(--line-soft);
  padding-top: 10px;
  position: relative;
}

.account-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  width: 100%;
  text-align: left;
}

.account-chip:hover {
  background: var(--paper);
}

.account-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-size: .72rem;
  font-weight: 600;
  font-family: var(--disp);
  flex: none;
}

.account-meta {
  min-width: 0;
  line-height: 1.2;
}

.account-meta strong {
  font-size: .86rem;
  font-weight: 600;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-meta small {
  font-size: .72rem;
  color: var(--faint);
}

/* Account menu — log out and profile stay here (spec 7) */
.account-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 70;
}

/* ---------- Collapsible rail (spec 2) ---------- */
.app-shell.rail .sidebar {
  padding: 16px 10px;
}

.app-shell.rail .side-head {
  justify-content: center;
  padding: 2px 0 14px;
}

.app-shell.rail .logo-word,
.app-shell.rail .sidebar-logo,
.app-shell.rail .lbl,
.app-shell.rail .sidebar-label,
.app-shell.rail .sidebar-filter,
.app-shell.rail .pmeta,
.app-shell.rail .account-meta,
.app-shell.rail .account-menu {
  display: none;
}

.app-shell.rail .wide-button {
  justify-content: center;
  padding: 9px 0;
}

.app-shell.rail .project {
  width: 40px;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  margin: 0 auto 6px;
}

.app-shell.rail .project-copy {
  display: none;
}

.app-shell.rail .project-avatar {
  width: 32px;
  height: 32px;
  font-size: .7rem;
}

.app-shell.rail .project.active {
  background: transparent;
  box-shadow: none;
}

/* Red pip preserves the overdue signal when collapsed (spec 2) */
.app-shell.rail .project[data-pip='1']::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  border: 1.5px solid var(--card);
}

.app-shell.rail .account-chip {
  justify-content: center;
  padding: 6px 0;
}

/* ---------- Main column & topbar ---------- */
.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  container-type: inline-size;
  position: relative;
  overflow: hidden;
  padding-right: 0;
  background: var(--surface-canvas);
  transition: padding-right var(--duration-shell) var(--ease-standard);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: var(--space-3) var(--page-pad);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  flex: none;
}

.crumb {
  font-size: .85rem;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crumb b {
  color: var(--ink);
  font-weight: 600;
}

.topbar-search {
  flex: 1;
  max-width: 420px;
  margin-left: auto;
  position: relative;
  display: flex;
  align-items: center;
}

.topbar-search-trigger {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 1;
  width: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  color: var(--faint);
}

.topbar-search-trigger:hover,
.topbar-search-trigger:focus-visible {
  color: var(--ink);
}

/* The id is deliberate: this has to outrank the generic `input:not(...)` rule
   further down, otherwise the leading room for the magnifier icon is lost. */
.topbar-search input#home-search {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 7px 12px 7px 34px;
  background: var(--paper);
  font-size: .86rem;
  transition: opacity var(--duration-fast) var(--ease-standard), width var(--duration-rail) var(--ease-standard);
}

.workspace.compact-search-context .topbar-search.search-collapsed {
  flex: 0 0 36px;
  width: 36px;
  min-width: 36px;
  height: 36px;
  margin-left: auto;
}

.workspace.compact-search-context .topbar-search.search-collapsed .topbar-search-trigger {
  border: 1px solid transparent;
}

.workspace.compact-search-context .topbar-search.search-collapsed .topbar-search-trigger:hover,
.workspace.compact-search-context .topbar-search.search-collapsed .topbar-search-trigger:focus-visible {
  background: var(--paper);
  border-color: var(--line);
}

.workspace.compact-search-context .topbar-search.search-collapsed input#home-search {
  width: 0;
  min-width: 0;
  padding-inline: 0;
  border-width: 0;
  opacity: 0;
  pointer-events: none;
}

.crumb-project-number {
  margin-left: 6px;
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--faint);
}

.iconbtn {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  color: var(--mut);
  border: 1px solid transparent;
  position: relative;
  flex: none;
}

.iconbtn:hover {
  background: var(--paper);
  color: var(--ink);
}

.iconbtn.on {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: var(--accent-mid);
}

.iconbtn .pip {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  border: 1.5px solid var(--card);
}

.iconbtn .pip.has-count {
  top: -6px;
  right: -7px;
  display: inline-grid;
  width: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  place-items: center;
  border: 2px solid var(--card);
  border-radius: 999px;
  background: var(--accent-strong);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

/* The sidebar is the single desktop entry to all conversations. On compact
   screens it is collapsed, so the header shortcut remains available. */
#drawer-talk.mobile-chat-shortcut {
  display: none;
}

.menubtn {
  display: none;
}

/* ＋ Create menu (spec 2) */
.create-wrap {
  position: relative;
  flex: none;
}

.popover-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  z-index: 70;
  min-width: 210px;
  padding: 6px;
}

.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  font-weight: 500;
  font-size: .86rem;
  color: var(--ink);
}

.menu-item:hover:not(:disabled) {
  background: var(--paper);
}

.menu-divider {
  height: 1px;
  background: var(--line-soft);
  margin: 5px 4px;
}

/* ---------- Views ---------- */
.view {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: var(--page-pad);
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

.view.view-flush {
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wrap {
  max-width: var(--content-w);
  margin: 0 auto;
}

.wrap-wide {
  max-width: var(--content-wide-w);
}

/* ---------- Right drawer (spec 2) ---------- */
.drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--drawer-w);
  background: var(--surface-raised);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  transform: translateX(105%);
  transition:
    transform var(--duration-shell) var(--ease-standard),
    visibility 0s linear var(--duration-shell);
  display: flex;
  flex-direction: column;
  z-index: 40;
  visibility: hidden;
  contain: layout paint;
}

.drawer.open {
  transform: none;
  visibility: visible;
  transition-delay: 0s;
}

@media (min-width: 1101px) {
  .workspace.drawer-open {
    padding-right: var(--drawer-w);
  }

  .drawer {
    box-shadow: -8px 0 28px rgba(16, 24, 32, .07);
  }
}

.dhead {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  flex: none;
}

.dtab {
  padding: 7px 13px;
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: .86rem;
  color: var(--mut);
}

.dtab:hover {
  color: var(--ink);
}

.dtab.on {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.dclose {
  margin-left: 4px;
}

.ask-drawer-controls {
  display: none;
  align-items: center;
  gap: 3px;
  margin-left: auto;
}

.workspace.assistant-open .ask-drawer-controls {
  display: flex;
}

.workspace.assistant-open .drawer-provider-tabs {
  margin-left: 0;
}

.ask-header-action {
  padding: 6px 8px;
  border-radius: var(--r-sm);
  color: var(--mut);
  font-size: .76rem;
  font-weight: 600;
  white-space: nowrap;
}

.ask-header-action:hover,
.ask-header-action[aria-expanded="true"] {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.dpane {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.dpane[hidden] {
  display: none !important;
}

#dpane-ai {
  overflow: hidden;
  padding: 0;
}

#dpane-ai > .dbody {
  overflow-y: auto;
  padding: 16px;
  scrollbar-gutter: stable;
}

#dpane-ai.history-open > .dfoot {
  display: none !important;
}

.dbody {
  flex: 1;
  min-height: 0;
}

.dfoot {
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  display: flex;
  gap: 8px;
  flex: none;
}

.dnote {
  font-size: .76rem;
  color: var(--faint);
  text-align: center;
  padding: 10px 0 2px;
}

.dmenu-wrap {
  position: relative;
  margin-left: auto;
}

.dmenu-wrap .popover-menu {
  min-width: 240px;
}

/* =========================================================================
   Generic components (prototype)
   ========================================================================= */
.card,
.dashboard-card {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}

.pad,
.dashboard-card {
  padding: 18px;
}

.card.flush {
  padding: 0;
  overflow: hidden;
}

/* Buttons — .btn is the new primitive; legacy button classes map onto it. */
.btn,
button.secondary,
button[type='submit'],
.dashboard-card button[type='button']:not(.iconbtn):not(.mini):not(.compact-button):not(.fchip):not(.tab):not(.chip-button):not(.suggestion),
dialog button[type='button']:not(.iconbtn):not(.mini):not(.compact-button):not(.fchip):not(.dialog-tab):not(.chip-button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: .85rem;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  white-space: nowrap;
}

.btn:hover:not(:disabled),
button.secondary:hover:not(:disabled),
button[type='submit']:hover:not(:disabled) {
  border-color: var(--control-border-hover);
  background-color: var(--surface-hover);
}

.btn.primary,
button.primary,
button[type='submit']:not(.secondary):not(.mini):not(.compact-button) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}

.btn.primary:hover:not(:disabled),
button.primary:hover:not(:disabled),
button[type='submit']:not(.secondary):not(.mini):not(.compact-button):hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn.primary:active:not(:disabled),
button.primary:active:not(:disabled),
button[type='submit']:not(.secondary):not(.mini):not(.compact-button):active:not(:disabled) {
  background: var(--accent-active);
  border-color: var(--accent-active);
  color: #fff;
}

.btn.ghost {
  border-color: transparent;
  color: var(--mut);
  background: none;
}

.btn.ghost:hover:not(:disabled) {
  color: var(--ink);
  background: var(--paper);
  border-color: transparent;
}

.btn.danger,
button.danger {
  color: var(--red);
  border-color: #EDCDC6;
  background: var(--red-soft);
}

/* Small inline buttons */
.mini,
.compact-button {
  font-size: .76rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.mini:hover:not(:disabled),
.compact-button:hover:not(:disabled) {
  border-color: var(--faint);
}

.mini.go,
.compact-button:not(.secondary) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}

.mini.go:hover:not(:disabled),
.compact-button:not(.secondary):hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.mini.go:active:not(:disabled),
.compact-button:not(.secondary):active:not(:disabled) {
  background: var(--accent-active);
  border-color: var(--accent-active);
  color: #fff;
}

.mini.danger {
  color: var(--red);
  border-color: #EDCDC6;
  background: var(--red-soft);
}

.chip-button {
  font-size: .74rem;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--mut);
}

.chip-button:hover {
  border-color: var(--faint);
  color: var(--ink);
}

/* Chips & pills */
.chip,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--mut);
  white-space: nowrap;
}

.chip.teal,
.chip-status {
  background: var(--accent-soft);
  border-color: var(--accent-mid);
  color: var(--accent-strong);
}

.pill.ok,
.chip-health.active {
  background: var(--success-soft);
  border-color: var(--success-mid);
  color: var(--success-strong);
}

.chip.red,
.pill.bad,
.chip-health.risk,
.pill.priority-urgent {
  background: var(--red-soft);
  border-color: #EDCDC6;
  color: var(--red);
}

.chip.amber,
.pill.warn,
.chip-health.watch,
.pill.priority-high {
  background: var(--amber-soft);
  border-color: #E9D9B4;
  color: var(--amber);
}

.chip.blue {
  background: var(--blue-soft);
  border-color: #CFDCEF;
  color: var(--blue);
}

.chip.mono,
.pill.mono {
  font-family: var(--mono);
  font-size: .72rem;
}

/* Status pill in plain words (spec 5) */
.st {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .76rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

.st.ok {
  background: var(--success-soft);
  color: var(--success-strong);
}

.st.off {
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--faint);
}

.st.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.st .sdot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* Section head */
.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 12px;
  flex-wrap: wrap;
}

.section-head > h2,
.section-head > h3,
.section-head > h4,
.section-head > div > h3,
.section-head > div > h4 {
  margin: 0;
}

.section-head .count {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--faint);
}

.activity-detail-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: var(--mut);
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
}

.activity-detail-toggle input {
  margin: 0;
}

.section-head > .actions,
.section-head > .row-actions {
  margin-left: auto;
}

/* Filter chips */
.filters {
  display: flex;
  gap: 6px;
  margin-left: auto;
  flex-wrap: wrap;
}

.fchip {
  font-size: .78rem;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 20px;
  color: var(--mut);
  border: 1px solid transparent;
}

.fchip:hover {
  background: var(--paper);
}

.fchip.on,
.fchip.active {
  background: var(--ink);
  color: #fff;
}

/* Rows */
.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line-soft);
  transition: background .12s;
  width: 100%;
  text-align: left;
}

.row:last-child {
  border-bottom: none;
}

.row:hover {
  background: var(--paper);
}

.row .ric {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: none;
}

.ric.action {
  background: var(--red-soft);
  color: var(--red);
}

.ric.mail,
.ric.doc,
.ric.task,
.ric.insight {
  background: var(--surface-subtle);
  color: var(--mut);
}

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

.row .t {
  font-weight: 600;
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.row .m {
  font-size: .76rem;
  color: var(--faint);
  margin-top: 2px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.row .m .proj {
  color: var(--accent-strong);
  font-weight: 500;
}

.inbox-action-label {
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: .7rem;
  font-weight: 600;
}

.row .when {
  font-family: var(--mono);
  font-size: .73rem;
  color: var(--faint);
  flex: none;
}

.row .when.over {
  color: var(--red);
  font-weight: 500;
}

.row .acts {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity .12s;
  flex: none;
  position: relative;
}

.row .body[data-project-id] {
  cursor: pointer;
}

.row:hover .acts,
.row:focus-within .acts {
  opacity: 1;
}

.row.done {
  opacity: .45;
}

.row.done .t {
  text-decoration: line-through;
}

/* Actionable rows stay in context: the row opens an inline preview and the
   explicit secondary link is the only control that navigates away. */
.attention-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
}

.attention-row.expanded {
  background: var(--paper);
}

.attention-row-main {
  appearance: none;
  width: 100%;
  min-width: 0;
  padding: 2px 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.attention-row-main:hover .t,
.attention-row-main[aria-expanded="true"] .t {
  color: var(--accent-strong);
}

.attention-preview {
  grid-column: 1 / -1;
  flex-basis: 100%;
  min-width: 0;
  margin: 4px 0 0 44px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.attention-preview-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  margin-bottom: 12px;
  color: var(--mut);
  font-size: .78rem;
}

.attention-preview-meta span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.attention-preview-meta b {
  display: block;
  margin-bottom: 2px;
  color: var(--faint);
  font-size: .68rem;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.attention-preview-wide {
  grid-column: 1 / -1;
}

.attention-email-body,
.attention-description {
  max-height: 230px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--paper);
  color: var(--text);
  font-size: .82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.attention-preview-status {
  margin: 0;
  padding: 14px;
}

.attention-view-full {
  margin-top: 8px;
  color: var(--accent-strong);
  font-size: .78rem;
  font-weight: 650;
}

.attention-view-full:hover {
  text-decoration: underline;
}

.attention-preview-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.attention-approve {
  border: 1px solid var(--success) !important;
  background: var(--success) !important;
  color: #fff !important;
}

.attention-approve:hover:not(:disabled) {
  border-color: var(--success-strong) !important;
  background: var(--success-strong) !important;
}

.attention-thread {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
}

.attention-preview-label {
  color: var(--faint);
  font-size: .7rem;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.attention-thread-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--surface);
  text-align: left;
}

.attention-thread-row span:first-child {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attention-thread-row span:last-child {
  color: var(--faint);
  font-size: .72rem;
}

.attention-thread-row.active {
  border-color: var(--accent-mid);
  background: var(--accent-soft);
}

.route-focused {
  border-radius: var(--r-sm);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent-strong) !important;
}

/* Dashed hint line — the "empty means hidden" collapse target (spec 0.3) */
.hint {
  border: 1px dashed var(--line);
  border-radius: var(--r);
  padding: 13px 18px;
  color: var(--faint);
  font-size: .83rem;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
}

.hint a {
  color: var(--accent-strong);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

/* Timeline */
.tl li,
.timeline-item {
  display: flex;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: .86rem;
  align-items: baseline;
  width: 100%;
  text-align: left;
}

.tl li:last-child,
.timeline-item:last-child {
  border-bottom: none;
}

.tl .tld,
.timeline-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-mid);
  flex: none;
  position: relative;
  top: -1px;
}

.timeline-dot.dot-email {
  background: var(--blue);
}

.timeline-dot.dot-task {
  background: var(--data-task);
}

.timeline-dot.dot-file {
  background: var(--blue);
}

.timeline-dot.dot-note {
  background: var(--amber);
}

.timeline-dot.dot-done {
  background: var(--data-task-strong);
}

.timeline-dot.dot-insight {
  background: var(--amber);
}

.tl .tlt,
.timeline-body {
  flex: 1;
  min-width: 0;
}

.timeline-body strong {
  font-weight: 600;
  display: block;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.tl .tlm,
.timeline-body .meta {
  color: var(--faint);
  font-size: .76rem;
  margin-top: 1px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-technical {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: .68rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tl .tlw,
.timeline-time {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--faint);
  flex: none;
}

.tl li .mini {
  flex: none;
}

.open-item-main {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  flex: 1;
  min-width: 0;
  cursor: pointer;
  color: inherit;
}

.open-item-main:hover .tlt {
  color: var(--accent-strong);
}

.overview-attention-row {
  flex-wrap: wrap;
  align-items: center !important;
}

.overview-attention-row.expanded {
  padding-bottom: 13px;
}

.overview-attention-row .attention-preview {
  margin-left: 19px;
}

.attention-chevron {
  color: var(--faint);
  font-size: .8rem;
}

.attention-dot-mail {
  background: var(--blue) !important;
}

.attention-dot-action {
  background: var(--amber) !important;
}

.attention-dot-doc {
  background: var(--red) !important;
}

.open-item-details {
  flex-basis: 100%;
  margin: 8px 0 0 22px;
  display: grid;
  gap: 6px;
}

.open-item-detail-row {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  display: grid;
  gap: 2px;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.open-item-detail-row span:first-child {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.open-item-detail-row span:last-child,
.open-item-more {
  color: var(--faint);
  font-size: .76rem;
}

.timeline-item[data-project-id] {
  cursor: pointer;
}

.timeline-item:hover {
  background: var(--paper);
}

.timeline-title-link {
  display: -webkit-box;
  width: fit-content;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  line-height: inherit;
  text-align: left;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.timeline-title-link:hover {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.timeline-title-link:focus-visible {
  border-radius: 3px;
  outline: 2px solid var(--accent-strong);
  outline-offset: 3px;
}

/* KPI cards */
.kpis,
.finance-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.finance-summary-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.finance-summary-grid:empty {
  display: none;
}

.kpi,
.finance-kpi {
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}

.kpi .l,
.finance-kpi > span {
  font-size: .74rem;
  color: var(--faint);
  font-weight: 500;
  display: block;
}

.kpi .v,
.finance-kpi > strong {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 500;
  margin-top: 4px;
  display: block;
}

.kpi .v.good {
  color: var(--success-strong);
}

.kpi .v.bad {
  color: var(--red);
}

/* Form fields — supports prototype (div.field > label) and legacy
   (label.field > span) markup alike. */
.field {
  min-width: 0;
}

.field > label,
label.field > span:first-child,
form > label:not(.inline):not(.compact-toggle) > span:first-child {
  display: block;
  font-size: .76rem;
  font-weight: 600;
  color: var(--mut);
  margin-bottom: 5px;
}

label.field,
form > label:not(.inline):not(.compact-toggle) {
  display: block;
  margin-bottom: 12px;
  font-size: .76rem;
  font-weight: 600;
  color: var(--mut);
}

input:not([type='checkbox']):not([type='radio']):not([type='file']),
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px 11px;
  background: var(--card);
  font-size: .88rem;
  font-weight: 400;
  font-family: var(--ui);
  color: var(--ink);
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--accent-mid);
  border-color: var(--accent-strong);
}

textarea {
  resize: vertical;
  min-height: 62px;
}

input[type='checkbox'],
input[type='radio'] {
  accent-color: var(--accent);
  width: auto;
}

input[type='file'] {
  font-size: .82rem;
}

label.inline,
.compact-toggle {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  font-size: .83rem;
  font-weight: 500;
  color: var(--mut);
  margin-bottom: 0;
}

.fieldnote,
.help {
  font-size: .76rem;
  color: var(--faint);
  margin-top: 4px;
  line-height: 1.45;
  font-weight: 400;
}

.help {
  font-size: .8rem;
}

.form-actions,
.row-actions,
.actions,
.storage-actions,
.talk-actions,
.item-actions,
.todo-card-actions,
.file-detail-actions,
.quick-create-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.form-actions {
  justify-content: flex-end;
  margin-top: 14px;
}

/* Advanced fold — holds every technical field verbatim (spec 5) */
details.adv {
  margin-top: 14px;
  border-top: 1px solid var(--line-soft);
  padding-top: 11px;
}

details.adv summary {
  cursor: pointer;
  font-size: .8rem;
  font-weight: 600;
  color: var(--mut);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

details.adv summary::-webkit-details-marker {
  display: none;
}

details.adv summary::before {
  content: '▸';
  font-size: .72rem;
  transition: transform .15s;
}

details.adv[open] summary::before {
  transform: rotate(90deg);
}

details.adv > .grid-2,
details.adv > .grid-1 {
  margin-top: 12px;
}

/* Form grids */
.grid-2,
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grid-1,
.stacked-form,
.members-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.grid-2 > .wide,
.settings-grid > .wide {
  grid-column: 1 / -1;
}

/* Assistant suggestions */
.suggestion,
.sugg {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--r-sm);
  padding: 9px 13px;
  font-size: .85rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--ink);
}

.suggestion:hover,
.sugg:hover {
  border-color: var(--accent-strong);
  color: var(--accent-strong);
}

.assistant-suggestions {
  margin-bottom: 12px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 90px);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: .86rem;
  font-weight: 500;
  transition: transform .25s ease;
  z-index: 200;
  max-width: 90vw;
  text-align: center;
}

.toast.show {
  transform: translate(-50%, 0);
}

.operation-status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--accent-mid);
  border-radius: var(--r-sm);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}

.operation-status[hidden] {
  display: none;
}

.operation-status-global {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 130;
  width: min(420px, calc(100vw - 32px));
}

.operation-status-inline {
  margin: 0 0 10px;
}

.operation-status strong,
.operation-status small {
  display: block;
}

.operation-status strong {
  font-size: .84rem;
}

.operation-status small {
  margin-top: 2px;
  color: var(--mut);
  font-size: .75rem;
}

.operation-spinner {
  width: 19px;
  height: 19px;
  border: 2px solid var(--accent-mid);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: operation-spin .75s linear infinite;
}

.operation-status.success {
  background: var(--success-soft);
}

.operation-status.failed {
  border-color: color-mix(in srgb, var(--red) 35%, var(--line));
  background: var(--red-soft);
}

.operation-status.success .operation-spinner,
.operation-status.failed .operation-spinner {
  display: grid;
  place-items: center;
  border: 0;
  animation: none;
  color: var(--success-strong);
  font-weight: 750;
}

.operation-status.failed .operation-spinner {
  color: var(--red);
}

.operation-status.success .operation-spinner::before {
  content: "✓";
}

.operation-status.failed .operation-spinner::before {
  content: "!";
}

.operation-status.working::after {
  content: "";
  grid-column: 1 / -1;
  height: 3px;
  border-radius: 999px;
  background-color: var(--accent-soft);
  background-image: linear-gradient(90deg, transparent, var(--accent), transparent);
  background-size: 42% 100%;
  background-repeat: no-repeat;
  animation: operation-progress 1.25s ease-in-out infinite;
}

.operation-button-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.operation-button-content .operation-spinner {
  width: 15px;
  height: 15px;
  border-color: currentColor;
  border-top-color: transparent;
}

@keyframes operation-spin {
  to { transform: rotate(360deg); }
}

@keyframes operation-progress {
  from { background-position: -72% 0; }
  to { background-position: 172% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .operation-spinner,
  .operation-status.working::after {
    animation-duration: 2.5s;
  }
}

@media (max-width: 600px) {
  .operation-status-global {
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
  }
}

/* Mobile sidebar scrim */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 32, .35);
  z-index: 90;
  display: none;
}

.scrim.on {
  display: block;
}

/* =========================================================================
   Login
   ========================================================================= */
.login-view {
  display: grid;
  place-items: center;
  height: 100vh;
  padding: 20px;
  background:
    radial-gradient(1100px 520px at 50% -10%, var(--accent-soft), transparent 60%),
    var(--paper);
}

.login-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 30px 26px;
  width: 380px;
  max-width: 92vw;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-logo {
  width: min(200px, 70%);
  height: auto;
  margin-bottom: 4px;
}

.login-panel h1 {
  font-size: 1.35rem;
}

.login-panel > p {
  color: var(--mut);
  font-size: .86rem;
  margin-bottom: 4px;
}

.login-panel label {
  display: block;
  font-size: .76rem;
  font-weight: 600;
  color: var(--mut);
}

.login-panel button {
  width: 100%;
}

.provider-login-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.provider-login-buttons:empty {
  display: none;
}

/* =========================================================================
   Spec 3 — Home
   ========================================================================= */
.home-greeting-block {
  margin-bottom: 26px;
  order: 1;
}

.home-greeting-block h1 {
  margin-bottom: 4px;
}

.home-section {
  margin-bottom: 30px;
}

.home-search-panel {
  margin-bottom: 24px;
  order: 3;
}

#work-inbox.home-section {
  max-height: none;
  overflow: visible;
}

.workspace.home-context .create-wrap {
  margin-left: auto;
}

.home-wrap {
  display: flex;
  flex-direction: column;
  max-width: 1080px;
}

.home-query {
  order: 2;
  margin-bottom: 34px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-raised);
  box-shadow: var(--shadow);
}

.home-query-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.home-query-head h2 {
  font-size: .92rem;
  color: var(--mut);
}

.home-query-modes {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  flex: none;
}

.drawer-title {
  font-size: .92rem;
  font-weight: 650;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-provider-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.home-query-mode {
  min-width: 68px;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--mut);
  font-size: .8rem;
  font-weight: 600;
}

.home-query-mode:hover,
.home-query-mode.on {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.home-query-mode:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.home-query-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

.home-query-form input#home-query-input {
  min-width: 0;
  min-height: 58px;
  padding: 14px 18px;
  border: 1px solid var(--control-border-hover);
  border-radius: var(--r);
  background: var(--card);
  font-size: 1.02rem;
  box-shadow: inset 0 1px 2px rgba(20, 42, 54, .04);
}

.home-query-form input#home-query-input:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.home-query-form .btn {
  min-width: 96px;
  min-height: 58px;
}

.home-query-scope {
  margin: 8px 2px 0;
  color: var(--faint);
  font-size: .76rem;
}

.home-query-response:not(:empty),
.home-query .home-search-panel:not([hidden]) {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.home-query-response {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.home-query-response .bubble {
  max-width: 88%;
}

.home-attention-head {
  order: 4;
}

.home-attention-list {
  order: 5;
  margin-bottom: 28px;
}

#inbox-view-all:not([hidden]) {
  margin-left: 2px;
}

.home-recent-head {
  order: 6;
}

.home-recent-card {
  order: 7;
}

.home-preserved-section,
.home-preserved-control {
  display: none !important;
}

/* Project status list (spec 3.2) */
.plist .row .t {
  font-family: var(--disp);
}

.plist .row {
  cursor: pointer;
}

/* "View all activity" footer under the activity card */
.tl-foot {
  text-align: center;
  border-top: 1px solid var(--line-soft);
  padding-top: 10px;
  margin-top: 6px;
}

.tl-foot .btn {
  font-size: .8rem;
}

/* =========================================================================
   Spec 4 — Project page
   ========================================================================= */
.project-view {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.workspace-head,
.phead {
  padding: 22px 28px 0;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  flex: none;
}

.titleline {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.titleline h1,
.titleline h2 {
  min-width: 0;
  font-family: var(--disp);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -.01em;
}

.project-header-actions {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.project-subline {
  margin-top: 4px;
  font-size: .8rem;
}

.project-subline:empty {
  display: none;
}

.menu-note {
  padding: 6px 12px;
  font-size: .74rem;
}

.menu-note:empty {
  display: none;
}

.project-chips {
  display: flex;
  gap: 8px;
  margin: 10px 0 16px;
  align-items: center;
  flex-wrap: wrap;
}

.project-chips:empty {
  margin: 4px 0 12px;
}

.project-query {
  max-width: 960px;
  margin: 6px 0 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--paper);
}

.project-query-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}

.project-query-head h2 {
  font-size: .94rem;
  font-weight: 650;
}

.project-query .home-query-form input#project-query-input {
  min-width: 0;
  min-height: 44px;
  padding: 10px 14px;
  border: 0;
  box-shadow: none;
  background: transparent;
  font-size: .94rem;
}

.project-query .home-query-form .btn {
  min-width: 88px;
  min-height: 44px;
}

.project-query .home-query-mode {
  min-width: 60px;
  padding: 5px 10px;
}

.project-query .home-query-scope {
  margin-top: 4px;
}

.project-query .home-query-form:focus-within {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.project-query .home-query-response:empty {
  display: none;
}

.project-query .home-search-panel {
  margin-top: 12px;
}

.project-view:not([data-active-tab="overview"]) .project-query {
  max-width: none;
  min-height: 48px;
  margin: 4px 0 10px;
  padding: 3px 7px;
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr);
  align-items: center;
  gap: 7px;
  background: var(--surface-subtle);
}

.project-view:not([data-active-tab="overview"]) .project-query-head {
  margin: 0;
}

.project-view:not([data-active-tab="overview"]) .project-query-head h2,
.project-view:not([data-active-tab="overview"]) .project-query > .home-query-scope,
.project-view:not([data-active-tab="overview"]) .project-query > .home-query-response {
  display: none;
}

.project-view:not([data-active-tab="overview"]) .project-query .home-query-form {
  min-width: 0;
}

.project-view:not([data-active-tab="overview"]) .project-query .home-query-form input#project-query-input,
.project-view:not([data-active-tab="overview"]) .project-query .home-query-form .btn {
  min-height: 36px;
}

.project-view:not([data-active-tab="overview"]) .project-query .home-query-form .btn {
  min-width: 72px;
}

.project-view:not([data-active-tab="overview"]) .project-query .home-search-panel {
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 2px;
}

/* Ask/Search is an entry point. Once the Assistant conversation is open,
   keep only the label and explicit mode switch; selecting Search restores
   the deterministic search field. */
.workspace.assistant-open .home-query[data-query-mode="ask"],
.workspace.assistant-open .project-view[data-active-tab="overview"] .project-query[data-query-mode="ask"] {
  margin-bottom: 18px;
  padding: 9px 12px;
  background: var(--surface-subtle);
  border-color: var(--line-soft);
  box-shadow: none;
}

.workspace.assistant-open .home-query[data-query-mode="ask"] .home-query-head,
.workspace.assistant-open .project-view[data-active-tab="overview"] .project-query[data-query-mode="ask"] .project-query-head {
  margin-bottom: 0;
}

.workspace.assistant-open .home-query[data-query-mode="ask"] > .home-query-form,
.workspace.assistant-open .home-query[data-query-mode="ask"] > .home-query-scope,
.workspace.assistant-open .home-query[data-query-mode="ask"] > .home-query-response,
.workspace.assistant-open .project-view[data-active-tab="overview"] .project-query[data-query-mode="ask"] > .home-query-form,
.workspace.assistant-open .project-view[data-active-tab="overview"] .project-query[data-query-mode="ask"] > .home-query-scope,
.workspace.assistant-open .project-view[data-active-tab="overview"] .project-query[data-query-mode="ask"] > .home-query-response {
  display: none;
}

.workspace.assistant-open .home-query[data-query-mode="ask"] h2::after,
.workspace.assistant-open .project-view[data-active-tab="overview"] .project-query[data-query-mode="ask"] h2::after {
  display: none;
  content: " · Conversation open";
  color: var(--faint);
  font-weight: 500;
}

.project-team-chat {
  position: relative;
}

.project-team-chat .pip {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
}

.project-menu-wrap {
  position: relative;
}

.project-tabs,
.tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.project-tabs::-webkit-scrollbar,
.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  font-weight: 600;
  font-size: .88rem;
  color: var(--mut);
  border-bottom: 2px solid transparent;
  border-radius: 6px 6px 0 0;
  white-space: nowrap;
}

.tab:hover {
  color: var(--ink);
  background: var(--paper);
}

.tab.active,
.tab.on {
  color: var(--accent-strong);
  border-bottom-color: var(--accent-strong);
}

.project-shell {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 28px;
  scroll-behavior: smooth;
}

.tab-panels {
  width: 100%;
  max-width: none;
  margin: 0;
}

.tab-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--red-soft);
  color: var(--red);
  font-size: .68rem;
  line-height: 1;
}

.tab-badge[hidden],
.tab-badge.hidden {
  display: none;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  width: 100%;
}

/* Overview (spec 4.1) */
.ov-grid,
.overview-row {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(420px, .8fr);
  gap: 16px;
  margin-bottom: 16px;
}

.ov-grid .full,
.overview-row .full {
  grid-column: 1 / -1;
}

@media (min-width: 1101px) {
  .ov-grid.attention-empty {
    grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
    align-items: start;
  }
}

.overview-attention-card.is-empty {
  padding-block: 13px;
}

.overview-attention-card.is-empty .section-head {
  margin-bottom: 2px;
}

.overview-attention-card.is-empty .section-head h2 {
  font-size: .88rem;
}

.overview-attention-empty-state {
  border-bottom: 0 !important;
  padding: 4px 0 !important;
  color: var(--mut);
  font-size: .8rem;
}

.overview-summary,
.project-brief {
  margin-bottom: 16px;
}

.project-brief > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.project-brief > summary::-webkit-details-marker {
  display: none;
}

.project-brief > summary::after {
  content: "›";
  margin-left: auto;
  color: var(--mut);
  transform: rotate(90deg);
  transition: transform .16s ease;
}

.project-brief:not([open]) > summary::after {
  transform: rotate(0);
}

.project-brief > summary > span:nth-child(2) {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.project-brief-content {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 0 16px 16px 58px;
}

.project-preserved-section {
  display: none !important;
}

.project-view .overview-summary,
.project-view .ov-grid,
.project-view .overview-previews,
.project-view .files-browser-layout,
.project-view .mail-workspace,
.project-view .work-browser-layout {
  width: 100%;
  max-width: none;
}

.ai-strip {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.ai-strip-body {
  flex: 1;
  min-width: 0;
}

.ai-strip .btn {
  flex: none;
}

.overview-summary {
  margin-bottom: 16px;
}

/* The "Recent mail and documents" fold reuses the Advanced disclosure look. */
.overview-previews {
  margin-top: 0;
  border-top: none;
}

.overview-previews summary {
  font-size: .86rem;
}

.overview-preview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, .85fr);
  gap: 18px;
  margin-top: 12px;
  align-items: start;
}

.overview-preview-grid > div {
  min-width: 0;
}

#overview-emails .overview-list-row,
#overview-documents .overview-list-row {
  min-width: 0;
}

#overview-emails .overview-list-title,
#overview-documents .overview-list-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#overview-documents .overview-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

#overview-documents .overview-list-row .meta {
  min-width: 0;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Open-items rows link onward to the tab that owns them. */
#overview-actions li[data-goto-tab] {
  cursor: pointer;
}

#overview-actions li:not([data-goto-tab]) {
  cursor: default;
}

#overview-actions li[data-goto-tab]:hover .tlt {
  color: var(--accent-strong);
}

.ai-strip .spark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  display: grid;
  place-items: center;
  flex: none;
}

.ai-badge {
  font-size: .66rem;
  font-weight: 600;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 20px;
  padding: 1px 8px;
  vertical-align: middle;
  font-family: var(--ui);
}

.overview-summary-body {
  font-size: .88rem;
  color: var(--mut);
  line-height: 1.55;
}

.ai-meta {
  margin-top: 8px;
}

.project-system-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

/* Files (spec 4.2) */
.files-browser-layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(720px, 1fr);
  gap: 16px;
  align-items: start;
}

.files-grid {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(640px, 1fr);
  gap: 16px;
  align-items: start;
}

.tab-panel[data-panel="files"].active .file-drop-zone {
  max-width: none;
}

.file-drop-zone,
.dropzone {
  border: 1.5px dashed var(--accent-mid);
  background: var(--accent-soft);
  border-radius: var(--r);
  padding: 11px 16px;
  color: var(--accent-strong);
  font-size: .83rem;
  font-weight: 500;
  text-align: center;
  margin-bottom: 16px;
  cursor: pointer;
  display: block;
}

.file-drop-zone strong {
  display: block;
  font-weight: 600;
}

.file-drop-zone span {
  font-size: .76rem;
  opacity: .85;
}

.file-drop-zone input[type='file'] {
  display: none;
}

.file-drop-zone.drag-over {
  border-color: var(--accent-strong);
  background: var(--accent-mid);
}

.file-drop-zone.uploading {
  opacity: .6;
}

.flist,
.fdetail,
.file-details-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.flist {
  max-height: calc(100vh - 280px);
  overflow: auto;
}

.file-details-panel {
  padding: 16px;
}

.fitem {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-weight: 500;
  font-size: .89rem;
}

.fitem:last-child {
  border-bottom: none;
}

.fitem:hover {
  background: var(--paper);
}

.fitem.on,
.fitem.selected {
  background: var(--accent-soft);
}

.fitem .fico {
  color: var(--amber);
  flex: none;
}

.fitem .n {
  font-family: var(--mono);
  color: var(--faint);
  font-size: .76rem;
  width: 20px;
  flex: none;
}

.ftree-node {
  min-width: 0;
}

.ftree-children {
  margin: 0;
}

.fitem.tree-item {
  display: grid;
  grid-template-columns: 14px 2.5ch 15px minmax(0, 1fr);
  column-gap: 8px;
  padding-left: calc(12px + (var(--depth, 0) * 18px));
}

.fitem.tree-item .twisty {
  width: 14px;
  color: var(--mut);
  font-size: .75rem;
}

.fitem.tree-item .n {
  width: auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.fitem.tree-item .fico {
  width: 15px;
  min-width: 15px;
}

.fitem.tree-item .tree-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Pinned Notes entry above the numbered folders (spec 4.2) */
.fitem.notes,
.fitem.notes .fico {
  color: var(--accent-strong);
}

.fitem.notes {
  border-bottom: 2px solid var(--line);
}

.fdrow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: .87rem;
  width: 100%;
  text-align: left;
}

.fdrow:last-child {
  border-bottom: none;
}

.fdrow:hover {
  background: var(--paper);
}

.fdrow.selected {
  background: var(--accent-soft);
}

.fdhead {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ftag {
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--accent-strong);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 5px;
  flex: none;
  width: 104px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ftag.pending {
  color: var(--amber);
  background: var(--amber-soft);
}

.ftag.missing {
  color: var(--faint);
  background: var(--paper);
}

.files-detail-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(420px, 560px);
  gap: 0;
  align-items: start;
}

.fdetail .data-list {
  display: block;
}

.fdrow .file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  padding: 0;
  border: none;
  background: none;
  text-align: left;
  font-weight: 400;
  font-size: .87rem;
  justify-content: flex-start;
}

.fdrow .fname {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-type-badge {
  width: 38px;
  min-width: 38px;
  height: 24px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  color: var(--mut);
  border: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: 0;
}

.file-type-badge.pdf {
  background: #fee2e2;
  color: #991b1b;
}

.file-type-badge.doc {
  background: #dbeafe;
  color: #1e3a8a;
}

.file-type-badge.sheet {
  background: #dcfce7;
  color: #166534;
}

.file-type-badge.slide {
  background: #ffedd5;
  color: #9a3412;
}

.file-type-badge.image {
  background: #f3e8ff;
  color: #6b21a8;
}

.file-type-badge.archive {
  background: #fef3c7;
  color: #92400e;
}

.file-type-badge.cad {
  background: #e0f2fe;
  color: #075985;
}

.file-type-badge.mail {
  background: #e0e7ff;
  color: #3730a3;
}

.file-type-badge.text {
  background: #ecfeff;
  color: #155e75;
}

.fdrow .fsize {
  width: 82px;
  flex: none;
  color: var(--faint);
  font-family: var(--mono);
  font-size: .72rem;
  text-align: right;
  white-space: nowrap;
}

.fdrow .acts {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity .12s;
  flex: none;
}

.file-sort-row {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--card);
  padding-top: 8px;
  padding-bottom: 8px;
}

.file-sort-button {
  border: 0;
  background: transparent;
  color: var(--faint);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 3px 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-align: left;
}

.file-sort-button:hover,
.file-sort-button.active {
  color: var(--accent-strong);
}

.file-sort-button[data-file-sort="name"] {
  flex: 1;
  min-width: 0;
}

.file-sort-button[data-file-sort="type"] {
  width: 50px;
  flex: none;
}

.file-sort-button[data-file-sort="size"] {
  width: 82px;
  justify-content: flex-end;
}

.file-sort-button[data-file-sort="modified"] {
  width: 70px;
  justify-content: flex-start;
}

.file-sort-index {
  width: 104px;
  flex: none;
  color: var(--faint);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  text-align: center;
}

.file-sort-actions {
  width: 44px;
  flex: none;
}

.sort-arrow {
  min-width: 10px;
  font-size: .78rem;
}

.fdrow:hover .acts,
.fdrow:focus-within .acts {
  opacity: 1;
}

.file-details-panel {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 104px);
  overflow: auto;
  border: none;
  border-left: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

.file-details-panel .empty-state {
  padding: 12px 16px;
}

.notes-foot {
  padding: 10px 16px;
  font-size: .78rem;
  border-top: 1px solid var(--line-soft);
}

#note-form {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
}

/* Mail (spec 4.3) */
.mail-workspace {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.mail-approval-panel {
  position: sticky;
  top: 18px;
  align-self: start;
  padding: 16px;
}

.mail-approval-panel .section-head {
  margin-bottom: 10px;
}

.compact-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.compact-email-action {
  padding: 10px 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface);
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.approval-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 10px;
  width: 100%;
  padding: 2px 10px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  border-radius: 6px;
}

.approval-summary:hover {
  background: var(--paper);
}

.approval-from {
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.approval-subject {
  grid-column: 1 / -1;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.approval-date {
  color: var(--faint);
  font-family: var(--mono);
  font-size: .72rem;
  white-space: nowrap;
}

.approval-suggestion {
  padding: 0 10px;
  margin: 0;
  font-size: .76rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.approval-category {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  color: var(--mut);
  font-size: .76rem;
}

.approval-category select {
  min-width: 0;
  width: 100%;
  height: 32px;
  font-size: .82rem;
}

.compact-email-action .classification-box {
  padding: 8px;
}

.compact-email-action .classification-candidate {
  align-items: flex-start;
  flex-direction: column;
}

.compact-email-action .row-actions {
  justify-content: flex-end;
  padding: 0 10px;
  margin-top: 0;
}

.mail-filing-toggle {
  cursor: pointer;
  gap: 7px;
}

.mail-rules-line {
  margin-top: 10px;
  font-size: .8rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mail-rules-line a {
  font-weight: 600;
  cursor: pointer;
}

.mailrow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-soft);
  font-size: .87rem;
  width: 100%;
  text-align: left;
}

.mailrow:last-child {
  border-bottom: none;
}

.mailrow:hover {
  background: var(--paper);
}

.dir,
.direction-badge {
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .05em;
  padding: 2px 8px;
  border-radius: 5px;
  flex: none;
  text-transform: uppercase;
  background: var(--paper);
  color: var(--mut);
}

.dir.in,
.direction-badge.in,
.direction-badge.incoming {
  background: var(--blue-soft);
  color: var(--blue);
}

.dir.out,
.direction-badge.out,
.direction-badge.outgoing {
  background: var(--data-outgoing-soft);
  color: var(--data-outgoing);
}

.mailrow .who {
  width: clamp(150px, 18vw, 240px);
  flex: none;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mailrow .subj {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mailrow .fold {
  flex: none;
}

.mailrow .d {
  font-family: var(--mono);
  font-size: .73rem;
  color: var(--faint);
  flex: none;
  width: 64px;
  text-align: right;
}

.clip,
.attachment-icon {
  color: var(--faint);
  flex: none;
}

.mail-group-row {
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 10px 18px 4px;
  background: var(--paper);
  border-bottom: 1px solid var(--line-soft);
}

/* Work (spec 4.4) */
.work-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 0;
  margin-bottom: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--surface-subtle);
  color: var(--mut);
  font-size: .8rem;
}

.filing-retry-note {
  margin: 4px 10px 0;
  color: var(--amber);
  font-size: .76rem;
  line-height: 1.4;
}

.filing-retry-label {
  color: var(--amber);
  font-weight: 700;
}

.queue-filing-retry {
  align-items: center;
}

.attention-filing-retry-note {
  margin: 0 0 10px;
  padding: 9px 11px;
  border: 1px solid var(--amber-soft);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--amber-soft) 58%, var(--surface));
}

.work-summary > span {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
}

.work-summary > span + span::before {
  content: "·";
  margin: 0 9px;
  color: var(--faint);
}

.work-summary strong {
  color: var(--ink);
  font-weight: 700;
}

.work-summary .over,
.work-summary .over strong {
  color: var(--red);
}

.work-summary:not([hidden]) + .section-head #work-count {
  display: none;
}

.work-browser-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
  gap: 18px;
  align-items: start;
}

/* Grid panes must shrink with their workspace, not their content's minimum width. */
.mail-workspace > *,
.work-browser-layout > * {
  min-width: 0;
}

.work-details-panel {
  min-width: 0;
  padding: 20px;
  position: sticky;
  top: 88px;
}

.wrow[data-work-task] {
  cursor: pointer;
}

.wrow {
  display: grid;
  grid-template-columns: 58px minmax(92px, 140px) minmax(200px, 1fr) 104px max-content;
  align-items: center;
  column-gap: 10px;
  row-gap: 6px;
  min-width: 0;
}

.wrow .body {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.wrow .t,
.wrow .m {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wrow .t {
  display: block;
  white-space: nowrap;
  font-weight: 650;
}

.wrow .m {
  display: block;
  white-space: nowrap;
  color: var(--mut);
}

.wrow .when {
  justify-self: end;
  white-space: nowrap;
  min-width: 0;
  text-align: right;
}

.wrow.on {
  background: var(--accent-soft);
}

.wrow .type {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 5px;
  flex: none;
}

.type.task {
  background: var(--success-soft);
  color: var(--success-strong);
}

.type.pack {
  background: var(--blue-soft);
  color: var(--blue);
}

.type.deliv {
  background: var(--amber-soft);
  color: var(--amber);
}

.check {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--line);
  border-radius: 5px;
  flex: none;
  display: grid;
  place-items: center;
  color: transparent;
  background: var(--card);
}

.check:hover {
  border-color: var(--accent-strong);
}

.wrow.done .check {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.progress-track {
  height: 5px;
  border-radius: 3px;
  background: var(--line-soft);
  overflow: hidden;
  width: 70px;
  flex: none;
}

.progress-fill {
  height: 100%;
  background: var(--success);
}

.chip-progress {
  font-family: var(--mono);
  font-size: .72rem;
}

.work-filter-wrap {
  position: relative;
}

#work-filter-menu {
  min-width: 280px;
  padding: 14px;
  max-height: 50dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#work-filter-menu .task-filter-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 0;
}

.wrow .acts {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity .12s;
  flex: none;
}

.wrow:hover .acts,
.wrow:focus-within .acts {
  opacity: 1;
}

.work-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.work-detail-head > div:first-child {
  min-width: 0;
}

.work-detail-head h3 {
  margin: 8px 0 0;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.work-detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  justify-content: center;
  width: 64px;
}

.work-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}

.work-detail-grid dt {
  color: var(--faint);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.work-detail-grid dd {
  margin: 3px 0 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.work-detail-section {
  border-top: 1px solid var(--line-soft);
  padding-top: 14px;
  margin-top: 14px;
}

.work-detail-section h4 {
  margin: 0 0 8px;
}

.file-link-button {
  display: inline-flex;
  width: auto;
  text-decoration: none;
}

@media (max-width: 1100px) {
  .work-browser-layout {
    grid-template-columns: 1fr;
  }

  .work-details-panel {
    position: static;
  }
}

/* Secondary finance figures fold under the four prominent KPIs (spec 4.5). */
.finance-secondary {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line-soft);
  padding-top: 10px;
}

.finance-secondary summary {
  cursor: pointer;
  font-size: .8rem;
  font-weight: 600;
  color: var(--mut);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.finance-secondary summary::-webkit-details-marker {
  display: none;
}

.finance-secondary summary::before {
  content: '▸';
  font-size: .72rem;
  transition: transform .15s;
}

.finance-secondary[open] summary::before {
  transform: rotate(90deg);
}

.finance-secondary .finance-summary-grid {
  margin-top: 12px;
  margin-bottom: 0;
}

/* An unclassified index status should read neutral, not "indexed". */
.ftag.index-unknown,
.ftag.index-none {
  color: var(--faint);
  background: var(--paper);
}

.ftag.index-pending,
.ftag.index-queued {
  color: var(--amber);
  background: var(--amber-soft);
}

.ftag.index-error,
.ftag.index-failed {
  color: var(--red);
  background: var(--red-soft);
}

/* Finance cashbook fold sits below the details card. */
.ledger-fold {
  margin-top: 16px;
  border-top: 1px solid var(--line);
}

.ledger-fold summary {
  font-size: .9rem;
  font-family: var(--disp);
}

/* Finance (spec 4.5) */
.setup {
  padding: 34px;
  text-align: center;
}

.setup .big {
  font-family: var(--disp);
  font-weight: 600;
  font-size: 1.05rem;
  margin: 12px 0 6px;
}

.setup .sub {
  max-width: 380px;
  margin: 0 auto 16px;
}

.finance-notes-text {
  font-size: .84rem;
  color: var(--mut);
  margin-top: 10px;
  grid-column: 1 / -1;
}

.finance-status-line {
  font-size: .8rem;
  color: var(--faint);
  margin-top: 8px;
}

/* =========================================================================
   Spec 5 — Settings
   ========================================================================= */
.set-grid {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 26px;
  align-items: start;
}

.snav-label {
  font-family: var(--mono);
  font-size: .64rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 14px 10px 6px;
}

.snav {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-weight: 500;
  color: var(--mut);
  font-size: .88rem;
}

.snav:hover {
  background: var(--card);
  color: var(--ink);
}

.snav.on {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

.spanel {
  display: none;
}

.spanel.on {
  display: block;
}

.set-card {
  margin-bottom: 16px;
  padding: 18px;
}

.set-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.set-head h2,
.set-head h3 {
  margin: 0;
}

.urow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: .87rem;
  flex-wrap: wrap;
}

.urow:last-child {
  border-bottom: none;
}

.atabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.apanel {
  display: none;
}

/* app.js's setAdminTab marks the live panel with .active; the prototype uses
   .on. Accept both so either path shows the panel. */
.apanel.on,
.apanel.active {
  display: block;
}

.ev {
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--faint);
  background: var(--paper);
  border: 1px solid var(--line-soft);
  padding: 1px 7px;
  border-radius: 5px;
}

.ckrow {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}

.ckrow:last-of-type {
  border-bottom: none;
}

.ckrow input {
  margin-top: 3px;
}

.ckrow b {
  font-size: .87rem;
  font-weight: 600;
}

.settings-info-grid,
.compact-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.settings-info-grid article {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 12px 14px;
}

.settings-info-grid strong {
  font-size: .82rem;
  display: block;
  margin-bottom: 3px;
}

.settings-panel-help {
  color: var(--mut);
  font-size: .86rem;
  line-height: 1.45;
  margin: 0 0 14px;
}

.danger-note {
  border: 1px solid rgba(171, 44, 44, .24);
  background: rgba(171, 44, 44, .07);
  border-radius: var(--r-sm);
  padding: 12px 14px;
}

.danger-note strong {
  display: block;
  color: var(--red);
  margin-bottom: 4px;
}

.danger-note p {
  margin: 0;
  color: var(--mut);
  line-height: 1.45;
}

.settings-inline-action {
  display: flex;
  align-items: center;
  gap: 10px;
  grid-column: 1 / -1;
}

/* =========================================================================
   Dialogs / modals
   ========================================================================= */
dialog {
  background: var(--card);
  border: none;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 0;
  max-width: 92vw;
  max-height: 90vh;
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(16, 24, 32, .35);
}

.project-form {
  padding: 22px;
  width: 560px;
  max-width: 100%;
  max-height: 86vh;
  overflow-y: auto;
}

.members-dialog-body,
.project-settings-dialog-body,
.admin-dialog-content,
.weaviate-dialog-content,
.mailbox-import-form,
.global-settings-form {
  width: 860px;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.dialog-head h2 {
  font-size: 1.15rem;
}

.dialog-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 8px;
}

.dialog-tab {
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 500;
  font-size: .82rem;
  color: var(--mut);
}

.dialog-tab:hover {
  background: var(--paper);
}

.dialog-tab.active {
  background: var(--ink);
  color: #fff;
}

.members-panel,
.project-settings-panel {
  display: none;
}

.members-panel.active,
.project-settings-panel.active {
  display: block;
}

/* =========================================================================
   Legacy component styling — markup rendered by app.js, mapped onto the new
   tokens so no existing feature loses its shape (spec 0.1).
   ========================================================================= */
.data-list {
  display: flex;
  flex-direction: column;
}

.data-list > p {
  color: var(--faint);
  font-size: .85rem;
  padding: 14px 0;
}

.data-item {
  border-bottom: 1px solid var(--line-soft);
  padding: 11px 0;
  font-size: .87rem;
}

.data-item:last-child {
  border-bottom: none;
}

.data-item strong {
  font-weight: 600;
}

.data-item small,
.data-item .meta {
  color: var(--faint);
  font-size: .76rem;
}

/* Clickable rows produced by app.js */
.cockpit-item,
.home-project-row,
.overview-action,
.overview-list-row,
.commercial-project-row,
.work-inbox-main,
.email-row,
.email-action,
.note-row,
.planning-row,
.deliverable-row,
.opportunity-row,
.index-row,
.storage-browser-row,
.mailbox-import-row,
.member-card,
.external-card,
.access-card,
.keyword-item,
.admin-user-row,
.admin-group-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border: none;
  border-bottom: 1px solid var(--line-soft);
  font-size: .87rem;
  background: none;
  color: inherit;
  border-radius: 0;
  font-weight: 400;
  justify-content: flex-start;
  white-space: normal;
}

.cockpit-item:hover,
.home-project-row:hover,
.overview-action:hover,
.overview-list-row:hover,
.commercial-project-row:hover,
.work-inbox-main:hover,
.email-row:hover,
.note-row:hover,
.planning-row:hover,
.deliverable-row:hover,
.opportunity-row:hover,
.index-row:hover,
.storage-browser-row:hover,
.mailbox-import-row:hover,
.member-card:hover,
.admin-user-row:hover,
.admin-group-row:hover {
  background: var(--paper);
}

.cockpit-item strong,
.home-project-row strong,
.overview-action strong,
.overview-list-row strong,
.work-inbox-main strong,
.opportunity-row strong,
.planning-row strong,
.deliverable-row strong {
  font-weight: 600;
}

.access-status-line {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 3px;
}

.access-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--mut);
  background: var(--paper);
  font-size: .7rem;
  font-weight: 600;
  padding: 1px 7px;
}

.access-pill.ok,
.access-pill.active,
.access-pill.owner {
  color: var(--success-strong);
  background: var(--success-soft);
  border-color: var(--success-mid);
}

.access-pill.link_sent,
.access-pill.unknown {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #ead4a6;
}

.access-pill.failed,
.access-pill.revoked {
  color: var(--red);
  background: var(--red-soft);
  border-color: #edcdc6;
}

.access-detail {
  margin-top: 4px;
  max-width: 720px;
}

.access-detail summary {
  color: var(--accent-strong);
  cursor: pointer;
  font-size: .76rem;
  font-weight: 700;
  list-style-position: inside;
}

.access-detail .meta {
  margin-top: 3px;
  white-space: pre-wrap;
  word-break: break-word;
}

.cockpit-item,
.overview-action {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.cockpit-item span,
.cockpit-item small {
  color: var(--faint);
  font-size: .76rem;
}

.cockpit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.cockpit-tile-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.cockpit-tile-head h3 {
  flex: 1;
}

.cockpit-badge {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--faint);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1px 8px;
}

.cockpit-badge.has-items {
  background: var(--red-soft);
  border-color: #EDCDC6;
  color: var(--red);
}

.hp-main,
.member-main,
.email-action-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.action-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.action-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .74rem;
  font-weight: 600;
  color: var(--mut);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 4px;
}

.action-group-head span:last-child {
  font-family: var(--mono);
  color: var(--faint);
  font-weight: 400;
  letter-spacing: 0;
}

.overview-action.is-overdue strong {
  color: var(--red);
}

.overview-list-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.commercial-project-list {
  display: flex;
  flex-direction: column;
  margin-top: 12px;
}

.commercial-project-row {
  justify-content: space-between;
}

.commercial-project-row > span:first-child {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.commercial-project-row small,
.opportunity-row small,
.member-card small {
  color: var(--faint);
  font-size: .74rem;
}

.work-inbox-item {
  border-bottom: 1px solid var(--line-soft);
  padding: 4px 0 10px;
}

.work-inbox-item:last-child {
  border-bottom: none;
}

.work-inbox-main {
  flex-wrap: wrap;
  align-items: center;
}

.work-inbox-item .row-actions {
  padding: 0 14px;
}

/* Mail table (legacy list) */
.mail-table {
  display: flex;
  flex-direction: column;
}

.mail-table-head {
  display: none;
}

.mail-table-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mail-icon-col {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.mail-party {
  width: 140px;
  flex: none;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mail-party strong {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-party small,
.mail-subject small {
  color: var(--faint);
  font-size: .72rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-subject {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.mail-subject strong {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mailbox-party-select {
  min-width: 126px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: .8rem;
}

.mail-date {
  font-family: var(--mono);
  font-size: .73rem;
  color: var(--faint);
  flex: none;
}

.mail-attachments {
  display: none;
}

.mail-status {
  font-size: .72rem;
  color: var(--faint);
  flex: none;
}

.mail-action-summary,
.mail-action-meta {
  font-size: .8rem;
  color: var(--mut);
  margin-bottom: 12px;
}

/* Keyword lists */
.keyword-list {
  display: flex;
  flex-direction: column;
  margin-top: 10px;
}

.keyword-item {
  justify-content: space-between;
}

.mail-rule-form,
.admin-inline-form,
.inline-form,
.estimate-form,
.task-filter-form,
.mailbox-import-toolbar,
.admin-member-form,
.admin-permission-form,
.admin-tenant-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 12px;
}

.mail-rule-form input,
.admin-inline-form input,
.inline-form input {
  flex: 1;
  min-width: 160px;
}

.task-filter-form label,
.mailbox-import-toolbar label {
  margin-bottom: 0;
}

.mailbox-import-toolbar > label {
  flex: 1 1 180px;
  min-width: 150px;
}

.mailbox-import-toolbar > label:first-child {
  flex-basis: 100%;
}

.mailbox-import-form {
  width: min(1120px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
}

.mailbox-import-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 300px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--card);
}

.mailbox-import-workspace.preview-open {
  grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr);
}

.mailbox-import-workspace .mailbox-import-list {
  max-height: 440px;
}

.mailbox-import-row {
  cursor: pointer;
}

.mailbox-import-row.project-known {
  background: color-mix(in srgb, var(--accent-soft) 44%, var(--card));
  box-shadow: inset 3px 0 0 var(--accent-strong);
}

.mailbox-import-row.project-known:hover {
  background: var(--paper);
}

.mailbox-project-state {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 25px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--mut);
  font-size: .72rem;
  font-weight: 650;
  white-space: nowrap;
}

.mailbox-project-state.success {
  background: var(--success-soft);
  color: var(--success-strong);
}

.mailbox-project-state.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.mailbox-project-state.available {
  min-height: 21px;
  padding: 2px 7px;
  border: 1px solid var(--line-soft);
  background: transparent;
  color: var(--faint);
  font-weight: 500;
}

.mailbox-project-state.compact {
  justify-content: center;
  width: 24px;
  min-height: 24px;
  padding: 0;
}

.mailbox-project-state-placeholder {
  color: var(--faint);
}

.mailbox-import-subject-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  overflow: visible;
}

.mailbox-import-status-filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 auto 0 0;
  color: var(--mut);
  font-size: .78rem;
  white-space: nowrap;
}

.mailbox-import-status-filter input {
  width: auto;
  margin: 0;
}

.mailbox-import-status-filter + #mailbox-import-count {
  margin-left: 0;
}

.mailbox-import-row.active {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent-strong);
}

.mailbox-import-row:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: -2px;
}

.mailbox-import-preview {
  max-height: 440px;
  overflow-y: auto;
  border-left: 1px solid var(--line-soft);
  background: var(--card);
  padding: 16px;
}

.mailbox-import-preview[hidden] {
  display: none;
}

.mailbox-preview-toolbar,
.mailbox-preview-navigation,
.mailbox-preview-classification,
.mailbox-preview-select {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mailbox-preview-toolbar {
  justify-content: space-between;
  margin-bottom: 16px;
}

.mailbox-preview-head h3 {
  margin: 8px 0 14px;
  font-size: 1.05rem;
  line-height: 1.35;
}

.mailbox-preview-meta {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
}

.mailbox-preview-meta > div {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px;
}

.mailbox-preview-meta dt {
  color: var(--faint);
  font-size: .75rem;
  font-weight: 600;
}

.mailbox-preview-meta dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: .82rem;
}

.mailbox-preview-classification {
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.mailbox-preview-project-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper);
}

.mailbox-preview-project-state.success {
  border-color: var(--success-mid);
  background: var(--success-soft);
}

.mailbox-preview-project-state.warning {
  border-color: var(--amber-soft);
  background: var(--amber-soft);
}

.mailbox-preview-project-state > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.mailbox-preview-project-state small {
  overflow: hidden;
  color: var(--mut);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mailbox-preview-classification > label:first-child {
  min-width: 150px;
  margin: 0;
}

.mailbox-preview-classification small {
  flex: 1 1 150px;
  color: var(--faint);
}

.mailbox-preview-select {
  margin: 0 0 6px;
  white-space: nowrap;
}

.mailbox-preview-body {
  min-height: 120px;
  margin-top: 14px;
  padding: 14px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--surface-subtle);
  color: var(--ink);
  font-family: var(--sans);
  font-size: .85rem;
  line-height: 1.55;
}

.mailbox-preview-state {
  display: grid;
  gap: 10px;
  padding: 24px 8px;
}

.mailbox-preview-state p {
  color: var(--mut);
}

.mailbox-import-custom-dates {
  display: flex;
  gap: 8px;
  flex: 1 1 300px;
}

.mailbox-import-custom-dates[hidden] {
  display: none;
}

.mailbox-import-custom-dates label {
  flex: 1;
}

.mailbox-import-filters {
  flex: 1 1 100%;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--surface-subtle);
}

.mailbox-import-filters > summary {
  cursor: pointer;
  padding: 8px 10px;
  color: var(--mut);
  font-size: .8rem;
  font-weight: 600;
}

.mailbox-import-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 0 10px 10px;
}

.mailbox-import-filter-grid label {
  min-width: 0;
}

.mailbox-import-filter-grid .mailbox-import-check-filter {
  display: flex;
  align-items: center;
  align-self: end;
  flex-direction: row;
  gap: 8px;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--card);
}

.mailbox-import-check-filter input {
  flex: none;
  margin: 0;
}

#mailbox-import-load-older {
  margin-left: auto;
}

.approval-panel,
.ledger-panel,
.estimate-panel,
.access-section {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}

.mail-keyword-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Form grids used by the project tabs */
.task-form,
.planning-form,
.deliverable-form,
.finance-form,
.acquisition-form,
.ledger-form,
.time-entry-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.note-form,
.task-form {
  grid-template-columns: 1fr;
}

.task-form-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.planning-wide,
.deliverable-wide,
.acquisition-wide,
.ledger-wide,
.time-entry-wide,
.finance-notes,
.estimate-wide,
.file-detail-wide,
.finance-actions,
.acquisition-actions {
  grid-column: 1 / -1;
}

/* Time registration: one shared editor and a fast weekly working surface. */
.time-workspace {
  display: grid;
  align-content: start;
  gap: 12px;
}

.time-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 8px;
}

.time-page-head h1,
.time-page-head h2 {
  margin: 0;
}

.compact-section-head {
  margin-bottom: 2px;
}

.time-page-actions,
.time-week-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.time-week-toolbar {
  align-items: center;
  margin-bottom: 4px;
}

.time-week-toolbar strong {
  margin-left: 6px;
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
}

.time-summary-strip {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.time-summary-strip > span {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 2px 0;
}

.time-summary-strip small {
  color: var(--faint);
  white-space: nowrap;
}

.time-summary-strip strong {
  font-size: .96rem;
  font-variant-numeric: tabular-nums;
}

.weekly-timesheet {
  min-width: 0;
}

.time-view-switch,
.time-report-detail-switch {
  display: inline-flex;
  width: fit-content;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft, #f3f6f6);
}

.time-view-switch {
  margin: 4px 0 18px;
}

.time-view-switch button,
.time-report-detail-switch button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 8px 16px;
  min-height: 0;
  box-shadow: none;
}

.time-view-switch button.active,
.time-report-detail-switch button.active {
  background: var(--surface, #fff);
  color: var(--ink);
  box-shadow: 0 1px 4px rgb(19 40 43 / 10%);
}

.time-report-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
  width: 100%;
}

.time-report-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius, 12px);
  background: var(--surface, #fff);
  box-shadow: var(--shadow-sm, 0 4px 14px rgb(20 36 39 / 6%));
  min-width: 0;
  width: 100%;
}

.time-report-filters .field {
  min-width: 0;
}

.time-report-filters .field > span,
.time-project-filter > summary > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.time-report-filters input,
.time-report-filters select {
  width: 100%;
}

.time-report-keyword,
.time-project-filter {
  grid-column: span 2;
}

.time-report-filters > button[type="submit"] {
  min-height: 42px;
}

.time-project-filter {
  position: relative;
}

.time-project-filter > summary {
  display: block;
  min-height: 42px;
  padding: 10px 38px 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface, #fff);
  cursor: pointer;
  list-style: none;
}

.time-project-filter > summary::-webkit-details-marker,
.time-export-menu > summary::-webkit-details-marker {
  display: none;
}

.time-project-filter > summary > span {
  position: absolute;
  top: -20px;
  left: 0;
}

.time-project-filter > summary::after {
  content: "⌄";
  position: absolute;
  right: 14px;
  top: 12px;
  color: var(--muted);
}

.time-project-filter-popover {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  width: min(360px, calc(100vw - 40px));
  max-height: 320px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface, #fff);
  box-shadow: var(--shadow-lg, 0 18px 50px rgb(16 34 38 / 16%));
}

.time-project-filter-popover > input {
  position: sticky;
  top: 0;
  z-index: 1;
  margin-bottom: 8px;
  background: var(--surface, #fff);
}

.time-project-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px;
  border-radius: 7px;
  font-size: 13px;
  cursor: pointer;
}

.time-project-check:hover {
  background: var(--surface-soft, #f3f6f6);
}

.time-project-check input {
  width: auto;
  margin-top: 2px;
}

.time-report-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.time-export-menu {
  position: relative;
}

.time-export-menu > summary {
  display: block;
  cursor: pointer;
  list-style: none;
}

.time-export-menu > div {
  position: absolute;
  z-index: 25;
  top: calc(100% + 6px);
  right: 0;
  min-width: 150px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface, #fff);
  box-shadow: var(--shadow-lg, 0 18px 50px rgb(16 34 38 / 16%));
}

.time-export-menu > div button {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.time-export-menu > div button:hover {
  background: var(--surface-soft, #f3f6f6);
}

.time-report-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.time-report-metrics article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface, #fff);
}

.time-report-metrics small {
  display: block;
  color: var(--muted);
  margin-bottom: 5px;
}

.time-report-metrics strong {
  font-size: clamp(20px, 2vw, 28px);
  font-variant-numeric: tabular-nums;
}

.time-report-chart,
.time-report-breakdown,
.time-report-detail {
  padding: 18px;
}

.time-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  min-height: 220px;
  overflow-x: auto;
  padding: 16px 4px 4px;
  border-bottom: 1px solid var(--line);
}

.time-chart-column {
  display: grid;
  grid-template-rows: minmax(160px, 1fr) auto;
  align-items: end;
  justify-items: center;
  gap: 7px;
  min-width: 26px;
  height: 190px;
}

.time-chart-column i {
  align-self: end;
  width: min(20px, 80%);
  min-height: 1px;
  border-radius: 4px 4px 1px 1px;
  background: var(--data-time);
}

.time-chart-column small {
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.time-report-breakdowns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.time-report-breakdown h3 {
  margin: 0 0 14px;
}

.time-breakdown-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(100px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft, #edf1f1);
}

.time-breakdown-row > span,
.time-report-detail td:nth-child(2) {
  min-width: 0;
}

.time-breakdown-row strong,
.time-breakdown-row small,
.time-report-detail td small {
  display: block;
}

.time-breakdown-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.time-breakdown-row small {
  color: var(--muted);
}

.time-breakdown-row i {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft, #eef3f3);
}

.time-breakdown-row i b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--data-time);
}

.time-breakdown-row em {
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.time-report-table-wrap {
  overflow-x: auto;
}

.time-report-detail table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.time-report-detail th,
.time-report-detail td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.time-report-detail th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.time-report-detail td small {
  color: var(--muted);
}

@media (max-width: 1200px) {
  .time-report-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.timesheet-desktop {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
}

.timesheet-desktop table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  table-layout: fixed;
}

.timesheet-desktop th,
.timesheet-desktop td {
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding: 5px 6px;
  text-align: center;
}

.timesheet-desktop td.time-entry-cell {
  padding: 3px;
}

.timesheet-desktop th:first-child {
  width: 220px;
  padding-left: 14px;
  text-align: left;
}

.timesheet-desktop th:last-child,
.timesheet-desktop td:last-child {
  width: 76px;
  border-right: 0;
}

.timesheet-desktop thead th {
  color: var(--mut);
  font-size: .74rem;
  font-weight: 650;
}

.timesheet-desktop thead th span,
.timesheet-desktop thead th small,
.timesheet-desktop tbody th small,
.timesheet-desktop tbody th strong {
  display: block;
}

.timesheet-desktop thead th small,
.timesheet-desktop tbody th small {
  overflow: hidden;
  color: var(--faint);
  font-size: .67rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timesheet-desktop tbody th strong {
  overflow: hidden;
  font-size: .8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.time-cell {
  display: grid;
  place-items: center;
  gap: 1px;
  width: 100%;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.time-cell:not(.has-time) span {
  opacity: 0;
  transition: opacity .12s ease;
}

.time-cell:not(.has-time):hover span,
.time-cell:not(.has-time):focus-visible span {
  opacity: .75;
}

.time-cell:hover,
.time-cell:focus-visible {
  border-color: var(--accent-mid);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.time-cell.has-time {
  background: var(--surface-subtle);
  color: var(--ink);
  font-weight: 650;
}

.time-cell small {
  color: var(--faint);
  font-family: var(--sans);
  font-size: .58rem;
}

.time-row-total,
.timesheet-desktop tfoot td,
.timesheet-desktop tfoot th {
  background: var(--surface-subtle);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.timesheet-desktop tfoot tr:last-child > * {
  border-bottom: 0;
}

.timesheet-mobile {
  display: none;
}

.time-empty {
  text-align: center;
}

.time-entry-dialog {
  position: fixed;
  inset: 0;
  width: min(472px, calc(100vw - 32px));
  margin: auto;
}

.time-entry-form {
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 0;
  max-height: min(82vh, 680px);
  overflow-y: auto;
  padding: 18px;
}

.time-entry-dialog .dialog-head {
  margin-bottom: 2px;
}

.time-entry-context {
  margin-top: 2px;
  color: var(--mut);
  font-size: .8rem;
  font-weight: 600;
}

.time-entry-date-context {
  margin-top: 1px;
  color: var(--faint);
  font-size: .76rem;
  font-variant-numeric: tabular-nums;
}

.time-entry-time-fields {
  display: grid;
  grid-template-columns: minmax(112px, .8fr) minmax(0, 1.45fr);
  gap: 10px;
}

.time-clock-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 5px;
}

.time-clock-separator {
  padding-bottom: 9px;
  color: var(--mut);
}

.time-entry-form textarea {
  min-height: 70px;
  resize: vertical;
}

.time-entry-form .form-actions {
  margin-top: 4px;
}

.time-cell-entries {
  display: grid;
  gap: 5px;
}

.time-cell-entries:empty {
  display: none;
}

.time-cell-entries-head,
.time-underlying-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.time-cell-entries-head {
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}

.time-underlying-entry {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  text-align: left;
}

.time-underlying-entry:hover:not(:disabled) {
  border-color: var(--accent-mid);
  background: var(--accent-soft);
}

.time-underlying-entry span,
.time-underlying-entry strong,
.time-underlying-entry small {
  display: block;
  min-width: 0;
}

.time-underlying-entry small {
  color: var(--faint);
}

.time-underlying-entry b {
  flex: none;
  font-family: var(--mono);
}

@media (min-width: 1101px) {
  .workspace.drawer-open .ov-grid,
  .workspace.drawer-open .overview-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .workspace.drawer-open .tab-panels,
  .workspace.drawer-open .tab-panel.active,
  .workspace.drawer-open .ov-grid > * {
    min-width: 0;
  }
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.kanban-column {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 10px;
}

.kanban-head {
  font-size: .74rem;
  font-weight: 600;
  color: var(--mut);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
}

.kanban-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.planning-list,
.deliverables-list,
.acquisition-list,
.ledger-list,
.members-list,
.index-list,
.admin-scroll-list,
.storage-browser-list,
.mailbox-import-list,
.member-search-results,
.talk-messages,
.chat-log,
.action-list,
.file-index-status-list {
  display: flex;
  flex-direction: column;
}

.admin-scroll-list,
.index-list,
.mailbox-import-list,
.storage-browser-list,
.talk-messages {
  max-height: 380px;
  overflow-y: auto;
}

.storage-browser-list:empty,
.member-search-results:empty,
.assistant-suggestions:empty {
  display: none;
}

/* Chat / assistant bubbles */
.chat-log {
  gap: 10px;
  margin-bottom: 12px;
}

.chat-form,
.talk-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-form input,
.talk-form input {
  flex: 1;
}

.bubble {
  border-radius: 0 10px 10px 10px;
  padding: 9px 12px;
  font-size: .86rem;
  background: var(--paper);
  border: 1px solid var(--line-soft);
}

.bubble.user {
  border-radius: 10px 0 10px 10px;
  background: var(--accent-soft);
  border-color: var(--accent-mid);
  align-self: flex-end;
}

@container (max-width: 1100px) {
  /* After sidebar and page padding, two Mail panes need about 680px/340px.
     Stack before fixed sender/date fields squeeze the subject out of the list. */
  .mail-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .mail-approval-panel {
    position: static;
  }

  .work-browser-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .work-details-panel {
    position: static;
    top: auto;
  }

  .files-browser-layout,
  .files-detail-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .file-details-panel {
    position: static;
    max-height: none;
    border-left: none;
    border-top: 1px solid var(--line);
  }

  .fdrow .acts {
    opacity: 1;
  }
}

.drawer .bubble {
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.drawer .dbody,
.drawer .chat-log,
.drawer .talk-messages,
.drawer .teams-messages {
  min-width: 0;
}

.drawer .bubble.assistant {
  max-width: 100%;
}

.drawer .bubble.user {
  max-width: 88%;
}

.sources {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: var(--mut);
  font-size: .75rem;
}

.sources strong {
  margin-right: 2px;
  color: var(--ink);
  font-weight: 650;
}

.sources a,
.sources > span {
  max-width: 100%;
  overflow: hidden;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-empty {
  color: var(--faint);
  font-size: .84rem;
}

.assistant-head {
  margin-bottom: 12px;
}

.assistant-scope {
  font-size: .8rem;
  color: var(--mut);
  margin-top: 2px;
}

/* Talk / Teams */
.talk-message {
  display: flex;
  width: 100%;
  margin-bottom: 7px;
}

.talk-message.own {
  justify-content: flex-end;
}

.talk-message-bubble {
  max-width: 88%;
  padding: 9px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 5px 14px 14px;
  background: var(--paper);
  box-shadow: 0 1px 2px rgb(15 30 35 / 5%);
}

.talk-message.own .talk-message-bubble {
  border-color: var(--accent-mid);
  border-radius: 14px 5px 14px 14px;
  background: var(--accent-soft);
}

.talk-message-text {
  overflow-wrap: anywhere;
  font-size: .86rem;
  line-height: 1.45;
}

.talk-message-meta {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 3px;
}

.talk-message-meta strong {
  font-weight: 600;
  font-size: .84rem;
}

.talk-message-meta span,
.talk-message-meta time {
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--faint);
}

.talk-message .body,
.talk-message p {
  margin: 0;
  border: 0;
  padding: 0;
  background: transparent;
  font-size: .86rem;
}

.talk-date-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 8px 0;
}

.talk-date-separator span {
  padding: 4px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--mut);
  font-size: .69rem;
}

.talk-body {
  font-size: .82rem;
  color: var(--mut);
  margin-bottom: 12px;
}

.talk-project-room-field {
  display: flex;
  gap: 7px;
  align-items: center;
  margin: 0 0 10px;
}

.talk-project-room-field select {
  min-width: 0;
  flex: 1;
}

.talk-global-drawer-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.talk-messages.global-inbox {
  max-height: none;
  overflow-y: auto;
}

.talk-global-drawer-item {
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
}

.talk-global-drawer-item:last-child {
  border-bottom: 0;
}

.talk-global-drawer-all {
  align-self: center;
  margin: 14px auto 4px;
}

.talk-global-drawer-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 34px 18px;
  color: var(--mut);
  text-align: center;
}

.talk-global-drawer-empty p {
  margin: 0;
}

.talk-chip-list,
.storage-capability-chips,
.admin-chip-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.talk-chip,
.admin-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .76rem;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--mut);
}

.talk-chip-action {
  color: var(--red);
  font-weight: 600;
}

.talk-room-list {
  display: grid;
  gap: 8px;
}

.talk-room-row {
  display: grid;
  gap: 3px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--r-sm);
  padding: 9px 11px;
}

.talk-room-row:hover {
  border-color: var(--accent-strong);
}

.talk-summary-grid,
.members-summary,
.talk-participants-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.talk-summary-grid > *,
.members-summary > *,
.talk-participants-summary > * {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: .8rem;
}

.talk-missing {
  color: var(--red);
}

.talk-details {
  margin-top: 10px;
}

.talk-room-name {
  font-family: var(--mono);
  font-size: .76rem;
}

.talk-sync-list {
  font-size: .8rem;
  color: var(--mut);
}

/* Member / access cards */
.member-card,
.external-card,
.access-card,
.estimate-card {
  justify-content: space-between;
}

.member-avatar,
.external-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  display: grid;
  place-items: center;
  font-size: .7rem;
  font-weight: 600;
  flex: none;
}

.role-badge {
  font-size: .72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.member-role-control {
  display: flex;
  gap: 6px;
  align-items: center;
}

.member-role-control select {
  width: auto;
  font-size: .8rem;
  padding: 4px 8px;
}

.member-result {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft);
  font-size: .84rem;
  cursor: pointer;
}

.member-result:hover {
  background: var(--paper);
}

/* Index / audit tables */
.index-table,
.estimate-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}

.index-table th,
.index-table td,
.estimate-table th,
.estimate-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
}

.index-table th,
.estimate-table th,
.index-table-head {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--faint);
  font-weight: 600;
}

.index-config {
  margin-bottom: 12px;
}

.index-status-section {
  margin-top: 14px;
}

.file-index-status-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: .8rem;
}

/* File detail pane */
.file-detail-head {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.file-detail-head > div {
  min-width: 0;
}

.file-detail-head h4 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.long-technical-value,
.work-detail-section .mono {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.file-detail-icon {
  color: var(--amber);
  flex: none;
}

.file-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  font-size: .8rem;
}

.file-detail-grid strong {
  display: block;
  color: var(--faint);
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.file-detail-actions {
  margin-top: 14px;
}

.file-index-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  background: var(--paper);
}

.file-index-summary .meta {
  margin-top: 4px;
}

.file-index-summary .error-text {
  flex-basis: 100%;
  margin: 0;
}

.file-preview {
  margin-top: 16px;
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
}

.compact-section-head {
  margin-bottom: 8px;
}

.file-preview-body {
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  background: var(--paper);
  min-height: 120px;
  overflow: hidden;
}

.file-preview-text {
  margin: 0;
  padding: 12px;
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font: .82rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.file-preview-image {
  display: block;
  max-width: 100%;
  max-height: 520px;
  margin: 0 auto;
  object-fit: contain;
}

.file-preview-frame {
  display: block;
  width: 100%;
  height: min(70vh, 720px);
  border: 0;
  background: white;
}

.file-link {
  color: var(--accent-strong);
  font-weight: 500;
  text-decoration: none;
}

.file-link:hover {
  text-decoration: underline;
}

.file-row-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.folder .fico,
.folder {
  color: var(--amber);
}

.copied {
  color: var(--success-strong);
}

/* Calendar */
.calendar-widget {
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  overflow: hidden;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--paper);
}

.calendar-weekday {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--faint);
  font-weight: 600;
  padding: 6px;
  text-align: center;
}

.calendar-cell-date {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--faint);
}

.calendar-events {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Notes */
.notes-workspace {
  overflow: hidden;
}

.notes-workspace > .fdhead h2,
.notes-workspace > .fdhead p {
  margin: 0;
}

.notes-workspace > .fdhead p {
  margin-top: 3px;
}

.note-compose-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.note-preview {
  margin-top: 14px;
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
}

.note-preview-body {
  font-size: .86rem;
  line-height: 1.6;
}

.note-preview-body h1,
.note-preview-body h2,
.note-preview-body h3 {
  margin: 12px 0 6px;
}

.note-preview-body ul,
.note-preview-body ol {
  list-style: revert;
  padding-left: 20px;
}

.note-preview-body .note-checklist {
  display: grid;
  gap: 7px;
  list-style: none;
  margin: 10px 0;
  padding-left: 0;
}

.note-checklist-item label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  cursor: pointer;
}

.note-checklist-item input {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: var(--accent);
  flex: none;
}

.note-checklist-item.checked span {
  color: var(--faint);
  text-decoration: line-through;
}

.note-checklist-item input:disabled + span {
  cursor: default;
}

.note-editor-form textarea {
  font-family: var(--mono);
  font-size: .82rem;
}

.notes-browser-layout {
  display: grid;
  grid-template-columns: minmax(260px, .9fr) minmax(360px, 1.35fr);
  gap: 0;
  min-height: 420px;
}

.notes-list {
  border-right: 1px solid var(--line-soft);
}

.note-row.on {
  background: var(--accent-soft);
}

.note-details-panel {
  min-width: 0;
  padding: 18px 20px;
}

.note-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 12px;
}

.note-detail-head h3 {
  margin: 0 0 4px;
}

.note-inline-editor {
  width: 100%;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px;
  font-family: var(--mono);
  font-size: .82rem;
  resize: vertical;
}

.note-preview-inline {
  border-top: 0;
  margin-top: 12px;
  padding-top: 0;
}

.linked-file-picker {
  display: grid;
  gap: 8px;
}

.linked-file-field input {
  width: 100%;
}

.linked-file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.linked-file-drop {
  border: 1px dashed var(--line);
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--mut);
  padding: 10px 12px;
  font-size: .82rem;
}

.linked-file-drop.drag-over {
  border-color: var(--accent-strong);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--accent-strong);
}

.linked-file-options {
  display: grid;
  gap: 6px;
  max-height: 170px;
  overflow: auto;
}

.linked-file-option {
  display: grid;
  gap: 2px;
  text-align: left;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--paper);
  padding: 8px 10px;
  color: var(--ink);
  cursor: pointer;
}

.linked-file-option:hover {
  border-color: var(--accent-strong);
}

.linked-file-option span,
.linked-file-option small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.linked-file-option span {
  font-weight: 600;
}

.linked-file-option small {
  color: var(--mut);
}

.task-ref,
.task-label {
  display: inline-block;
  align-items: center;
  max-width: 100%;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: var(--paper);
  color: var(--mut);
  font-family: var(--mono);
  font-size: .72rem;
  line-height: 1.2;
  padding: 3px 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-ref {
  color: var(--accent-strong);
  background: var(--accent-soft);
  min-width: 0;
}

.task-ref.empty {
  visibility: hidden;
}

.task-label {
  margin-left: 6px;
  color: var(--ink);
  max-width: 110px;
  vertical-align: text-bottom;
}

@media (max-width: 980px) {
  .notes-browser-layout {
    grid-template-columns: 1fr;
  }

  .notes-list {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .note-details-panel {
    min-height: 280px;
  }
}

.email-body {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 14px;
  font-family: var(--mono);
  font-size: .8rem;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  margin: 0;
}

.email-detail-dialog {
  width: min(720px, calc(100vw - 32px));
  height: min(760px, calc(100dvh - 32px));
  max-width: none;
  max-height: none;
  overflow: hidden;
}

.email-detail-dialog-content {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: 100%;
  height: 100%;
  max-height: none;
  overflow: hidden;
}

.email-detail-dialog-content .dialog-head {
  min-width: 0;
}

.email-detail-dialog-content .dialog-head h2 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  font-size: .8rem;
}

.email-action-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.classification-box {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--paper);
}

.classification-box.muted {
  color: var(--faint);
  font-size: .8rem;
}

.classification-title {
  color: var(--mut);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.classification-candidate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.classification-candidate > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.classification-candidate .meta {
  font-size: .76rem;
}

/* Admin */
.admin-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-user-row,
.admin-group-row {
  flex-wrap: wrap;
}

.admin-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
}

.admin-group-meta,
.admin-user-stats {
  font-size: .76rem;
  color: var(--faint);
}

/* Estimate builder */
.estimate-result {
  margin-top: 14px;
}

.estimate-editor {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.builder-apply-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.builder-apply-status,
.summary-status {
  font-size: .8rem;
  color: var(--faint);
}

.summary-block {
  margin-bottom: 12px;
}

.summary-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.summary-objective {
  font-size: .86rem;
  color: var(--mut);
}

.split-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.form-section {
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 14px;
  margin-bottom: 12px;
}

.form-section legend {
  font-size: .76rem;
  font-weight: 600;
  color: var(--mut);
  padding: 0 6px;
}

.extra-folder-settings {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.disabled-communication,
.secondary-communication {
  opacity: .6;
}

.primary-communication {
  border-color: var(--accent-mid);
}

/* The Talk/Teams drawer panes carry these provider classes too; a drawer pane
   the user explicitly opened must never render dimmed. */
.dpane.disabled-communication,
.dpane.secondary-communication {
  opacity: 1;
}

.storage-capability-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0;
}

.sharepoint-picker {
  margin: 10px 0;
}

/* =========================================================================
   Spec 6 — Responsive
   ========================================================================= */

/* Tablet 901–1100px: the drawer overlays content (it is absolutely
   positioned, so it already does) — tighten padding only. */
@media (max-width: 1100px) {
  .workspace.drawer-open {
    padding-right: 0;
  }

  .view,
  .project-shell {
    padding: 22px;
  }

  .files-browser-layout,
  .files-grid {
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  }

  .files-detail-layout {
    grid-template-columns: 1fr;
  }

  .file-details-panel {
    position: static;
    max-height: none;
    border-left: none;
    border-top: 1px solid var(--line);
  }

  .ov-grid,
  .overview-row {
    grid-template-columns: 1fr;
  }
}

.email-detail-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 12px;
}

.email-detail-actions .meta {
  margin: 0 auto 0 0;
}

/* Mobile <=900px */
@media (max-width: 900px) {
  /* Match the existing mobile menu pattern rather than anchoring a wide
     filter panel to the small, left-aligned Filters button. */
  #work-filter-menu {
    position: fixed;
    inset: auto var(--space-3) calc(var(--mobile-nav-h, 0px) + env(safe-area-inset-bottom) + var(--space-3));
    min-width: 0;
    max-height: min(50dvh, calc(var(--visual-viewport-height, 100dvh) - var(--topbar-h, 64px) - var(--mobile-nav-h, 0px) - env(safe-area-inset-bottom) - var(--space-8)));
  }

  html {
    font-size: 14px;
  }

  .app-shell,
  .app-shell.rail {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 264px;
    z-index: 95;
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.openm {
    transform: none;
  }

  .railbtn {
    display: none;
  }

  .menubtn {
    display: grid;
  }

  #drawer-talk.mobile-chat-shortcut:not([hidden]) {
    display: grid;
  }

  .topbar {
    padding: 10px 14px;
    gap: 8px;
  }

  .topbar-search {
    max-width: none;
    min-width: 0;
  }

  .view,
  .project-shell {
    padding: 16px 14px;
  }

  .home-query {
    padding: 16px;
    margin-bottom: 28px;
  }

  .home-query-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .home-query-form input#home-query-input,
  .home-query-form .btn {
    min-height: 52px;
  }

  .home-query-response .bubble {
    max-width: 100%;
  }

  .section-head {
    flex-wrap: wrap;
    gap: 8px;
  }

  .filters {
    flex-wrap: wrap;
    margin-left: 0;
  }

  /* The crumb duplicates the page heading and starves the search box at
     narrow widths; the hamburger and the heading carry the context. */
  .crumb {
    display: none;
  }

  /* ＋ Create shrinks to its glyph so search keeps usable width. */
  #create-menu-btn {
    padding: 6px 10px;
    font-size: 1rem;
  }

  #create-menu-btn .create-label {
    display: none;
  }

  .topbar-search {
    flex: 1 1 auto;
    min-width: 120px;
  }

  /* Inbox/work row actions always visible on touch (spec 6) */
  .row {
    padding: 12px 14px;
    flex-wrap: wrap;
    row-gap: 8px;
  }

  /* Line 1 is the icon and the title; the timestamp and actions wrap onto
     line 2, otherwise the title truncates to a couple of characters. */
  .row .body {
    flex: 1 1 auto;
    min-width: 0;
  }

  .row .when {
    flex-basis: 100%;
  }

  .row .acts {
    opacity: 1;
    margin-left: auto;
  }

  .row .t {
    white-space: normal;
  }

  .wrow {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .wrow .body,
  .wrow .when,
  .wrow .acts {
    grid-column: 1 / -1;
  }

  .wrow .when {
    justify-self: start;
  }

  /* Chips scroll rather than stacking into four rows. */
  .section-head .filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    width: 100%;
  }

  .section-head .filters::-webkit-scrollbar {
    display: none;
  }

  .section-head .filters .fchip {
    white-space: nowrap;
  }

  .workspace-head,
  .phead {
    padding: 16px 14px 0;
  }

  .project-query {
    margin: 10px 0 14px;
    padding: 14px;
  }

  .project-query-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .project-query .home-query-form input#project-query-input,
  .project-query .home-query-form .btn {
    min-height: 48px;
  }

  .project-brief-content {
    padding: 0 14px 14px;
    flex-direction: column;
  }

  .titleline {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .project-header-actions {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }

  /* All 2-column grids stack (spec 6) */
  .ov-grid,
  .overview-preview-grid,
  .overview-row,
  .files-browser-layout,
  .files-grid,
  .grid-2,
  .settings-grid,
  .mail-workspace,
  .mail-keyword-panel,
  .task-form,
  .planning-form,
  .deliverable-form,
  .finance-form,
  .acquisition-form,
  .ledger-form,
  .time-entry-form,
  .extra-folder-settings,
  .task-form-row,
  .file-detail-grid,
  .summary-cols {
    grid-template-columns: 1fr;
  }

  .mail-approval-panel {
    position: static;
  }

  .kpis,
  .finance-summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .drawer {
    width: 100%;
  }

  .set-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .set-grid > nav {
    display: flex;
    overflow-x: auto;
    gap: 4px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .snav {
    white-space: nowrap;
    width: auto;
  }

  .snav-label {
    display: none;
  }

  /* Mail rows reflow with subject on its own line (spec 6) */
  .mailrow,
  .mail-table-row {
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .mailrow .who,
  .mail-party {
    width: auto;
  }

  .mailrow .subj,
  .mail-subject {
    flex-basis: 100%;
    order: 9;
  }

  .mailbox-import-filter-grid {
    grid-template-columns: 1fr;
  }

  .mailbox-import-workspace.preview-open {
    grid-template-columns: 1fr;
  }

  .mailbox-import-workspace.preview-open .mailbox-import-list {
    display: none;
  }

  .mailbox-import-preview {
    max-height: 52vh;
    border-left: none;
  }

  .mailbox-import-custom-dates {
    flex-basis: 100%;
  }

  #mailbox-import-load-older {
    margin-left: 0;
  }

  .atabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .atabs .fchip {
    white-space: nowrap;
  }

  .project-form,
  .members-dialog-body,
  .project-settings-dialog-body,
  .admin-dialog-content,
  .weaviate-dialog-content,
  .mailbox-import-form,
  .global-settings-form {
    width: 100%;
  }

  dialog {
    width: 96vw;
  }

  /* Touch targets >= 40px (spec 6) */
  .mini,
  .compact-button,
  .fchip,
  .tab,
  .menu-item,
  .wide-button,
  .snav {
    min-height: 40px;
  }

  .iconbtn {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 600px) {
  .time-report-filters {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .time-report-keyword,
  .time-project-filter {
    grid-column: auto;
  }

  .time-report-toolbar {
    align-items: stretch;
  }

  .time-report-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .time-report-breakdowns {
    grid-template-columns: 1fr;
  }

  .time-breakdown-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .time-breakdown-row i {
    display: none;
  }

  .time-report-detail {
    padding: 8px 14px;
  }

  .time-report-detail table,
  .time-report-detail tbody,
  .time-report-detail tr,
  .time-report-detail td {
    display: block;
    width: 100%;
  }

  .time-report-detail thead {
    display: none;
  }

  .time-report-detail tr {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }

  .time-report-detail td {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
    padding: 5px 0;
    border: 0;
  }

  .time-report-detail td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
  }

  .time-export-menu > div {
    position: fixed;
    right: 16px;
    bottom: 16px;
    top: auto;
    left: 16px;
  }

  .time-entry-dialog {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
  }

  .time-entry-form {
    max-height: calc(100dvh - 24px);
    padding: 16px;
  }

  .time-entry-time-fields {
    grid-template-columns: 1fr;
  }

  .time-page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .time-page-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .time-week-toolbar {
    flex-wrap: wrap;
  }

  .time-week-toolbar strong {
    flex-basis: 100%;
    margin: 4px 0 0;
  }

  .time-summary-strip {
    display: flex;
  }

  .time-summary-strip > span {
    min-width: 0;
    padding-inline: 8px;
  }

  .timesheet-desktop {
    display: none;
  }

  .timesheet-mobile {
    display: grid;
    gap: 10px;
  }

  .time-mobile-day {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--card);
  }

  .time-mobile-day header,
  .timesheet-mobile footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: var(--surface-subtle);
  }

  .time-mobile-day > button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 48px;
    padding: 9px 12px;
    border-top: 1px solid var(--line-soft);
    text-align: left;
  }

  .time-mobile-day > button small,
  .time-mobile-day > button strong {
    display: block;
  }

  .time-mobile-day > button small {
    color: var(--faint);
  }

  .time-mobile-day > button b,
  .timesheet-mobile footer strong {
    font-family: var(--mono);
  }

  .time-mobile-add {
    color: var(--accent-strong);
  }

  .time-clock-fields {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .project-view:not([data-active-tab="overview"]) .project-query {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 5px;
    padding: 5px;
  }

  .project-view:not([data-active-tab="overview"]) .project-query .home-query-mode {
    min-width: 46px;
    padding-inline: 7px;
  }

  .project-view:not([data-active-tab="overview"]) .project-query .home-query-form {
    gap: 5px;
  }

  .project-view:not([data-active-tab="overview"]) .project-query .home-query-form .btn {
    min-width: 58px;
    padding-inline: 8px;
  }

  .timeline-item {
    gap: 8px;
    align-items: flex-start;
  }

  .timeline-time {
    max-width: 72px;
    white-space: nowrap;
  }

  .fdrow {
    gap: 7px;
    padding-inline: 10px;
  }

  .fdrow .ftag,
  .fdrow .fsize {
    display: none;
  }
}

/* =========================================================================
   UI v2 Phase 3c + Phase 4 — compact data headers and decision-first Home
   ========================================================================= */

/* A data view is a workspace, not a second project hero. Keep the same title
   and actions in one compact row immediately below the local navigation. */
.project-view:not([data-active-tab="overview"]) .workspace-head {
  position: static;
  min-height: 46px;
  padding: 7px 28px;
}

.project-view:not([data-active-tab="overview"]) .titleline {
  flex-wrap: nowrap;
  justify-content: flex-start;
  min-height: 32px;
}

.project-view:not([data-active-tab="overview"]) .titleline > #project-title {
  width: auto;
  max-width: min(48vw, 620px);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.08rem;
}

.project-view:not([data-active-tab="overview"]) .project-header-actions {
  position: static;
  width: auto;
  margin: 0 0 0 auto;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 3px;
}

.project-view:not([data-active-tab="overview"]) .project-header-actions .btn {
  min-height: 30px;
  padding: 5px 8px;
  font-size: .76rem;
}

/* Opening Ask removes the launch surface completely; content/rail can use the
   recovered space and the exact surface returns when the workspace closes. */
.workspace.assistant-open .home-query,
.workspace.assistant-open .project-view[data-active-tab="overview"] .project-query {
  display: none !important;
}

.workspace.assistant-open .project-view[data-active-tab="overview"] .overview-shell {
  margin-top: 4px;
}

.home-greeting-block {
  margin-bottom: 20px;
}

.home-greeting-block h1 {
  font-size: clamp(1.6rem, 3vw, 2.15rem);
  letter-spacing: -.035em;
}

.home-query {
  width: 100%;
  max-width: 760px;
  margin: 0 auto 30px;
  padding: 8px;
  border: 1.5px solid var(--accent-mid);
  border-radius: 16px;
  box-shadow: 0 7px 26px rgb(66 176 213 / 10%);
}

.home-query-head {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
}

.home-query-form {
  gap: 6px;
}

#home-query-form {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

#project-query-form {
  grid-template-columns: minmax(0, 1fr) auto;
}

.home-query-form > input {
  width: 100%;
  min-width: 0;
}

.home-query-form > button[type="submit"] {
  flex: none;
  width: max-content;
  justify-self: end;
  white-space: nowrap;
}

.home-query-scope-chip {
  align-self: center;
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--ink-soft);
  font: inherit;
  font-size: .76rem;
  font-weight: 650;
  white-space: nowrap;
}

.home-query-scope-chip:hover,
.home-query-scope-chip:focus-visible {
  border-color: var(--accent-mid);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.home-query-form input#home-query-input,
.home-query-form .btn {
  min-height: 44px;
}

.home-query-form input#home-query-input {
  padding: 9px 12px;
  border: 0;
  box-shadow: none;
}

.home-query-form input#home-query-input:focus {
  box-shadow: none;
}

.home-query-form .btn {
  min-width: 78px;
}

.home-query-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 4px 0;
}

.home-query-purpose {
  margin: 0;
  color: var(--faint);
  font-size: .72rem;
}

.home-query-modes {
  padding: 2px;
  border: 0;
  background: transparent;
}

.home-query-mode {
  min-width: 54px;
  padding: 4px 9px;
}

.home-query-scope {
  margin: 0;
}

.home-conversations {
  order: 3;
  margin-bottom: 28px;
}

.home-conversations-head {
  margin-bottom: 9px;
}

.home-conversation-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.home-conversation-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  min-width: 0;
  min-height: 118px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  text-align: left;
  box-shadow: var(--shadow-soft);
}

.home-conversation-card:hover,
.home-conversation-card:focus-visible {
  border-color: var(--accent-mid);
  box-shadow: 0 7px 20px rgb(66 176 213 / 10%);
}

.home-conversation-scope {
  grid-column: 1;
  justify-self: start;
  max-width: 100%;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: .68rem;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-conversation-card time {
  grid-column: 2;
  grid-row: 1;
  color: var(--faint);
  font-family: var(--mono);
  font-size: .65rem;
}

.home-conversation-card strong,
.home-conversation-snippet {
  grid-column: 1 / -1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-conversation-snippet {
  color: var(--mut);
  font-size: .76rem;
}

.home-attention-head { order: 4; }
#inbox-bulk-status { order: 5; }
.home-attention-list { order: 6; }
.home-wrap > .queue-footer { order: 7; }
.home-recent-head { order: 8; }
.home-recent-card { order: 9; }
#home-finance-card,
#home-finance-hint { order: 10; }

.queue-bulk-status {
  min-height: 0;
  margin: -4px 0 7px;
  color: var(--mut);
  font-size: .74rem;
}

.queue-bulk-status:empty { display: none; }

.queue-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -20px 0 30px;
  color: var(--faint);
  font-size: .72rem;
}

.queue-footer strong {
  color: var(--mut);
  font-family: var(--mono);
  font-size: .68rem;
  white-space: nowrap;
}

.attention-row {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto minmax(220px, auto) auto;
  align-items: center;
  gap: 10px;
}

.attention-row .attention-row-main {
  min-width: 0;
}

.queue-decision {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.queue-decision .compact-button {
  min-height: 30px;
  padding: 5px 9px;
  white-space: nowrap;
}

.queue-primary {
  border-color: var(--success);
  background: var(--success);
  color: white;
}

.queue-change,
.queue-other,
.queue-candidate {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
}

.queue-destination,
.queue-unsure-label {
  color: var(--mut);
  font-size: .7rem;
  white-space: nowrap;
}

.queue-destination {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-unsure {
  align-items: flex-start;
  flex-direction: column;
  gap: 3px;
}

.queue-candidates {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.queue-candidate {
  max-width: 160px;
  padding: 4px 7px;
  border-radius: 999px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: inherit;
  font-size: .68rem;
}

.queue-more {
  position: relative;
  justify-self: end;
}

.queue-more > summary {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  list-style: none;
}

.queue-more > summary::-webkit-details-marker { display: none; }

.queue-more > .acts {
  position: absolute;
  z-index: 12;
  top: calc(100% + 5px);
  right: 0;
  display: grid;
  gap: 3px;
  width: max-content;
  min-width: 220px;
  max-width: min(280px, calc(100vw - 24px));
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--shadow-lg);
}

.queue-more > .acts > button {
  justify-content: flex-start;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  text-align: left;
  white-space: normal;
}

.attention-row .attention-preview {
  grid-column: 1 / -1;
}

.overview-ok-row > .queue-decision {
  padding: 0 10px 10px;
}

.overview-queue-footer {
  display: none;
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}

.overview-rail-head > .overview-accept-all {
  width: auto;
  margin: 0 0 0 auto;
  padding: 5px 7px;
  white-space: nowrap;
}

.overview-rail-head > .overview-accept-all + .text-button,
.overview-rail-head > .overview-accept-all ~ .count {
  margin-left: 0;
}

.overview-attention-card:has(#overview-actions-all[aria-expanded="true"]) .overview-queue-footer {
  display: flex;
}

.activity-group .timeline-body {
  gap: 3px;
}

.activity-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}

.activity-chip {
  max-width: 240px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--mut);
  font-size: .67rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-versions {
  margin-top: 4px;
  color: var(--mut);
  font-size: .7rem;
}

.activity-versions summary {
  width: max-content;
  cursor: pointer;
  color: var(--accent-strong);
  font-weight: 650;
}

.activity-version-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 8px;
  padding: 5px 0 0 10px;
  color: var(--faint);
}

.activity-version-row strong {
  color: var(--mut);
  font-weight: 550;
}

@media (max-width: 1020px) {
  .home-conversation-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-conversation-card:last-child {
    grid-column: 1 / -1;
  }

  .attention-row {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
  }

  .attention-row > .queue-decision {
    grid-column: 2 / 4;
    justify-self: stretch;
    justify-content: flex-start;
  }
}

@media (max-width: 600px) {
  .project-view:not([data-active-tab="overview"]) .workspace-head {
    padding: 6px 10px;
  }

  .project-view:not([data-active-tab="overview"]) .titleline > #project-title {
    max-width: calc(100vw - 190px);
    font-size: .92rem;
  }

  .project-view:not([data-active-tab="overview"]) .project-header-actions {
    position: static;
    width: auto;
    margin-left: auto;
    justify-content: flex-end;
  }

  .project-view:not([data-active-tab="overview"]) .project-action-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .home-query {
    padding: 6px;
  }

  #home-query-form {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .home-query-scope-chip {
    width: 42px;
    padding-inline: 0;
    overflow: hidden;
    color: var(--accent-strong);
    font-size: 0;
  }

  .home-query-scope-chip::before {
    content: "All";
    font-size: .7rem;
  }

  .home-query-scope-chip span { display: none; }

  .home-query-form .btn {
    min-width: 60px;
    padding-inline: 10px;
  }

  .home-conversation-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-conversation-card:last-child { grid-column: auto; }

  .attention-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
  }

  .attention-row > .when {
    grid-column: 3;
  }

  .attention-row > .queue-decision {
    grid-column: 2 / -1;
    min-width: 0;
  }

  .attention-row > .queue-more {
    grid-column: 1;
    grid-row: 2;
  }

  .attention-row > .queue-more > .acts {
    right: auto;
    left: 0;
  }

  .queue-candidates {
    justify-content: flex-start;
  }

  .queue-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .activity-version-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .activity-version-row > :first-child,
  .activity-version-row > :nth-child(3) { display: none; }
}

@media (max-width: 700px) {
  .attention-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .attention-row > .when {
    grid-column: 2;
    justify-self: start;
  }

  .attention-row > .acts {
    grid-column: 1 / -1;
    justify-self: end;
    opacity: 1;
  }

  .attention-preview,
  .overview-attention-row .attention-preview {
    margin-left: 0;
    padding: 12px;
  }

  .attention-preview-meta {
    grid-template-columns: 1fr;
  }

  .attention-preview-wide {
    grid-column: auto;
  }

  .attention-preview-actions {
    justify-content: stretch;
  }

  .attention-preview-actions .compact-button {
    flex: 1 1 calc(50% - 8px);
    justify-content: center;
    min-height: 40px;
  }

  .attention-thread-row {
    grid-template-columns: 1fr;
  }

  .email-detail-dialog {
    width: calc(100vw - 20px);
    height: calc(100dvh - 20px);
  }

  .email-detail-dialog-content {
    padding: 16px;
  }
}

/* Ask history, grouped search and object hierarchy */
.object-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--mut);
}

.object-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.timeline-kind {
  display: block;
  margin-bottom: 1px;
  color: var(--mut);
  font-size: .7rem;
  font-weight: 650;
  letter-spacing: .02em;
}

.timeline-item {
  gap: 10px;
  align-items: flex-start;
}

.timeline-icon {
  margin-top: 1px;
}

.timeline-time {
  padding-top: 1px;
}

.ask-history-panel {
  min-width: 0;
}

.ask-history-heading {
  display: grid;
  gap: 2px;
  margin-bottom: 14px;
}

.ask-history-heading strong {
  font-size: .9rem;
}

.ask-history-group + .ask-history-group {
  margin-top: 18px;
}

.ask-history-group h3 {
  margin: 0 0 5px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.ask-history-entry {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 9px 8px;
  border-radius: var(--r-sm);
  text-align: left;
}

.ask-history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-radius: var(--r-sm);
}

.ask-history-row.active,
.ask-history-row:hover {
  background: var(--surface-subtle);
}

.ask-history-delete {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  color: var(--mut);
  font-size: 1rem;
}

.ask-history-delete:hover,
.ask-history-delete:focus-visible {
  background: var(--card);
  color: var(--danger);
}

.ask-history-entry:hover,
.ask-history-entry:focus-visible,
.ask-history-row.active .ask-history-entry {
  background: var(--surface-subtle);
}

.ask-history-title {
  overflow: hidden;
  color: var(--ink);
  font-size: .84rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ask-history-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  color: var(--faint);
  font-size: .72rem;
}

.ask-history-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ask-history-meta time {
  flex: none;
}

.search-result-group + .search-result-group {
  margin-top: 16px;
}

.search-result-group h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 6px 12px;
  color: var(--mut);
  font-size: .76rem;
  font-weight: 650;
}

.search-group-count {
  margin-left: auto;
  color: var(--faint);
  font-family: var(--mono);
  font-size: .68rem;
}

.search-result-row {
  align-items: flex-start;
}

.search-result-copy,
.source-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.search-result-copy .overview-list-title,
.search-result-copy .meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer .bubble {
  padding: 10px 0 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.drawer .bubble + .bubble {
  border-top: 1px solid var(--line-soft);
}

.drawer .bubble.user {
  align-self: stretch;
  max-width: 100%;
  background: transparent;
  border-color: var(--line-soft);
}

.bubble-role {
  display: block;
  margin-bottom: 4px;
  color: var(--mut);
  font-size: .72rem;
  font-weight: 700;
}

.bubble.user .bubble-role {
  color: var(--accent-strong);
}

.bubble-content {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ask-progress-content {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  color: var(--ink);
}

.ask-progress-content .operation-spinner {
  width: 17px;
  height: 17px;
  margin-top: 2px;
}

.ask-progress-content strong,
.ask-progress-content small {
  display: block;
}

.ask-progress-content small,
.ask-progress-elapsed {
  margin-top: 3px;
  color: var(--mut);
  font-size: .72rem;
  font-weight: 500;
}

.ask-progress-elapsed {
  margin-top: 1px;
  font-family: var(--mono);
  white-space: nowrap;
}

.ask-retry-bubble {
  border-left: 3px solid var(--amber, #c58a1b) !important;
  padding-left: 12px !important;
}

.ask-retry-action {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.answer-sources {
  margin-top: 10px;
  color: var(--mut);
  font-size: .76rem;
}

.answer-sources summary {
  width: max-content;
  max-width: 100%;
  padding: 3px 0;
  cursor: pointer;
  color: var(--mut);
  font-weight: 600;
}

.answer-sources summary:hover {
  color: var(--accent-strong);
}

.source-list {
  display: grid;
  gap: 2px;
  margin-top: 5px;
  padding-left: 2px;
}

.source-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  padding: 7px 6px;
  border-radius: var(--r-sm);
  color: inherit;
  text-decoration: none;
}

.source-row:hover {
  background: var(--surface-subtle);
}

.source-copy strong,
.source-copy > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-copy strong {
  color: var(--ink);
  font-size: .78rem;
}

.source-copy > span {
  color: var(--faint);
  font-size: .7rem;
}

/* Ask/Search workspace: one persistent shell with quick, expanded and focus states. */
.drawer {
  transition:
    width var(--duration-shell) var(--ease-standard),
    transform var(--duration-shell) var(--ease-standard),
    visibility 0s linear var(--duration-shell);
}

.workspace.assistant-expanded {
  --drawer-w: clamp(620px, 50vw, 760px);
}

.workspace.assistant-focus {
  --drawer-w: 100%;
}

.ask-workspace-modes {
  display: none;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-subtle);
}

.workspace.assistant-open .ask-workspace-modes {
  display: inline-flex;
}

.workspace.assistant-open .dhead {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  row-gap: 5px;
}

.workspace.assistant-open .drawer-title,
.workspace.assistant-open .drawer-provider-tabs {
  display: none;
}

.workspace.assistant-open .ask-workspace-modes {
  grid-column: 1;
  margin-left: 0;
}

.workspace.assistant-open .ask-drawer-controls {
  grid-column: 1 / -1;
  grid-row: 2;
  justify-content: flex-end;
  margin-left: 0;
}

.workspace.assistant-open .dclose {
  grid-column: 3;
  grid-row: 1;
}

.ask-workspace-mode {
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--mut);
  font-size: .73rem;
  font-weight: 650;
}

.ask-workspace-mode:hover,
.ask-workspace-mode.on {
  color: var(--accent-strong);
  background: var(--card);
  box-shadow: 0 1px 2px rgba(16, 24, 32, .08);
}

.ask-context-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: none;
  min-width: 0;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--surface-raised) 94%, var(--accent-soft));
}

.ask-context-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.ask-context-copy strong,
.ask-context-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ask-context-copy strong {
  color: var(--ink);
  font-family: var(--disp);
  font-size: .9rem;
  line-height: 1.2;
}

.ask-context-copy .assistant-scope {
  color: var(--mut);
  font-size: .72rem;
}

.ask-workspace-state-label {
  flex: none;
  color: var(--faint);
  font-family: var(--mono);
  font-size: .65rem;
}

.workspace-mode-hidden {
  display: none !important;
}

#ask-conversation-view.history-suppressed {
  display: none;
}

.assistant-log,
.answer-sources,
.ask-search-view {
  width: 100%;
  max-width: 780px;
  margin-inline: auto;
}

.bubble-content {
  color: var(--ink);
  font-size: .9rem;
  line-height: 1.68;
}

.bubble-content > :first-child {
  margin-top: 0;
}

.bubble-content > :last-child {
  margin-bottom: 0;
}

.bubble-content p,
.bubble-content ul,
.bubble-content ol,
.bubble-content blockquote,
.bubble-content .assistant-code-shell,
.bubble-content .assistant-table-shell,
.bubble-content .assistant-chart {
  margin: 0 0 16px;
}

.bubble-content h2,
.bubble-content h3,
.bubble-content h4,
.bubble-content h5 {
  margin: 22px 0 9px;
  color: var(--ink);
  font-family: var(--disp);
  line-height: 1.25;
  letter-spacing: -.012em;
}

.bubble-content h2 { font-size: 1.15rem; }
.bubble-content h3 { font-size: 1.04rem; }
.bubble-content h4,
.bubble-content h5 { font-size: .96rem; }

.bubble-content ul,
.bubble-content ol {
  padding-left: 22px;
}

.bubble-content li + li {
  margin-top: 5px;
}

.bubble-content hr {
  height: 1px;
  margin: 20px 0;
  border: 0;
  background: var(--line);
}

.bubble-content del {
  color: var(--mut);
}

.assistant-task-list {
  padding-left: 0 !important;
  list-style: none;
}

.assistant-task-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.assistant-task-item input {
  flex: none;
  width: 15px;
  height: 15px;
  margin: 5px 0 0;
  accent-color: var(--accent);
}

.bubble-content blockquote {
  padding: 4px 0 4px 14px;
  border-left: 3px solid var(--accent-mid);
  color: var(--mut);
}

.bubble-content code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--surface-subtle);
  font-family: var(--mono);
  font-size: .82em;
}

.bubble-content pre {
  margin: 0;
  max-width: 100%;
  overflow-x: auto;
  padding: 14px 16px;
  border: 0;
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  background: #182128;
  color: #eef4f5;
  line-height: 1.55;
}

.bubble-content pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.assistant-code-shell,
.assistant-table-shell,
.assistant-chart {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--card);
}

.assistant-code-shell {
  overflow: hidden;
}

.assistant-content-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  padding: 6px 9px 6px 11px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--mut);
  font-size: .7rem;
  font-weight: 650;
}

.assistant-content-toolbar > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.assistant-content-action,
.assistant-message-action {
  padding: 4px 7px;
  border-radius: 6px;
  color: var(--mut);
  font-size: .68rem;
  font-weight: 650;
}

.assistant-content-action:hover,
.assistant-message-action:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.assistant-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.bubble-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}

.bubble-content th,
.bubble-content td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

.bubble-content th {
  background: var(--surface-subtle);
  font-weight: 650;
  white-space: nowrap;
}

.bubble-content tbody tr:last-child > * {
  border-bottom: 0;
}

.bubble-content a {
  color: var(--accent-strong);
  text-decoration: underline;
  text-decoration-color: var(--accent-mid);
  text-underline-offset: 2px;
}

.bubble-actions {
  display: flex;
  align-items: center;
  min-height: 28px;
  margin-top: 5px;
  opacity: .72;
}

.bubble:hover .bubble-actions,
.bubble:focus-within .bubble-actions {
  opacity: 1;
}

.assistant-chart {
  overflow: hidden;
}

.assistant-chart .assistant-content-toolbar strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-chart-legend {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.assistant-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.assistant-chart-legend i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--chart-color);
}

.assistant-chart-canvas {
  width: 100%;
  overflow-x: auto;
  padding: 8px 10px 0;
}

.assistant-chart-canvas svg {
  display: block;
  width: 100%;
  min-width: 520px;
  height: auto;
}

.assistant-chart-grid {
  stroke: var(--line-soft);
  stroke-width: 1;
}

.assistant-chart-zero {
  stroke: var(--mut);
  stroke-width: 1;
}

.assistant-chart-axis-label {
  fill: var(--mut);
  font-family: var(--mono);
  font-size: 10px;
}

.assistant-chart-mark {
  transition: opacity 120ms ease;
}

.assistant-chart-mark:hover {
  opacity: .72;
}

.assistant-chart-data {
  border-top: 1px solid var(--line-soft);
}

.assistant-chart-data summary {
  width: max-content;
  padding: 8px 11px;
  cursor: pointer;
  color: var(--mut);
  font-size: .7rem;
  font-weight: 650;
}

.assistant-chart-data .assistant-table-wrap {
  border-top: 1px solid var(--line-soft);
}

.source-list {
  gap: 6px;
}

.source-row {
  border: 1px solid var(--line-soft);
  background: var(--surface-subtle);
}

.source-row:hover {
  border-color: var(--accent-mid);
  background: var(--accent-soft);
}

.workspace.assistant-expanded .source-list,
.workspace.assistant-focus .source-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ask-search-view {
  display: grid;
  gap: 16px;
}

.ask-search-heading strong {
  font-family: var(--disp);
  font-size: 1rem;
}

.ask-search-heading .meta {
  margin-top: 3px;
}

.ask-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.ask-search-form input {
  min-width: 0;
}

.ask-workspace-search-results {
  min-width: 0;
}

#dpane-ai[data-workspace-mode="search"] > .dfoot {
  display: none !important;
}

@media (min-width: 1101px) {
  .app-shell.assistant-workspace-immersive {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  .app-shell.assistant-workspace-immersive > .sidebar {
    width: 0;
    min-width: 0;
    overflow: hidden;
    padding-inline: 0;
    border-right: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .workspace.assistant-expanded,
  .workspace.assistant-focus {
    padding-right: var(--drawer-w);
  }

  .workspace.assistant-expanded #dpane-ai.history-open > .dbody,
  .workspace.assistant-focus #dpane-ai.history-open > .dbody {
    display: grid;
    grid-template-columns: minmax(190px, 220px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    column-gap: 22px;
    overflow: hidden;
  }

  .workspace.assistant-expanded #ask-history-panel,
  .workspace.assistant-focus #ask-history-panel,
  .workspace.assistant-expanded #ask-conversation-view,
  .workspace.assistant-focus #ask-conversation-view {
    min-height: 0;
    overflow-y: auto;
  }

  .workspace.assistant-expanded #ask-conversation-view.history-suppressed,
  .workspace.assistant-focus #ask-conversation-view.history-suppressed {
    display: block;
    min-width: 0;
    padding-left: 22px;
    border-left: 1px solid var(--line-soft);
  }

  .workspace.assistant-expanded #dpane-ai.history-open > .dfoot:not([hidden]),
  .workspace.assistant-focus #dpane-ai.history-open > .dfoot:not([hidden]) {
    display: flex !important;
  }

  .workspace.assistant-expanded .assistant-log,
  .workspace.assistant-expanded .answer-sources {
    max-width: 860px;
  }

  .workspace.assistant-focus .assistant-log,
  .workspace.assistant-focus .answer-sources,
  .workspace.assistant-focus .ask-search-view {
    max-width: 960px;
  }

  .workspace.assistant-focus .bubble-content {
    font-size: .94rem;
  }
}

@media (max-width: 1100px) {
  .workspace.assistant-expanded .drawer {
    width: min(720px, calc(100% - 28px));
  }

  .workspace.assistant-focus .drawer {
    width: 100%;
  }
}

@media (min-width: 901px) and (max-width: 1100px) {
  .app-shell.assistant-workspace-focus {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  .app-shell.assistant-workspace-focus > .sidebar {
    width: 0;
    min-width: 0;
    overflow: hidden;
    padding-inline: 0;
    border-right: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

@media (max-width: 900px) {
  .workspace.assistant-expanded .drawer,
  .workspace.assistant-focus .drawer {
    width: 100%;
  }

  .ask-size-action,
  .ask-workspace-state-label {
    display: none;
  }

  .workspace.assistant-expanded .source-list,
  .workspace.assistant-focus .source-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .bubble-content {
    font-size: .88rem;
    line-height: 1.62;
  }

  .assistant-content-toolbar {
    align-items: flex-start;
  }

  .assistant-chart .assistant-content-toolbar {
    display: grid;
  }

  .assistant-chart-legend {
    justify-content: flex-start;
  }

  .assistant-chart-canvas {
    padding-inline: 4px;
  }
}

@media (max-width: 560px) {
  .workspace.assistant-open .drawer-title {
    display: none;
  }

  .workspace.assistant-open .ask-workspace-modes {
    margin-left: 0;
  }

  .workspace.assistant-open .ask-drawer-controls {
    margin-left: auto;
  }

  .ask-search-form {
    grid-template-columns: minmax(0, 1fr);
  }

  #dpane-ai > .dbody,
  .dfoot {
    padding-inline: 14px;
  }
}

@media (max-width: 430px) {
  .dhead {
    padding-inline: 10px;
  }

  .ask-header-action {
    padding-inline: 6px;
  }

  .drawer-title {
    max-width: 112px;
  }
}

/* =========================================================================
   UI v2 Phase 2 — conversation-first Project Overview
   ========================================================================= */
.project-view[data-active-tab="overview"] .workspace-head {
  position: relative;
  padding-top: 30px;
}

.project-view[data-active-tab="overview"] .titleline {
  justify-content: center;
  min-height: 36px;
}

.project-view[data-active-tab="overview"] .titleline > .spacer {
  display: none;
}

.project-view[data-active-tab="overview"] .titleline > #project-title {
  width: 100%;
  text-align: center;
}

.project-view[data-active-tab="overview"] .titleline h2 {
  font-size: 1.65rem;
}

.project-view[data-active-tab="overview"] .project-header-actions {
  position: absolute;
  top: 22px;
  right: 28px;
}

.project-view[data-active-tab="overview"] #project-breadcrumb,
.project-view[data-active-tab="overview"] #project-chips {
  display: none;
}

.project-view[data-active-tab="overview"] .project-query {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  max-width: 660px;
  margin: 18px auto 22px;
  padding: 8px;
  border: 1.5px solid var(--accent-mid);
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 6px 24px rgb(66 176 213 / 9%);
}

.project-view[data-active-tab="overview"] .project-query .home-query-form {
  grid-column: 1 / -1;
  grid-row: 1;
  border: 0;
  box-shadow: none;
}

.project-view[data-active-tab="overview"] .project-query-head {
  grid-column: 1;
  grid-row: 2;
  margin: 2px 8px 2px;
}

.project-view[data-active-tab="overview"] #project-query-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.project-view[data-active-tab="overview"] .project-query .home-query-scope {
  grid-column: 2 / -1;
  grid-row: 2;
  align-self: center;
  justify-self: end;
  margin: 2px 8px;
  font-size: .74rem;
  color: var(--faint);
}

.project-view[data-active-tab="overview"] .project-query .home-query-response,
.project-view[data-active-tab="overview"] .project-query .home-search-panel {
  grid-column: 1 / -1;
}

.project-view[data-active-tab="overview"] .project-query.is-empty-project {
  border-color: var(--line);
  box-shadow: none;
  opacity: .92;
}

.project-view[data-active-tab="overview"] .project-query.is-empty-project .home-query-scope {
  grid-column: 1 / -1;
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 7px;
}

.project-view[data-active-tab="overview"] .project-query.is-empty-project .home-query-scope::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d9a441;
  flex: none;
}

.project-view[data-active-tab="overview"] .project-query.is-empty-project .btn {
  background: #cfe0dd;
  color: #5d7a76;
}

.overview-v2-layout {
  display: grid;
  grid-template-columns: minmax(0, 660px) 320px;
  justify-content: center;
  align-items: start;
  gap: 36px;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
}

.overview-conversation-column,
.overview-knowledge-rail {
  min-width: 0;
}

.overview-knowledge-rail {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.project-brief {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 7px;
  margin: 0 auto 22px;
  max-width: 600px;
  color: var(--mut);
  text-align: center;
  line-height: 1.55;
}

.project-brief .spark {
  color: var(--accent-strong);
  flex: none;
  margin-top: 2px;
}

.overview-summary-body {
  font-size: .9rem;
}

.project-brief-edit {
  position: relative;
  flex: none;
}

.project-brief-edit > summary {
  color: var(--faint);
  font-size: .72rem;
  cursor: pointer;
  list-style: none;
}

.project-brief-edit > summary::-webkit-details-marker {
  display: none;
}

.project-brief-edit-menu {
  position: absolute;
  z-index: 10;
  top: calc(100% + 5px);
  right: 0;
  min-width: 140px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.overview-conversations {
  margin-top: 8px;
}

.overview-section-label,
.overview-rail-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.overview-section-label {
  justify-content: space-between;
  margin-bottom: 10px;
}

.overview-section-label h2,
.overview-rail-head h2 {
  margin: 0;
  color: var(--faint);
  font-size: .74rem;
  font-weight: 750;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font: inherit;
  font-size: .77rem;
  font-weight: 650;
  padding: 2px;
}

.overview-conversation-list {
  display: grid;
  gap: 8px;
}

.overview-conversation-card {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  text-align: left;
}

.overview-conversation-card:hover,
.overview-conversation-card:focus-visible {
  border-color: var(--accent-mid);
}

.overview-conversation-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.overview-conversation-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.overview-conversation-copy strong,
.overview-conversation-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-conversation-copy strong {
  font-size: .84rem;
}

.overview-conversation-copy span,
.overview-conversation-card time,
.overview-conversation-empty {
  color: var(--faint);
  font-size: .73rem;
}

.overview-conversation-card time {
  font-family: var(--mono);
  white-space: nowrap;
}

.overview-activity-summary {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin-top: 22px;
  color: var(--faint);
  font-size: .77rem;
  text-align: center;
}

.overview-activity-summary p {
  margin: 0;
}

.overview-activity-expanded {
  margin-top: 12px;
  padding: 14px;
  border-top: 1px solid var(--line-soft);
}

.overview-activity-expanded .activity-detail-toggle {
  justify-content: flex-end;
  margin: 0 0 10px auto;
}

.overview-rail-card,
.project-setup-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.overview-rail-head {
  margin-bottom: 10px;
}

.overview-rail-head .text-button,
.overview-rail-head .count {
  margin-left: auto;
}

#overview-approval-card {
  border-color: #ecd9ad;
  background: linear-gradient(180deg, #fefaf1, var(--card));
}

.overview-ok-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.overview-ok-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
}

.overview-ok-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.overview-ok-title {
  overflow: hidden;
  font-size: .78rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-ok-destination {
  max-width: 92px;
  padding: 2px 7px;
  overflow: hidden;
  border-radius: 5px;
  background: var(--success-soft);
  color: var(--success-strong);
  font-size: .67rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-ok-button,
.overview-accept-all {
  border: 0;
  border-radius: 6px;
  background: var(--success);
  color: #fff;
  font: inherit;
  font-size: .72rem;
  font-weight: 650;
}

.overview-ok-button {
  padding: 5px 9px;
}

.overview-accept-all {
  width: 100%;
  margin-top: 8px;
  padding: 8px;
}

.overview-ok-row .attention-preview {
  grid-column: 1 / -1;
  width: 100%;
}

.overview-knowledge-list,
.overview-source-list {
  display: grid;
}

.overview-knowledge-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--mut);
  text-align: left;
}

.overview-knowledge-row strong {
  color: var(--ink);
  font-family: var(--mono);
  font-size: .74rem;
  text-align: right;
}

.overview-source-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  color: var(--mut);
  font-size: .77rem;
}

.overview-source-row > span:first-child {
  color: #3aa66f;
  font-weight: 750;
}

.overview-source-row > span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-source-row small {
  color: var(--faint);
  font-family: var(--mono);
  font-size: .62rem;
  text-transform: uppercase;
}

.overview-source-empty,
.overview-index-status {
  margin: 0;
  color: var(--faint);
  font-size: .73rem;
}

.overview-setup-rail-list,
#overview-setup-rail-list {
  display: grid;
}

#overview-setup-rail-list button {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 0;
  border: 0;
  background: transparent;
  color: var(--mut);
  font: inherit;
  font-size: .78rem;
  text-align: left;
}

.overview-empty-setup {
  display: grid;
  gap: 22px;
}

.overview-time-project {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--accent-mid);
  border-radius: 12px;
  background: var(--card);
}

.overview-time-project-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.overview-time-project-copy h2,
.overview-time-project-copy p {
  margin: 0;
}

.overview-time-project-copy h2 {
  margin-top: 3px;
  font-size: 1rem;
}

.overview-time-project-copy > p:last-child {
  margin-top: 5px;
  color: var(--mut);
  font-size: .82rem;
  line-height: 1.5;
}

.overview-time-project-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

@media (max-width: 800px) {
  .overview-time-project {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .overview-time-project-actions {
    grid-column: 1 / -1;
    flex-wrap: wrap;
  }
}

.project-setup-card {
  padding: 0;
  overflow: hidden;
}

.project-setup-head {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
}

.project-setup-head h2 {
  margin: 0;
  font-size: 1rem;
}

.project-setup-head p {
  margin: 4px 0 0;
  color: var(--mut);
  font-size: .8rem;
  line-height: 1.5;
}

.project-setup-progress {
  height: 6px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-subtle);
}

.project-setup-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--success);
  transition: width .18s ease;
}

.project-setup-step {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 15px 22px;
  border-bottom: 1px solid var(--line);
}

.project-setup-step:last-child {
  border-bottom: 0;
}

.project-setup-tick {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 2px solid var(--line);
  border-radius: 50%;
  color: #fff;
}

.project-setup-step.done .project-setup-tick {
  border-color: var(--success);
  background: var(--success);
}

.project-setup-copy {
  display: grid;
  gap: 2px;
}

.project-setup-copy strong {
  font-size: .84rem;
}

.project-setup-copy span,
.project-setup-done {
  color: var(--mut);
  font-size: .75rem;
  line-height: 1.4;
}

.project-setup-done {
  color: var(--success-strong);
  font-weight: 650;
}

.project-setup-action {
  padding: 7px 13px;
  border: 1px solid var(--accent-mid);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font: inherit;
  font-size: .77rem;
  font-weight: 650;
}

.project-question-preview {
  padding: 19px 21px;
  border: 1px dashed var(--accent-mid);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--accent-soft), var(--card));
}

.project-question-preview h3 {
  margin: 0;
  color: var(--accent-strong);
  font-size: .76rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.project-question-preview p {
  margin: 5px 0 12px;
  color: var(--mut);
  font-size: .77rem;
  line-height: 1.5;
}

.project-question-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-question-examples span {
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--faint);
  font-size: .76rem;
}

.project-details-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

@media (max-width: 999px) {
  .overview-v2-layout {
    grid-template-columns: minmax(0, 660px);
  }

  .overview-knowledge-rail {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  .project-view[data-active-tab="overview"] .project-header-actions {
    position: static;
    width: 100%;
    justify-content: center;
    margin: 4px 0 0;
  }
}

@container (max-width: 999px) {
  .overview-v2-layout {
    grid-template-columns: minmax(0, 660px);
  }

  .overview-knowledge-rail {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  .project-view[data-active-tab="overview"] .project-header-actions {
    position: static;
    width: 100%;
    justify-content: center;
    margin: 4px 0 0;
  }
}

@media (max-width: 600px) {
  .project-view[data-active-tab="overview"] .workspace-head {
    padding-top: 18px;
  }

  .project-view[data-active-tab="overview"] .project-query {
    grid-template-columns: minmax(0, 1fr);
    margin-top: 14px;
  }

  .project-view[data-active-tab="overview"] .project-query-head,
  .project-view[data-active-tab="overview"] .project-query .home-query-scope {
    grid-column: 1;
  }

  .project-view[data-active-tab="overview"] .project-query-head {
    grid-row: 2;
  }

  .project-view[data-active-tab="overview"] .project-query .home-query-scope {
    grid-row: 3;
    justify-self: start;
    text-align: left;
  }

  .overview-v2-layout {
    display: block;
  }

  .overview-knowledge-rail {
    margin-top: 24px;
  }

  .overview-conversation-card {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .overview-conversation-card time {
    grid-column: 2;
  }

  .overview-activity-summary {
    align-items: center;
    flex-direction: column;
  }

  .project-setup-step {
    grid-template-columns: 26px minmax(0, 1fr);
    align-items: start;
    padding: 14px;
  }

  .project-setup-action,
  .project-setup-done {
    grid-column: 2;
    justify-self: start;
  }

  .project-question-examples {
    display: grid;
  }
}

@container (max-width: 600px) {
  .overview-v2-layout {
    display: block;
  }

  .overview-knowledge-rail {
    margin-top: 24px;
  }
}

/* =========================================================================
   UI v2 Phase 3 — project data views and local navigation
   ========================================================================= */
.project-view[data-active-tab] .workspace-head {
  position: relative;
  padding: 24px 28px 18px;
}

.project-view .titleline {
  justify-content: center;
  min-height: 36px;
}

.project-view .titleline > .spacer {
  display: none;
}

.project-view .titleline > #project-title {
  width: 100%;
  text-align: center;
}

.project-view[data-active-tab] .project-header-actions {
  position: absolute;
  top: 17px;
  right: 28px;
}

.project-view #project-breadcrumb,
.project-view #project-chips {
  display: none;
}

.project-view:not([data-active-tab="overview"]) .project-query {
  display: none;
}

.project-data-nav {
  display: flex;
  align-items: stretch;
  gap: 14px;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  flex: none;
}

.project-data-nav[hidden],
.project-data-nav.hidden {
  display: none !important;
}

.project-data-nav .project-tabs {
  min-width: 0;
  flex: 1;
  align-items: stretch;
}

.project-data-nav .tab {
  min-height: 48px;
  padding: 10px 12px 8px;
  border-bottom-width: 2.5px;
  border-radius: 0;
  background: transparent;
}

.project-data-nav .tab:hover {
  background: var(--surface-subtle);
}

.project-data-nav #tab-overview {
  color: var(--accent-strong);
}

.project-local-ask {
  display: inline-flex;
  align-items: center;
  align-self: center;
  gap: 7px;
  max-width: 220px;
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid var(--accent-mid);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font: inherit;
  font-size: .76rem;
  font-weight: 650;
  white-space: nowrap;
}

.project-local-ask:hover,
.project-local-ask:focus-visible {
  border-color: var(--accent-strong);
  background: var(--accent-mid);
}

.project-local-ask > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-view-heading {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.project-details-phase {
  display: inline-flex;
  margin: -8px 0 16px;
  color: var(--accent-strong);
}

.project-details-phase[hidden],
.project-details-phase.hidden {
  display: none;
}

@media (max-width: 999px) {
  .project-view[data-active-tab] .project-header-actions {
    position: static;
    width: 100%;
    justify-content: center;
    margin: 4px 0 0;
  }

  .project-data-nav {
    padding-inline: 18px;
  }
}

@container (max-width: 999px) {
  .project-view[data-active-tab] .project-header-actions {
    position: static;
    width: 100%;
    justify-content: center;
    margin: 4px 0 0;
  }

  .project-data-nav {
    padding-inline: 18px;
  }
}

@media (max-width: 600px) {
  .project-view[data-active-tab] .workspace-head {
    padding: 16px 14px 14px;
  }

  .project-view[data-active-tab] .project-header-actions {
    gap: 2px;
  }

  .project-view .project-header-actions .btn {
    padding-inline: 7px;
  }

  .project-data-nav {
    gap: 7px;
    min-height: 46px;
    padding-inline: 8px;
  }

  .project-data-nav .tab {
    min-height: 46px;
    padding-inline: 10px;
  }

  .project-local-ask {
    width: 34px;
    min-width: 34px;
    padding-inline: 0;
    justify-content: center;
  }

  .project-local-ask > span:last-child {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Final cascade for Phase 3c: these intentionally follow Phase 3's shared
   hero rules so only non-Overview views use the compact header. */
.project-view:not([data-active-tab="overview"]) .workspace-head {
  position: static;
  min-height: 46px;
  padding: 7px 28px;
}

.project-view:not([data-active-tab="overview"]) .titleline {
  flex-wrap: nowrap;
  justify-content: flex-start;
  min-height: 32px;
}

.project-view:not([data-active-tab="overview"]) .titleline > #project-title {
  width: auto;
  max-width: min(48vw, 620px);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.08rem;
}

.project-view:not([data-active-tab="overview"]) .project-header-actions {
  position: static;
  top: auto;
  right: auto;
  width: auto;
  margin: 0 0 0 auto;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 3px;
}

@media (max-width: 999px) {
  .project-view:not([data-active-tab="overview"]) .project-header-actions {
    position: static;
    width: auto;
    margin: 0 0 0 auto;
    justify-content: flex-end;
  }
}

@container (max-width: 999px) {
  .project-view:not([data-active-tab="overview"]) .project-header-actions {
    position: static;
    width: auto;
    margin: 0 0 0 auto;
    justify-content: flex-end;
  }
}

@media (max-width: 600px) {
  .project-view:not([data-active-tab="overview"]) .workspace-head {
    padding: 6px 10px;
  }

  .project-view:not([data-active-tab="overview"]) .titleline > #project-title {
    max-width: calc(100vw - 190px);
    font-size: .92rem;
  }

  .project-view:not([data-active-tab="overview"]) .project-header-actions {
    width: auto;
    margin-left: auto;
    gap: 2px;
  }

  .project-view:not([data-active-tab="overview"]) .project-action-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
}

/* Mobile usability pass: these final overrides intentionally follow every
   phase stylesheet so legacy media blocks cannot reintroduce phone defects. */
@media (max-width: 600px) {
  .workspace.assistant-open .drawer {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
  }

  .workspace.assistant-open .dhead {
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
    min-width: 0;
    padding: 9px 10px;
  }

  .workspace.assistant-open .ask-workspace-modes {
    flex: none;
  }

  .workspace.assistant-open .ask-drawer-controls {
    display: flex;
    flex: 1 1 auto;
    justify-content: flex-end;
    min-width: 0;
    margin-left: auto;
  }

  .workspace.assistant-open .dclose {
    flex: none;
    margin-left: 0;
  }

  #dpane-ai,
  #dpane-ai > .dbody {
    min-height: 0;
  }

  #dpane-ai > .dbody {
    flex: 1 1 auto;
    padding: 12px 14px;
  }

  #dpane-ai:not(.history-open) > .dfoot:not([hidden]) {
    display: flex !important;
  }

  #dpane-ai > .dfoot {
    position: sticky;
    bottom: 0;
    z-index: 3;
    padding: 10px 14px max(10px, env(safe-area-inset-bottom));
    background: var(--surface-raised);
  }

  #home-query-form {
    grid-template-columns: auto minmax(0, 1fr);
  }

  #home-query-form .home-query-scope-chip,
  #home-query-form > button[type="submit"] {
    grid-row: 1;
  }

  #home-query-form > button[type="submit"] {
    grid-column: 2;
  }

  #home-query-form > input {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .home-conversation-card {
    min-height: 0;
    padding: 11px 12px;
  }

  .home-conversation-card:first-child {
    min-height: 94px;
  }

  .home-conversation-card:not(:first-child) .home-conversation-snippet {
    display: none;
  }

  .project-view[data-active-tab="overview"] .workspace-head {
    padding: 14px 14px 10px;
  }

  .project-view[data-active-tab="overview"] .project-query {
    gap: 8px;
    margin-top: 10px;
    padding: 10px;
  }

  .overview-knowledge-rail {
    gap: 14px;
    margin-top: 18px;
  }

  .overview-knowledge-row {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    min-height: 42px;
  }

  .overview-knowledge-row strong {
    text-align: left;
  }

  .ask-header-action {
    min-height: 36px;
  }

  .ask-context-header {
    padding: 10px 14px;
  }

  #dpane-ai > .dbody {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  #dpane-ai > .dfoot {
    gap: 8px;
    box-shadow: 0 -8px 24px rgba(16, 24, 32, .06);
  }

  #dpane-ai > .dfoot input {
    min-width: 0;
  }

  #dpane-ai > .dfoot button[type="submit"] {
    flex: none;
    width: max-content;
    min-width: 64px;
  }

  .assistant-suggestions {
    display: none !important;
  }

  .ask-history-heading {
    margin-bottom: 8px;
  }

  .ask-history-group + .ask-history-group {
    margin-top: 12px;
  }

  .ask-history-entry {
    min-height: 52px;
    padding: 8px 6px;
  }

  #home-query-form .home-query-scope-chip {
    grid-column: 1;
  }

  #home-query-form > input {
    min-height: 42px;
  }

  .home-query-foot {
    align-items: center;
    gap: 8px;
  }

  .home-query-scope {
    overflow: hidden;
    font-size: .68rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .home-conversations {
    margin-bottom: 22px;
  }

  .home-conversation-list {
    gap: 8px;
  }

  .home-attention-head {
    align-items: center;
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .home-attention-head #refresh-work-inbox {
    margin-left: auto;
  }

  .home-attention-head .filters {
    order: 20;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .home-attention-head .filters::-webkit-scrollbar,
  .project-view[data-active-tab="overview"] .project-header-actions::-webkit-scrollbar {
    display: none;
  }

  .home-attention-head .filters .fchip {
    flex: none;
  }

  #work-inbox:has(.empty-state) + .queue-footer {
    display: none;
  }

  .home-recent-card {
    padding: 8px 12px;
  }

  #home-activity > .timeline-item:nth-child(n + 6) {
    display: none;
  }

  .home-recent-card .timeline-item {
    padding-block: 11px;
  }

  .home-recent-card .timeline-title {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    white-space: normal;
  }

  .project-view[data-active-tab="overview"] .titleline > #project-title {
    font-size: 1.35rem;
  }

  .project-view[data-active-tab="overview"] .project-header-actions {
    gap: 2px;
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .project-view[data-active-tab="overview"] .project-query .home-query-form {
    gap: 6px;
  }

  .project-view[data-active-tab="overview"] .project-query .home-query-form .btn {
    flex: none;
    min-width: 72px;
  }

  .overview-rail-card {
    padding: 14px 16px;
  }

  .overview-source-row,
  #overview-setup-rail-list button {
    min-height: 42px;
  }
}
/* ---------- Team Chat workspace (Nextcloud Talk remains the source of truth) ---------- */
.talk-workspace-view {
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg, #f5f7f8);
}

.talk-workspace-shell {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  width: 100%;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  background: #fff;
}

.talk-conversation-pane {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--line, #dfe5e7);
  background: #fff;
}

.talk-workspace-list-head,
.talk-thread-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line, #dfe5e7);
}

.talk-workspace-list-head > div,
.talk-thread-identity {
  min-width: 0;
  flex: 1;
}

.talk-thread-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.talk-project-room-switcher select {
  width: min(300px, 34vw);
  min-width: 150px;
  height: 38px;
  padding: 7px 30px 7px 10px;
}

.talk-thread-menu {
  position: relative;
}

.talk-thread-menu > summary {
  display: grid;
  list-style: none;
  place-items: center;
}

.talk-thread-menu > summary::-webkit-details-marker {
  display: none;
}

.talk-thread-menu .popover-menu {
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  min-width: 210px;
}

.talk-workspace-list-head h1,
.talk-thread-head h2 {
  margin: 0;
  font-size: 18px;
}

.talk-workspace-list-head p,
.talk-thread-head p {
  overflow: hidden;
  margin: 3px 0 0;
  color: var(--muted, #738088);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.talk-conversation-search {
  padding: 12px 14px 8px;
}

.talk-conversation-search input {
  width: 100%;
  border: 1px solid var(--line, #dfe5e7);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--soft, #f5f7f8);
}

.talk-workspace-status,
.talk-upload-status {
  min-height: 20px;
  padding: 0 16px;
  color: var(--muted, #738088);
  font-size: 12px;
}

.talk-conversation-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 18px;
}

.talk-conversation-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  width: 100%;
  padding: 11px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.talk-conversation-item:hover,
.talk-conversation-item.active {
  background: var(--accent-soft);
}

.talk-conversation-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
}

.talk-conversation-copy {
  min-width: 0;
}

.talk-conversation-copy strong,
.talk-conversation-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.talk-conversation-copy span {
  margin-top: 4px;
  color: var(--muted, #738088);
  font-size: 12px;
}

.talk-conversation-meta {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 7px;
  color: var(--muted, #738088);
  font-size: 11px;
}

.talk-unread-count,
.nav-count {
  display: inline-grid;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  place-items: center;
  border-radius: 99px;
  background: var(--accent);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.wide-button .nav-count {
  margin-left: auto;
}

.talk-thread-pane {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  background: #f7f9f9;
}

.talk-thread-head {
  background: #fff;
}

.talk-thread-back {
  display: none;
}

.talk-workspace-messages {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 7px;
  overflow-y: auto;
  padding: 22px clamp(16px, 5vw, 72px);
}

.talk-workspace-empty {
  margin: auto;
  max-width: 420px;
  color: var(--muted, #738088);
  text-align: center;
}

.talk-workspace-message {
  align-self: flex-start;
  max-width: min(76%, 720px);
  padding: 9px 12px 7px;
  border: 1px solid var(--line, #dfe5e7);
  border-radius: 5px 15px 15px;
  background: #fff;
  box-shadow: 0 1px 2px rgb(15 30 35 / 5%);
}

.talk-workspace-message.own {
  align-self: flex-end;
  border-color: var(--accent-mid);
  border-radius: 15px 5px 15px 15px;
  background: var(--accent-soft);
}

.talk-workspace-message.system {
  align-self: center;
  max-width: 80%;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--muted, #738088);
  font-size: 12px;
  text-align: center;
}

.talk-workspace-message-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

.talk-workspace-message-head strong {
  color: var(--accent-strong);
  font-size: 12px;
}

.talk-workspace-message-head time {
  margin-left: auto;
  color: var(--muted, #738088);
  font-size: 10px;
}

.talk-message-parent {
  margin-bottom: 7px;
  padding: 6px 8px;
  border-left: 3px solid var(--accent-strong);
  border-radius: 5px;
  background: rgb(255 255 255 / 65%);
  color: var(--muted, #56636a);
  font-size: 12px;
}

.talk-message-parent strong,
.talk-message-parent span {
  display: block;
}

.talk-message-body {
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.talk-message-media {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.talk-message-image {
  display: block;
  max-width: min(420px, 100%);
  max-height: 360px;
  border-radius: 9px;
  object-fit: contain;
}

.talk-message-audio {
  width: min(360px, 100%);
}

.talk-message-file {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--accent-mid);
  border-radius: 8px;
  background: rgb(255 255 255 / 65%);
  color: inherit;
  text-decoration: none;
}

.talk-message-image-button {
  display: block;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: transparent;
}

.talk-message-image-button .talk-message-image {
  width: 100%;
}

.talk-message-actions,
.talk-message-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.talk-message-actions button,
.talk-message-reactions button {
  border: 1px solid var(--line, #dfe5e7);
  border-radius: 99px;
  padding: 2px 7px;
  background: #fff;
  color: inherit;
  font-size: 11px;
}

.talk-message-reactions button.mine {
  border-color: var(--accent-strong);
  background: var(--accent-soft);
}

.talk-message-inline-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
}

.talk-message-inline-actions button {
  padding: 3px 6px;
  color: var(--muted, #738088);
  font-size: .68rem;
}

.talk-reply-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 18px;
  border-top: 1px solid var(--line, #dfe5e7);
  background: var(--accent-soft);
  font-size: 12px;
}

.talk-reply-preview p {
  overflow: hidden;
  margin: 2px 0 0;
  color: var(--muted, #738088);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.talk-reply-preview button {
  border: 0;
  background: transparent;
  font-size: 22px;
}

.talk-workspace-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--line, #dfe5e7);
  background: #fff;
}

.talk-composer-field {
  flex: 1;
}

.talk-composer-field textarea {
  display: block;
  width: 100%;
  max-height: 140px;
  resize: none;
  border: 1px solid var(--line, #dfe5e7);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
}

.talk-record-button.recording {
  background: #fee2e2;
  color: #b42318;
  animation: talk-recording-pulse 1.2s infinite;
}

@keyframes talk-recording-pulse {
  50% { box-shadow: 0 0 0 5px rgb(180 35 24 / 12%); }
}

.talk-new-dialog .project-form {
  width: min(560px, calc(100vw - 32px));
}

.talk-kind-switch {
  display: flex;
  gap: 8px;
}

.talk-kind-switch label {
  padding: 8px 12px;
  border: 1px solid var(--line, #dfe5e7);
  border-radius: 9px;
}

.talk-contact-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--line, #dfe5e7);
  border-radius: 10px;
}

.talk-contact-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line, #dfe5e7);
}

.talk-contact-row:last-child {
  border-bottom: 0;
}

.talk-contact-row span {
  min-width: 0;
}

.talk-contact-row strong,
.talk-contact-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.talk-contact-row small {
  color: var(--muted, #738088);
}

@media (max-width: 760px) {
  .talk-workspace-view {
    height: calc(100dvh - var(--topbar-h));
    min-height: 0;
  }

  .talk-workspace-shell {
    display: block;
    position: relative;
  }

  .talk-conversation-pane,
  .talk-thread-pane {
    position: absolute;
    inset: 0;
  }

  .talk-thread-pane {
    display: none;
  }

  .talk-workspace-shell.thread-open .talk-conversation-pane {
    display: none;
  }

  .talk-workspace-shell.thread-open .talk-thread-pane {
    display: flex;
  }

  .talk-thread-back {
    display: inline-grid;
  }

  .talk-workspace-list-head,
  .talk-thread-head {
    min-height: 64px;
    padding: 10px 12px;
  }

  .talk-workspace-messages {
    padding: 14px 10px;
  }

  .talk-workspace-message {
    max-width: 88%;
  }

  .talk-workspace-composer {
    gap: 5px;
    padding: 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .talk-send-button {
    padding-inline: 12px;
  }

  #talk-open-native {
    padding: 7px;
    font-size: 0;
  }

  #talk-open-native::after {
    content: "Talk";
    font-size: 12px;
  }
}

.talk-knowledge-settings {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
}

.talk-knowledge-heading,
.talk-knowledge-room-head,
.talk-knowledge-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.talk-knowledge-heading h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.talk-knowledge-room-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.talk-knowledge-room {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 14px;
}

.talk-knowledge-room-head strong,
.talk-knowledge-room-head span {
  display: block;
}

.talk-knowledge-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  margin: 14px 0;
}

.talk-knowledge-options label {
  margin: 0;
}

.talk-knowledge-actions {
  justify-content: flex-start;
  margin-bottom: 10px;
}

.talk-knowledge-error,
.privacy-note {
  color: var(--red);
  font-size: .82rem;
  line-height: 1.4;
  margin: 10px 0 0;
}

@media (max-width: 720px) {
  .talk-knowledge-heading,
  .talk-knowledge-room-head {
    align-items: stretch;
    flex-direction: column;
  }

  .talk-knowledge-options {
    grid-template-columns: 1fr;
  }

  .talk-knowledge-actions button {
    flex: 1;
  }
}

/* =========================================================================
   Mobile cockpit — additive phone layout. Desktop selectors above remain the
   source of truth; every existing workflow stays available at larger widths.
   ========================================================================= */
.mobile-primary-nav {
  display: none;
}

.mobile-project-menu-action {
  display: none;
}

.mobile-projects-view {
  background: var(--bg, #f5f7f8);
}

.mobile-projects-wrap {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 30px clamp(18px, 5vw, 42px) 60px;
}

.mobile-screen-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.mobile-screen-head h1,
.mobile-screen-head p,
.mobile-eyebrow {
  margin: 0;
}

.mobile-screen-head h1 {
  font-size: 2rem;
}

.mobile-screen-head > div > p:last-child {
  margin-top: 5px;
  color: var(--muted);
}

.mobile-eyebrow {
  color: var(--accent-strong);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.mobile-ask-all {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-bottom: 18px;
  padding: 15px;
  border: 1px solid var(--accent-mid);
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent-soft), #fff);
  color: var(--ink);
  text-align: left;
}

.mobile-ask-all-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: var(--accent);
  color: var(--ink);
  font-size: 1.1rem;
}

.mobile-ask-all strong,
.mobile-ask-all small {
  display: block;
}

.mobile-ask-all small {
  margin-top: 3px;
  color: var(--muted);
  font-size: .72rem;
}

.mobile-project-search {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  color: var(--muted);
}

.mobile-project-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  padding: 0;
  outline: 0;
  background: transparent;
}

.mobile-project-filters {
  display: flex;
  gap: 7px;
  margin: 14px 0 9px;
  overflow-x: auto;
  scrollbar-width: none;
}

.mobile-project-filters::-webkit-scrollbar {
  display: none;
}

.mobile-project-filters button {
  flex: none;
  min-height: 36px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
}

.mobile-project-filters button.on {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.mobile-project-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.mobile-project-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 68px;
  padding: 10px 13px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: inherit;
  text-align: left;
}

.mobile-project-row:last-child {
  border-bottom: 0;
}

.mobile-project-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 750;
}

.mobile-project-copy {
  min-width: 0;
}

.mobile-project-copy strong,
.mobile-project-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-project-copy small {
  margin-top: 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .68rem;
}

.mobile-project-badge {
  display: grid;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  place-items: center;
  border-radius: 99px;
  background: #fee9e6;
  color: #a43b2f;
  font-size: .67rem;
  font-weight: 750;
}

.mobile-project-chevron {
  color: var(--muted);
  font-size: 1.35rem;
}

.mobile-project-empty {
  margin: 0;
  padding: 28px 18px;
  color: var(--muted);
  text-align: center;
}

.talk-message-actions-toggle {
  display: none;
}

.talk-image-viewer {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #07100f;
  color: #fff;
}

.talk-image-viewer::backdrop {
  background: rgb(0 0 0 / 88%);
}

.talk-image-viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 8px 14px;
  background: rgb(0 0 0 / 38%);
}

.talk-image-viewer-head > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.talk-image-viewer-head a,
.talk-image-viewer-head button {
  color: #fff;
}

.talk-image-viewer-stage {
  display: grid;
  height: calc(100% - 58px);
  place-items: center;
  overflow: auto;
  touch-action: pinch-zoom;
}

.talk-image-viewer-stage img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

@media (max-width: 760px) {
  :root {
    --topbar-h: 56px;
    --mobile-nav-h: 66px;
  }

  html,
  body,
  .app-shell,
  .workspace {
    height: 100dvh;
  }

  html,
  body {
    overflow: hidden;
  }

  .workspace {
    padding-bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom));
  }

  .view,
  .talk-workspace-view {
    scrollbar-gutter: auto;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 45;
    min-height: var(--topbar-h);
    padding: 8px 12px;
    background: rgb(255 255 255 / 96%);
    backdrop-filter: blur(12px);
  }

  #drawer-talk.mobile-chat-shortcut:not([hidden]) {
    display: none;
  }

  .topbar-search {
    margin-left: auto;
  }

  .workspace.talk-context .topbar-search,
  .workspace.talk-context .create-wrap,
  .workspace.time-context .topbar-search {
    display: none;
  }

  .create-wrap .popover-menu {
    position: fixed;
    right: 12px;
    bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom) + 10px);
    left: 12px;
    top: auto;
    min-width: 0;
    padding: 8px;
    border-radius: 16px;
    box-shadow: 0 18px 56px rgb(16 24 32 / 24%);
  }

  #create-menu .menu-item {
    min-height: 48px;
    border-radius: 10px;
    font-size: .92rem;
  }

  .mobile-primary-nav {
    position: fixed;
    z-index: 100;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-height: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom));
    padding: 6px 6px max(6px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgb(255 255 255 / 97%);
    box-shadow: 0 -8px 26px rgb(16 24 32 / 7%);
    backdrop-filter: blur(15px);
  }

  .mobile-primary-nav > button {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    min-height: 50px;
    padding: 4px 2px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--muted);
    font-size: .63rem;
    font-weight: 650;
  }

  .mobile-primary-nav svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
  }

  .mobile-primary-nav > button.active {
    color: var(--accent-strong);
    background: var(--accent-soft);
  }

  .mobile-primary-nav .mobile-nav-ask {
    overflow: visible;
    color: var(--accent-strong);
  }

  .mobile-nav-ask-orb {
    display: grid;
    width: 38px;
    height: 38px;
    margin-top: -20px;
    place-items: center;
    border: 4px solid #fff;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 6px 18px rgb(66 176 213 / 28%);
    color: var(--ink);
    font-size: 1rem;
  }

  .mobile-projects-wrap {
    padding: 18px 14px 30px;
  }

  .mobile-project-menu-action {
    display: block;
  }

  .mobile-screen-head {
    align-items: center;
    margin-bottom: 16px;
  }

  .mobile-screen-head h1 {
    font-size: 1.65rem;
  }

  .mobile-screen-head > div > p:last-child {
    display: none;
  }

  .home-view {
    background: var(--bg);
  }

  .home-wrap {
    padding-inline: 14px;
  }

  .home-greeting-block {
    margin-bottom: 16px;
  }

  .home-greeting-block h1 {
    font-size: 1.65rem;
  }

  .home-greeting-block .sub {
    font-size: .8rem;
  }

  .home-query {
    position: sticky;
    top: 8px;
    z-index: 8;
    margin-bottom: 22px;
    padding: 10px;
    border-radius: 15px;
    box-shadow: 0 8px 28px rgb(66 176 213 / 12%);
  }

  #home-query-form {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
  }

  #home-query-form > input {
    grid-column: 1;
    grid-row: 1;
    min-height: 46px;
    padding: 10px 12px;
  }

  #home-query-form > button[type="submit"] {
    grid-column: 2;
    grid-row: 1;
    min-height: 46px;
  }

  #home-query-form .home-query-scope-chip {
    grid-column: 1 / -1;
    grid-row: 2;
    width: max-content;
    height: 28px;
    min-height: 28px;
    padding: 3px 9px;
    font-size: 0;
  }

  #home-query-form .home-query-scope-chip::before {
    content: "All project data";
    font-size: .68rem;
  }

  .home-query-foot {
    margin-top: 2px;
  }

  .home-query-scope {
    font-size: .64rem;
  }

  .home-conversations {
    margin-bottom: 18px;
  }

  .home-conversation-list {
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
  }

  .home-conversation-card,
  .home-conversation-card:first-child {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 68px;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    border-radius: 0;
    box-shadow: none;
  }

  .home-conversation-card:last-child {
    border-bottom: 0;
  }

  .home-conversation-card .home-conversation-scope,
  .home-conversation-card .home-conversation-title,
  .home-conversation-card .home-conversation-snippet {
    grid-column: 1;
  }

  .home-conversation-card .home-conversation-when {
    grid-column: 2;
    grid-row: 1;
  }

  .home-conversation-card .home-conversation-snippet,
  .home-conversation-card:not(:first-child) .home-conversation-snippet {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
  }

  .home-wrap:has(#work-inbox.is-empty) .home-attention-head {
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 14px 14px 0 0;
    background: #fff;
  }

  .home-wrap:has(#work-inbox.is-empty) .home-attention-head .filters,
  .home-wrap:has(#work-inbox.is-empty) #inbox-mark-all,
  .home-wrap:has(#work-inbox.is-empty) #refresh-work-inbox,
  .home-wrap:has(#work-inbox.is-empty) #inbox-view-all,
  .home-wrap:has(#work-inbox.is-empty) + .queue-footer {
    display: none !important;
  }

  #work-inbox.is-empty {
    margin-top: 0;
    border-top: 0;
    border-radius: 0 0 14px 14px;
  }

  #work-inbox.is-empty .empty-line {
    min-height: 0;
    padding: 4px 12px 12px;
    text-align: left;
  }

  .home-recent-head {
    align-items: baseline;
  }

  .home-recent-head .activity-detail-toggle {
    margin-left: auto;
  }

  .home-recent-card {
    border-radius: 14px;
  }

  .project-view[data-active-tab="overview"] .workspace-head {
    padding: 14px 14px 12px;
  }

  .project-view[data-active-tab="overview"] .titleline {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
    justify-items: start;
  }

  .project-view[data-active-tab="overview"] .titleline > #project-title {
    overflow: hidden;
    width: 100%;
    font-size: 1.35rem;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .project-view[data-active-tab="overview"] .project-header-actions {
    width: 100%;
    justify-content: flex-start;
    margin: 0;
  }

  .project-view[data-active-tab="overview"] #project-details,
  .project-view[data-active-tab="overview"] #sync {
    display: none;
  }

  .project-view[data-active-tab="overview"] #project-team-chat {
    min-height: 40px;
    padding: 7px 10px;
    border-color: var(--accent-mid);
    background: var(--accent-soft);
    color: var(--accent-strong);
  }

  .project-view[data-active-tab="overview"] #project-menu-btn {
    min-width: 40px;
    padding-inline: 10px;
  }

  .project-view[data-active-tab="overview"] .project-query {
    position: sticky;
    top: 8px;
    z-index: 8;
    margin: 10px 0 0;
    padding: 9px;
    border-radius: 15px;
  }

  .project-view[data-active-tab="overview"] .project-query-head,
  .project-view[data-active-tab="overview"] .project-query > .home-query-scope {
    display: none;
  }

  .project-view[data-active-tab="overview"] .project-query .home-query-form input,
  .project-view[data-active-tab="overview"] .project-query .home-query-form .btn {
    min-height: 46px;
  }

  .project-shell {
    padding: 14px;
  }

  .project-brief {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: start;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
  }

  .project-brief .overview-summary-body {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    cursor: pointer;
  }

  .project-brief .overview-summary-body::after {
    content: "  More";
    color: var(--accent-strong);
    font-size: .72rem;
    font-weight: 700;
  }

  .project-brief.mobile-expanded .overview-summary-body {
    display: block;
  }

  .project-brief.mobile-expanded .overview-summary-body::after {
    content: "  Less";
  }

  .overview-knowledge-rail {
    gap: 10px;
    margin-top: 16px;
  }

  .overview-rail-card {
    border-radius: 14px;
  }

  .overview-knowledge-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .overview-knowledge-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 6px;
    min-height: 44px;
    padding: 8px;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    background: var(--surface-subtle);
  }

  .overview-source-row {
    min-height: 40px;
  }

  .workspace.assistant-open {
    padding-bottom: 0;
  }

  .workspace.assistant-open .mobile-primary-nav,
  .workspace:has(.drawer.open) + .mobile-primary-nav {
    display: none;
  }

  .workspace.assistant-open .drawer {
    z-index: 120;
    height: var(--visual-viewport-height, 100dvh);
    max-height: var(--visual-viewport-height, 100dvh);
  }

  body.non-production .workspace.assistant-open .drawer {
    top: 30px;
    height: calc(var(--visual-viewport-height, 100dvh) - 30px);
    max-height: calc(var(--visual-viewport-height, 100dvh) - 30px);
  }

  #dpane-ai > .dfoot {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .talk-workspace-view {
    height: calc(100dvh - var(--topbar-h) - var(--mobile-nav-h) - env(safe-area-inset-bottom));
  }

  .talk-workspace-list-head h1 {
    font-size: 1.35rem;
  }

  .talk-workspace-list-head p::after {
    content: " · use the Talk app for calls and notifications";
  }

  .talk-workspace-message {
    max-width: 86%;
    padding: 7px 10px 6px;
  }

  .talk-workspace-message-head {
    margin-bottom: 2px;
  }

  .talk-workspace-message-head time {
    margin-left: auto;
  }

  .talk-thread-head {
    position: sticky;
    top: 0;
    z-index: 4;
    flex-wrap: wrap;
    background: #fff;
  }

  .talk-thread-actions {
    width: calc(100% - 42px);
    margin-left: 42px;
  }

  .talk-project-room-switcher {
    min-width: 0;
    flex: 1;
  }

  .talk-project-room-switcher select {
    width: 100%;
    min-width: 0;
  }

  .talk-workspace-message:not(.actions-open) .talk-message-actions {
    display: none;
  }

  .talk-message-actions-toggle {
    display: block;
    width: 30px;
    min-height: 24px;
    margin: 2px -4px -3px auto;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 1.1rem;
  }

  .talk-workspace-composer {
    position: sticky;
    bottom: 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .talk-project-room-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .talk-project-room-field #talk-project-room-selector {
    grid-column: 1 / -1;
  }

  .project-talk-open-native:not([hidden]) {
    display: inline-flex;
    justify-content: center;
    border-color: var(--accent-mid);
    background: var(--accent-soft);
    color: var(--accent-strong);
  }

  #talk-card .dnote {
    display: none;
  }

  .talk-messages {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .talk-message-meta span {
    font-size: .65rem;
  }

  .talk-image-viewer {
    height: 100dvh;
  }
}

@media (min-width: 761px) {
  .project-talk-open-native {
    display: none !important;
  }
}

/* PROJECT-004B — quieter project chrome and explicit AI / human communication. */
.project-view {
  /* The tab strip owns horizontal scrolling. `hidden` still permits browser
     scroll-into-view to offset this outer pane, clipping mobile Mail rows. */
  overflow: clip;
}

.workspace {
  /* Project section changes can reveal a tab inside the horizontally scrolling
     tab strip. Keep that browser-managed reveal local to the strip instead of
     allowing the outer workspace to retain a horizontal scroll offset. */
  overflow-x: clip;
}

.ask-ai-kicker,
.project-section-label {
  color: var(--accent-strong);
  font-family: var(--mono);
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .08em;
  line-height: 1.25;
  text-transform: uppercase;
}

.home-query {
  max-width: 860px;
  padding: 14px 16px 12px;
}

.home-query-head {
  position: static !important;
  width: auto !important;
  height: auto !important;
  margin: 0 0 10px !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: normal !important;
}

.home-query-head h2 {
  margin-top: 2px;
  font-size: 1.05rem;
}

.project-heading-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.project-heading-copy #project-title {
  overflow: hidden;
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-view:not([data-active-tab="overview"]) .titleline,
.project-view[data-active-tab="overview"] .titleline {
  justify-content: flex-start;
}

.project-view:not([data-active-tab="overview"]) .titleline > .project-heading-copy,
.project-view[data-active-tab="overview"] .titleline > .project-heading-copy {
  width: auto;
  max-width: min(48vw, 620px);
  text-align: left;
}

.project-view[data-active-tab="overview"] .workspace-head {
  padding: 22px 28px 18px;
}

.project-view[data-active-tab="overview"] .project-header-actions {
  top: 19px;
}

.project-view[data-active-tab="overview"] .project-query {
  max-width: 820px;
  margin: 22px auto 14px;
  padding: 14px 16px 12px;
}

.project-view[data-active-tab="overview"] .project-query-head {
  position: static !important;
  display: grid;
  grid-column: 1 / -1;
  grid-row: 1;
  width: auto !important;
  height: auto !important;
  margin: 0 0 10px !important;
  overflow: visible !important;
  clip: auto !important;
  gap: 2px;
  white-space: normal !important;
}

.project-view[data-active-tab="overview"] #project-query-label {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  font-size: 1.05rem;
  white-space: normal;
}

.project-view[data-active-tab="overview"] .project-query .home-query-form {
  grid-row: 2;
}

.project-view[data-active-tab="overview"] .project-query .home-query-scope {
  grid-row: 3;
}

@media (min-width: 601px) {
  .project-data-nav {
    gap: 20px;
    min-height: 52px;
  }

  .project-data-nav .tab {
    min-height: 52px;
  }
}

.project-data-nav {
  border-bottom-color: var(--line-soft);
}

.project-local-ask {
  min-height: 38px;
  padding-inline: 14px;
  border-color: var(--accent);
  background: var(--accent);
  color: var(--ink);
  box-shadow: 0 4px 14px rgb(66 176 213 / 16%);
}

.project-local-ask:hover,
.project-local-ask:focus-visible {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: var(--ink);
}

.workspace.assistant-open .dhead {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 12px 14px 10px;
}

.workspace.assistant-open .drawer-title {
  display: block;
  grid-column: 1;
  grid-row: 1;
  max-width: none;
  font-size: 1rem;
}

.workspace.assistant-open .ask-drawer-controls {
  grid-column: 1 / -1;
  grid-row: 2;
  justify-content: flex-start;
  padding-top: 4px;
}

.workspace.assistant-open .dclose {
  grid-column: 2;
  grid-row: 1;
}

.ask-context-header {
  padding: 16px;
}

.ask-context-copy {
  gap: 3px;
}

.ask-context-copy strong {
  font-size: 1rem;
}

.ask-context-copy .ask-ai-kicker {
  overflow: visible;
  color: var(--accent-strong);
  font-size: .62rem;
  white-space: normal;
}

.team-chat-context {
  display: grid;
  gap: 2px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--surface-subtle);
}

.team-chat-context strong {
  font-family: var(--disp);
  font-size: 1rem;
}

.team-chat-context span {
  color: var(--mut);
  font-size: .76rem;
}

@media (min-width: 1101px) {
  .overview-v2-layout {
    grid-template-columns: minmax(0, 760px) 320px;
    max-width: 1210px;
    gap: 30px;
  }
}

@media (max-width: 600px) {
  /* Keep the mail metadata row inside the phone viewport. The sender is the
     flexible item; badges and the date retain only the space they need. */
  .mailrow {
    column-gap: 8px;
    padding-inline: 12px;
    overflow: hidden;
  }

  .mailrow .who {
    flex: 1 1 80px;
    min-width: 0;
  }

  .mailrow .subj {
    flex: 1 0 100%;
    min-width: 0;
  }

  .mailrow .d {
    width: auto;
    min-width: max-content;
    margin-left: auto;
  }

  .project-view:not([data-active-tab="overview"]) .titleline {
    min-width: 0;
    width: 100%;
  }

  .project-view:not([data-active-tab="overview"]) .titleline > .project-heading-copy {
    flex: 1 1 0;
    width: 0;
    max-width: none;
  }

  .home-query {
    padding: 12px;
  }

  .home-query-head,
  .project-view[data-active-tab="overview"] .project-query-head {
    display: grid !important;
    margin-bottom: 8px !important;
  }

  .home-query-head h2,
  .project-view[data-active-tab="overview"] #project-query-label {
    font-size: .92rem;
  }

  .project-view[data-active-tab="overview"] .titleline {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .project-view[data-active-tab="overview"] .titleline > .project-heading-copy {
    width: 100%;
    max-width: 100%;
  }

  .project-heading-copy #project-title {
    font-size: 1.25rem;
  }

  .project-view[data-active-tab="overview"] .project-query {
    padding: 12px;
  }

  .project-local-ask {
    min-height: 40px;
  }

  .workspace.assistant-open .dhead {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 10px 12px;
  }

  .workspace.assistant-open .drawer-title {
    display: block;
  }

  .workspace.assistant-open .ask-drawer-controls {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    margin-left: 0;
    overflow-x: auto;
  }

  .ask-context-header {
    align-items: flex-start;
  }

  .ask-context-copy strong,
  .ask-context-copy .assistant-scope {
    white-space: normal;
  }

  .ask-workspace-state-label {
    margin-top: 18px;
  }
}
