/* ============================================================
   Editorial Calm — shared app shell + component overrides
   ============================================================
   Loaded on every page that includes /js/editorial-shell.js
   and has <body class="editorial-calm">.

   Scope: every rule below is prefixed with body.editorial-calm
   so removing that class disables the entire visual layer.

   What's restyled (no markup changes required):
     • Sidebar chrome (.sidebar, .sidebar-header, .app-branding,
       .team-context, .sidebar-nav, .sidebar-footer)
     • Topbar / .page-header
     • Cards (.card, .stat-card, .doc-card, .empty-state)
     • Buttons (existing .btn variants picked up new accent
       from tokens-bridge; here we restyle the *shape*)
     • Inputs, badges, conflicts list

   To change the look globally → edit this file. Never set per-page.
   ============================================================ */

/* ============================================================
   Motion + interaction system (canonical)
   ------------------------------------------------------------
   All interactive elements should follow these conventions.

   Duration tokens (from tokens.css):
     --duration-instant   80ms   instant feedback (no perceptible delay)
     --duration-fast     150ms   default for hover, focus, ripple
     --duration-base     220ms   default for transitions, slide-in
     --duration-slow     360ms   for full-screen / modal entry

   Easing tokens:
     --easing-standard   cubic-bezier(0.2, 0, 0, 1)   default
     --easing-emphasis   cubic-bezier(0.2, 0, 0, 1.2) for slight overshoot

   Hover patterns:
     • Buttons        → background + border tint (150ms)
     • Cards          → background + 1px lift + shadow-1 (150ms)
     • Nav items      → background tint only (150ms)
     • Icon buttons   → background tint + border visible (150ms)
     • Destructive    → danger-soft bg + danger color (150ms)

   Focus visible:
     • Every focusable element gets a 2px accent ring with 2px
       offset (or 2px danger ring if data-action="delete-*").
     • Outside that, no custom focus styling — use this default.

   Don't:
     • Stretch transitions past 220ms unless animating a modal/page.
     • Use transform-lift on more than cards (buttons stay still).
     • Add bespoke focus rings — extend this block instead.
   ============================================================ */

body.editorial-calm :focus-visible {
  outline: 2px solid var(--color-teal-400);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
body.editorial-calm a:focus-visible,
body.editorial-calm button:focus-visible,
body.editorial-calm [role="button"]:focus-visible,
body.editorial-calm [tabindex]:focus-visible {
  outline: 2px solid var(--color-teal-400);
  outline-offset: 2px;
}
/* Danger-on-hover elements get a danger focus ring (kept in sync with hover) */
body.editorial-calm [data-action^="delete"]:focus-visible {
  outline: 2px solid var(--color-danger);
  outline-offset: 2px;
}

/* Generic interactive transition — apply to any element that should
   animate its background/border/color on hover. Components can opt in
   by adding `.ec-interactive` or adopting the property list directly. */
body.editorial-calm .ec-interactive {
  transition: background var(--duration-fast) var(--easing-standard),
              border-color var(--duration-fast) var(--easing-standard),
              color var(--duration-fast) var(--easing-standard);
}

/* Card-lift — the canonical "tap me" affordance for clickable cards.
   Apply by adding `.ec-card-lift` (or via existing patterns that already
   set transform+shadow on hover — they remain valid). */
body.editorial-calm .ec-card-lift {
  transition: border-color var(--duration-fast) var(--easing-standard),
              box-shadow var(--duration-fast) var(--easing-standard),
              transform var(--duration-fast) var(--easing-standard);
}
body.editorial-calm .ec-card-lift:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-1);
  transform: translateY(-1px);
}

/* ─────────────────────────────────────────────
   Page chrome
   ───────────────────────────────────────────── */
body.editorial-calm {
  background: var(--bg);
  color: var(--fg-body);
}

body.editorial-calm .sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: var(--space-6) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  width: 268px;
  min-width: 268px;
  /* Contain to the viewport (base sets height:100vh) so the Spaces list scrolls
     internally instead of the whole sidebar overflowing off-screen. */
  overflow: hidden;
}

/* Sidebar header — flatten so its children (brand + team-context) can be
   independently reordered as direct flex items of .sidebar.
   Brand stays top; team-context (workspace identity) is pushed to bottom. */
body.editorial-calm .sidebar-header {
  display: contents;
}
body.editorial-calm .app-branding { order: 1; }
body.editorial-calm .sidebar-nav   { order: 2; }
body.editorial-calm .ec-spaces     { order: 3; }
body.editorial-calm .team-context  { order: 4; margin-top: auto; }
body.editorial-calm .sidebar-footer{ order: 5; }

body.editorial-calm .app-branding {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px var(--space-2);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--duration-fast) var(--easing-standard);
}
body.editorial-calm .app-branding:hover { background: rgba(0, 0, 0, .035); }
body.editorial-calm .app-branding:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}
body.editorial-calm .app-logo,
body.editorial-calm .app-logo svg {
  width: 26px; height: 26px;
  background: none;
  border-radius: 0;
}
body.editorial-calm .app-logo svg { color: var(--accent); }
body.editorial-calm .app-title h2 {
  font-family: var(--wordmark-family);
  font-weight: var(--wordmark-weight);
  letter-spacing: var(--wordmark-track);
  font-size: 19px;
  color: var(--fg);
  margin: 0;
  line-height: 1.1;
}
body.editorial-calm .app-title p { display: none; }

/* Workspace context (sidebar): text-only switcher, no swatch.
   Lets the workspace name breathe — wraps to a second line if needed,
   never truncates to "..." */
/* Bottom-left account card — workspace name + chevron, opens the
   unified workspace dropdown (switch ws, settings, profile, logout).
   Standardised height so the card matches itself across pages.
   styles.css sets flex-direction:column on .team-context; we force
   row so the chevron sits to the right of the name, not below it. */
body.editorial-calm .team-context {
  margin: 0;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  height: 56px;
  min-height: 56px;
  width: 100%;
  box-sizing: border-box;
  position: relative; /* dropdown anchor */
}
body.editorial-calm .team-context:hover { background: var(--bg-elevated); cursor: pointer; }
body.editorial-calm .team-context-label { display: none; }
body.editorial-calm .team-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  /* Let flex shrink this column so the ::after chevron always has room.
     Don't set width:100% — it overrides flex sizing and pushes chevron
     outside the card. */
  flex: 1 1 0;
  min-width: 0;
  padding: 0;
  background: none;
  border: 0;
}
body.editorial-calm .team-avatar,
body.editorial-calm .team-avatar-fallback { display: none; }
body.editorial-calm .team-info {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  gap: 3px;
  flex: 1;
  min-width: 0;
}
body.editorial-calm .team-info::before {
  content: "Workspace";
  font: 500 9.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
/* Higher specificity to beat both .team-name AND .sidebar-header .team-name
   in styles.css (which sets display:inline-flex + white-space:nowrap). */
body.editorial-calm .team-name,
body.editorial-calm .sidebar-header .team-name {
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg);
  background: transparent;
  padding: 0;
  border-radius: 0;
  gap: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  text-overflow: clip;
  overflow: hidden;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
body.editorial-calm .team-context::after {
  content: "";
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  align-self: center;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2370727F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
  pointer-events: none;
}
body.editorial-calm .team-context:hover::after {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231B1C20' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
}

/* ─────────────────────────────────────────────
   Workspace switcher dropdown (.team-switcher-dropdown)
   Rendered by /js/team-switcher.js into .team-selector.
   We anchor it ABOVE the bottom workspace card and style it
   to match Editorial Calm.
   ───────────────────────────────────────────── */
body.editorial-calm .team-switcher-dropdown {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px); /* open upward — sits above the card */
  right: auto;
  top: auto;
  width: 260px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  padding: 6px;
  z-index: 1000;
  color: var(--fg);
}
body.editorial-calm .team-switcher-header {
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 10px 12px 6px;
  background: transparent;
  border: 0;
}
body.editorial-calm .team-switcher-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--fg-body);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13.5px;
}
body.editorial-calm .team-switcher-item:hover {
  background: var(--bg-secondary);
  color: var(--fg);
}
body.editorial-calm .team-switcher-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
body.editorial-calm .team-switcher-item .team-avatar {
  width: 24px; height: 24px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: var(--bg-secondary);
  color: var(--fg-muted);
  font-size: 12px;
  flex: 0 0 24px;
}
body.editorial-calm .team-switcher-item .team-avatar-img {
  width: 100%; height: 100%; border-radius: var(--radius-sm); object-fit: cover;
}
body.editorial-calm .team-switcher-item .team-name {
  font-size: 13.5px;
  font-weight: 500;
  color: inherit;
  background: none;
  padding: 0;
  border: 0;
  display: inline;
  -webkit-line-clamp: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
body.editorial-calm .team-switcher-item.active .team-name { color: var(--accent); }

/* Additional account-menu items appended by editorial-shell.js */
body.editorial-calm .ec-account-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 4px;
}
body.editorial-calm .ec-account-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--fg-body);
  cursor: pointer;
  font: 500 13.5px/1.2 var(--font-sans);
  text-decoration: none;
}
body.editorial-calm .ec-account-item:hover { background: var(--bg-secondary); color: var(--fg); }
body.editorial-calm .ec-account-item--danger { color: var(--color-danger); }
body.editorial-calm .ec-account-item--danger:hover { background: #FEE2E2; color: var(--color-danger); }
body.editorial-calm .ec-account-item svg { width: 16px; height: 16px; flex: 0 0 16px; color: currentColor; opacity: .9; }

/* ─────────────────────────────────────────────
   Spaces section (sidebar) — sub-spaces within current workspace.
   Rendered by editorial-shell.js from window.spaceManager.
   ───────────────────────────────────────────── */
body.editorial-calm .ec-spaces {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  /* The Spaces list is the variable-length section — let IT scroll so the fixed
     nav (Dashboard / Knowledge Base / Communication) and the workspace +
     footer below it stay visible. Without this, adding a nav item or having
     many spaces overflows the 100vh sidebar and pushes items off-screen,
     forcing a scroll to reach them. Pairs with `.sidebar { overflow: hidden }`. */
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
body.editorial-calm .ec-spaces::before {
  content: "Spaces";
  display: block;
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 0 10px 6px;
}
body.editorial-calm .ec-spaces .ec-space-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg-body);
  font: 500 13.5px/1.3 var(--font-sans);
  cursor: pointer;
  text-align: left;
  width: 100%;
  min-width: 0;
}
body.editorial-calm .ec-spaces .ec-space-item:hover {
  background: rgba(0, 0, 0, .035);
  color: var(--fg);
}
body.editorial-calm .ec-spaces .ec-space-item.is-active {
  background: var(--bg-elevated);
  color: var(--fg);
  border-color: var(--border);
}
body.editorial-calm .ec-spaces .ec-space-dot {
  width: 8px; height: 8px; flex: 0 0 8px;
  border-radius: 999px;
  background: var(--fg-muted);
}
body.editorial-calm .ec-spaces .ec-space-item[data-space-id="general"] .ec-space-dot {
  background: var(--accent);
  outline: 2px solid var(--accent-soft);
}
body.editorial-calm .ec-spaces .ec-space-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.editorial-calm .ec-spaces .ec-space-new {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px dashed var(--border-strong);
  color: var(--fg-muted);
  font: 600 12.5px/1 var(--font-sans);
  cursor: pointer;
  text-align: left;
  width: 100%;
}
body.editorial-calm .ec-spaces .ec-space-new:hover {
  color: var(--fg);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ─────────────────────────────────────────────
   Sidebar space rows + gear — the sidebar is the single
   space-switching surface (legacy topbar header bar removed).
   ───────────────────────────────────────────── */
body.editorial-calm .ec-spaces .ec-space-row {
  display: flex;
  align-items: center;
  gap: 2px;
}
body.editorial-calm .ec-spaces .ec-space-row .ec-space-item { flex: 1; min-width: 0; }
body.editorial-calm .ec-spaces .ec-space-gear {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  opacity: 0;
  transition: background var(--duration-fast) var(--easing-standard),
              color var(--duration-fast) var(--easing-standard),
              opacity var(--duration-fast) var(--easing-standard);
}
/* Reveal the gear on row hover; keep it visible on the active row and on
   keyboard focus (so it's reachable without a pointer). */
body.editorial-calm .ec-spaces .ec-space-row:hover .ec-space-gear,
body.editorial-calm .ec-spaces .ec-space-row.is-active .ec-space-gear,
body.editorial-calm .ec-spaces .ec-space-gear:focus-visible {
  opacity: 1;
}
body.editorial-calm .ec-spaces .ec-space-gear svg { width: 14px; height: 14px; }
body.editorial-calm .ec-spaces .ec-space-gear:hover {
  background: rgba(0, 0, 0, .05);
  color: var(--fg);
}
body.editorial-calm .ec-spaces .ec-space-gear:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

/* ─────────────────────────────────────────────
   Notification bell — mounted at the right edge of the brand
   row by editorial-shell.js; markup rendered by notifications.js.
   ───────────────────────────────────────────── */
body.editorial-calm .ec-bell-mount {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
}
body.editorial-calm .ec-bell-mount .header-notification-btn {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--fg-muted);
  box-shadow: none;
  transform: none;
}
body.editorial-calm .ec-bell-mount .header-notification-btn:hover:not(:disabled) {
  background: rgba(0, 0, 0, .05);
  border: 0;
  box-shadow: none;
  transform: none;
  color: var(--fg);
}
body.editorial-calm .ec-bell-mount .header-notification-btn:focus-visible {
  box-shadow: none;
  outline: var(--focus-ring);
  outline-offset: 2px;
}
body.editorial-calm .ec-bell-mount .header-notification-icon {
  width: 16px;
  height: 16px;
  color: currentColor;
}
body.editorial-calm .ec-bell-mount .notification-badge {
  top: 4px;
  right: 4px;
  background: var(--color-danger);
  border-color: var(--bg-secondary);
}
/* Panel opens over the content area, anchored to the sidebar edge. */
body.editorial-calm .ec-bell-mount .notification-panel {
  position: fixed;
  top: 56px;
  left: 16px;
  right: auto;
  border-radius: var(--radius-lg);
  border-color: var(--border);
}

/* ─────────────────────────────────────────────
   Credits pill — sidebar footer mount (rendered by
   /js/credits-indicator.js).
   ───────────────────────────────────────────── */
body.editorial-calm .ec-credits-mount { margin-bottom: 10px; }
body.editorial-calm .ec-credits-mount .header-credits-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--fg-body);
  font: 600 12px/1 var(--font-sans);
  padding: 7px 12px;
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--easing-standard),
              color var(--duration-fast) var(--easing-standard);
}
body.editorial-calm .ec-credits-mount .header-credits-btn:hover {
  border-color: var(--accent);
  color: var(--fg);
}
body.editorial-calm .ec-credits-mount .header-credits-btn svg {
  width: 14px; height: 14px; color: var(--accent); flex: 0 0 auto;
}
body.editorial-calm .ec-credits-mount .header-credits-value { min-width: 0; }
body.editorial-calm .ec-credits-mount .header-credits-badge {
  margin-left: auto;
  font: 600 10px/1 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-danger);
}

/* Sidebar nav */
body.editorial-calm .sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  /* The primary nav (Dashboard / Knowledge Base / Communication) must always be
     fully visible — never the scroll region. Base styles.css sets
     `.sidebar-nav { flex:1; overflow-y:auto }` (the old design where the nav
     scrolled); that competes with the Spaces list and squeezes Communication
     out of view. Pin the nav to its content height and let only .ec-spaces
     scroll. */
  flex: 0 0 auto;
  overflow: visible;
}
/* Pillar section labels (Knowledge Base / Communication), rendered by
   navigation.js. Replaces the former single "Workspace" eyebrow so the nav's
   two jobs read as two groups. Dashboard sits above the first label, bare. */
body.editorial-calm .sidebar-nav .nav-section-label {
  display: block;
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 0 10px 6px;
  margin-top: 14px;
}
body.editorial-calm .sidebar-nav a.nav-item,
body.editorial-calm .sidebar-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  color: var(--fg-body);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  background: transparent;
  border: 1px solid transparent;
  text-decoration: none;
}
body.editorial-calm .sidebar-nav a.nav-item:hover {
  background: rgba(0, 0, 0, .035);
  color: var(--fg);
}
body.editorial-calm .sidebar-nav a.nav-item.active {
  background: var(--bg-elevated);
  color: var(--fg);
  border-color: var(--border);
}
body.editorial-calm .sidebar-nav .nav-icon {
  width: 16px; height: 16px;
  flex: 0 0 16px;
  color: currentColor;
  opacity: .9;
}
/* The Inbox badge inside nav (rendered by navigation.js) */
body.editorial-calm .sidebar-nav .nav-badge {
  margin-left: auto;
  background: var(--color-danger) !important;
  color: #fff !important;
  font: 600 10.5px/1 var(--font-sans) !important;
  padding: 2px 7px !important;
  border-radius: 999px !important;
  vertical-align: middle;
}

/* Sidebar footer — sits directly below the workspace context card.
   No top divider (the workspace card above provides visual separation). */
body.editorial-calm .sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 8px 4px;
  border-top: 0;
  background: transparent;
}
body.editorial-calm .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 6px;
  background: transparent;
  border: 0;
}
body.editorial-calm .user-avatar {
  width: 32px; height: 32px;
  border-radius: 999px;
  background: oklch(0.92 0.04 200);
  color: oklch(0.4 0.07 200);
  display: grid; place-items: center;
  font: 600 12px var(--font-sans);
  border: 0;
}
body.editorial-calm .user-details h4 {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg);
  margin: 0;
  line-height: 1.15;
}
body.editorial-calm .user-details p {
  font: 500 10px/1.3 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0;
}
/* Standalone Logout button is folded into the workspace dropdown
   below — hide the original .sidebar-footer button to avoid duplication. */
body.editorial-calm .sidebar-footer #logout-btn,
body.editorial-calm .sidebar-footer .btn { display: none; }

/* ─────────────────────────────────────────────
   Main content / topbar / page-header
   ───────────────────────────────────────────── */
body.editorial-calm .main-content {
  background: var(--bg);
  padding: var(--space-12) var(--space-8);
}

body.editorial-calm .page-header {
  border: 0;
  padding: 0 0 var(--space-8);
  margin: 0 0 var(--space-8);
  border-bottom: 1px solid var(--border);
  /* Neutralize the legacy styles.css rule `.page-header{display:flex;
     align-items:center;justify-content:space-between}` — it spreads an
     injected eyebrow + h1 + subtitle across a centered row (the deploy /
     conflicts / profile / team-settings header bug). Stack vertically with
     full-width children so the title block flows top-to-bottom; pages that
     want a title-left / CTA-right row use .page-header-top-row (an inner
     flex row), and .ec-hero supplies its own layout. */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
}
/* Pages that wrap the title + topbar pill in a row */
body.editorial-calm .page-header-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-6);
}
body.editorial-calm .page-header-content { flex: 1; min-width: 0; }

body.editorial-calm .page-header h1 {
  font: 400 var(--text-h1-size)/var(--text-h1-lh) var(--font-serif);
  letter-spacing: var(--text-h1-track);
  color: var(--fg);
  margin: 0 0 8px;
}
body.editorial-calm .page-header h1 em {
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}
body.editorial-calm .page-header p {
  font: var(--text-body-lg-weight) var(--text-body-lg-size)/var(--text-body-lg-lh) var(--font-sans);
  letter-spacing: var(--text-body-lg-track);
  color: var(--fg-muted);
  margin: 0;
  max-width: 720px;
}

/* Eyebrow utility — drop `<span class="ub-eyebrow">…</span>` above any h1/h2
   to get the signature mono uppercase label. */
body.editorial-calm .ub-eyebrow,
body.editorial-calm .editorial-eyebrow {
  display: inline-block;
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0 0 8px;
}
body.editorial-calm .ub-eyebrow--accent,
body.editorial-calm .editorial-eyebrow.is-accent { color: var(--accent); font-weight: 600; }

/* ─────────────────────────────────────────────
   Cards
   ───────────────────────────────────────────── */
body.editorial-calm .card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
body.editorial-calm .card .card-header,
body.editorial-calm .card-header {
  border-bottom: 1px solid var(--border);
}
body.editorial-calm .card-header h2,
body.editorial-calm .card-header h3,
body.editorial-calm .card > h2:first-child,
body.editorial-calm .card > h3:first-child,
body.editorial-calm .card > h2:nth-child(-n+2),
body.editorial-calm .card > h3:nth-child(-n+2) {
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.3;
  color: var(--fg);
  margin: 0 0 14px;
}
/* Larger variant (e.g. "Recent System Files" was rendering at 20px) */
body.editorial-calm .card > h3.card-section-title,
body.editorial-calm .card > h2.card-section-title {
  font-size: 20px;
  margin-bottom: 18px;
}

/* Stats grid */
body.editorial-calm .stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
body.editorial-calm .stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
body.editorial-calm .stat-card.clickable:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-1);
}
body.editorial-calm .stat-card .stat-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 0;
}
body.editorial-calm .stat-card .stat-icon {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  display: grid; place-items: center;
  font-size: 14px;
}
body.editorial-calm .stat-card .stat-title,
body.editorial-calm .stat-card .stat-label {
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
body.editorial-calm .stat-card .stat-value,
body.editorial-calm .stat-card .stat-number {
  font: 400 36px/1 var(--font-serif);
  letter-spacing: -0.025em;
  color: var(--fg);
}
body.editorial-calm .stat-card .stat-meta,
body.editorial-calm .stat-card .stat-subtitle {
  font: 500 12px/1.4 var(--font-sans);
  color: var(--fg-muted);
}
/* Iconless stat cards (Conflicts page etc.) — dial down the heroic
   36px serif so they feel calm in empty state, not shouty. */
body.editorial-calm .stat-card:not(:has(.stat-icon)) {
  text-align: left;
  padding: 16px 18px;
  gap: 6px;
}
body.editorial-calm .stat-card:not(:has(.stat-icon)) .stat-value,
body.editorial-calm .stat-card:not(:has(.stat-icon)) .stat-number {
  font-size: 28px;
  line-height: 1;
  text-align: left;
}
body.editorial-calm .stat-card:not(:has(.stat-icon)) .stat-label {
  text-align: left;
}

/* ─────────────────────────────────────────────
   Buttons — re-shape existing .btn to Editorial Calm
   (color was already shifted by tokens-bridge.css)
   ───────────────────────────────────────────── */
body.editorial-calm .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: -0.005em;
  padding: 10px 18px;
  font-size: 14px;
  border: 1px solid transparent;
  transition: background var(--duration-fast) var(--easing-standard),
              border-color var(--duration-fast) var(--easing-standard);
}
body.editorial-calm .btn-sm { padding: 8px 14px; font-size: 13px; }
body.editorial-calm .btn-lg { padding: 14px 22px; font-size: 15px; }
/* Any element wired to a JS action via the CSP-safe data-action delegation is
   clickable, but div/span/<a> action elements (chat sessions, source toggles,
   citations, dropdown items, etc.) don't get a pointer cursor natively — they
   showed the default arrow. Reflect clickability app-wide. */
body.editorial-calm [data-action]:not([disabled]):not(.disabled) { cursor: pointer; }
body.editorial-calm .btn-primary {
  background: var(--accent);
  color: #fff;
}
body.editorial-calm .btn-primary:hover { background: var(--accent-hover); }
body.editorial-calm .btn-secondary {
  background: transparent;
  color: var(--fg);
  border-color: var(--border);
}
body.editorial-calm .btn-secondary:hover { background: var(--bg-secondary); }
body.editorial-calm .btn-danger {
  background: var(--color-danger);
  color: #fff;
}
/* Outlined danger CTA — destructive but lower-emphasis (e.g. Disable MFA, Remove avatar) */
body.editorial-calm .btn-danger-outline {
  background: transparent;
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
}
body.editorial-calm .btn-danger-outline:hover {
  background: #FEE2E2;
  color: var(--color-danger);
}
/* Subtle text-only button — no fill/border (e.g. "Show advanced") */
body.editorial-calm .btn-link-subtle {
  background: transparent;
  border: 0;
  padding: 4px 6px;
  color: var(--fg-muted);
  font: 600 12.5px/1 var(--font-sans);
  cursor: pointer;
}
body.editorial-calm .btn-link-subtle:hover { color: var(--fg); background: transparent; }

/* ─────────────────────────────────────────────
   Inputs
   ───────────────────────────────────────────── */
body.editorial-calm input[type="text"],
body.editorial-calm input[type="email"],
body.editorial-calm input[type="password"],
body.editorial-calm input[type="search"],
body.editorial-calm textarea {
  font-family: var(--font-sans);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--fg);
}
body.editorial-calm input:focus,
body.editorial-calm textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: none;
}

/* Native <select> styling — strip the OS chevron, paint our own Lucide one.
   Applies globally so every dropdown matches inputs (same height, border,
   radius, focus ring). */
body.editorial-calm select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--fg);
  background-color: var(--bg-elevated);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2370727F' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 34px 9px 14px;
  cursor: pointer;
  line-height: 1.3;
  transition: border-color var(--duration-fast) var(--easing-standard);
}
body.editorial-calm select:hover {
  border-color: var(--border-strong);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231B1C20' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
}
body.editorial-calm select:focus {
  border-color: var(--accent);
  outline: none;
}
/* Keyboard focus ring for form fields (WCAG 2.4.7). The :focus rules above
   intentionally drop the outline for mouse focus; :focus-visible restores a
   visible ring for keyboard users. Placed after the :focus rules to win on
   equal specificity via source order. */
body.editorial-calm input:focus-visible,
body.editorial-calm textarea:focus-visible,
body.editorial-calm select:focus-visible {
  outline: 2px solid var(--color-teal-400);
  outline-offset: 2px;
  border-color: var(--accent);
}
body.editorial-calm select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
/* Small variant (used in tight filter rows) */
body.editorial-calm select.form-control-compact,
body.editorial-calm .form-control-compact { padding: 6px 28px 6px 10px; font-size: 12.5px; }
/* When wrapped with a "Label: <select>" inline pattern, keep label readable */
body.editorial-calm label + select { margin-left: 4px; }

/* ── Editorial Calm custom dropdown (ec-select) ──────────────────────────────
   Native <select> can't style its option popup; this is a brand-coloured
   replacement (teal highlight on hover/selected). Enhanced by js/ec-select.js. */
body.editorial-calm .ec-select { position: relative; display: inline-block; vertical-align: middle; max-width: 100%; }
body.editorial-calm .ec-select__native { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; pointer-events: none; }
body.editorial-calm .ec-select__trigger {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; min-width: 0; height: 38px; padding: 0 12px 0 14px;
  background: var(--bg-elevated); color: var(--fg);
  border: 1px solid var(--border); border-radius: var(--radius-md, 8px);
  font: 500 13px/1 var(--font-sans); cursor: pointer; text-align: left;
  transition: border-color var(--duration-fast, .15s) var(--easing-standard, ease), box-shadow var(--duration-fast, .15s) ease;
}
body.editorial-calm .ec-select__trigger:hover { border-color: var(--border-strong); }
body.editorial-calm .ec-select__trigger:focus-visible,
body.editorial-calm .ec-select__trigger[aria-expanded="true"] { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 118, 110, .15); }
body.editorial-calm .ec-select__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.editorial-calm .ec-select__chevron { flex: none; color: var(--fg-muted); transition: transform var(--duration-fast, .15s) ease, color .15s ease; }
body.editorial-calm .ec-select__trigger[aria-expanded="true"] .ec-select__chevron { transform: rotate(180deg); color: var(--accent); }

body.editorial-calm .ec-select__list {
  position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; min-width: 100%;
  max-height: 280px; overflow-y: auto; padding: 6px;
  background: var(--bg-elevated, #fff); border: 1px solid var(--border);
  border-radius: var(--radius-md, 8px); box-shadow: 0 14px 36px rgba(15, 23, 42, .14);
  animation: ecSelectIn .12s ease;
}
@keyframes ecSelectIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
body.editorial-calm .ec-select__option {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border-radius: 6px; cursor: pointer;
  font: 500 13px/1.3 var(--font-sans); color: var(--fg); white-space: nowrap;
}
body.editorial-calm .ec-select__option.is-active { background: rgba(15, 118, 110, .10); color: var(--accent); }
body.editorial-calm .ec-select__option[aria-selected="true"] { color: var(--accent); font-weight: 600; }
body.editorial-calm .ec-select__check { flex: none; color: var(--accent); opacity: 0; }
body.editorial-calm .ec-select__option[aria-selected="true"] .ec-select__check { opacity: 1; }
@media (prefers-reduced-motion: reduce) { body.editorial-calm .ec-select__list { animation: none; } }

/* ─────────────────────────────────────────────
   Empty state
   ───────────────────────────────────────────── */
body.editorial-calm .empty-state {
  border: 1px dashed var(--border-strong);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 44px 24px;
  text-align: center;
}
body.editorial-calm .empty-state h3,
body.editorial-calm .empty-state .empty-state-title {
  font: 400 20px/1.3 var(--font-serif);
  letter-spacing: -0.015em;
  color: var(--fg);
  margin-bottom: 6px;
}
body.editorial-calm .empty-state p {
  font: 400 13px/1.55 var(--font-sans);
  color: var(--fg-muted);
}
/* Empty-state CTAs shouldn't be full-bleed — keep them tight, centered */
body.editorial-calm .empty-state .btn,
body.editorial-calm .card.text-center .btn {
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  margin-top: 8px;
}
body.editorial-calm .card.text-center {
  text-align: center;
  padding: 48px 24px !important;
}

/* ─────────────────────────────────────────────
   Filter row — search input + select dropdowns
   used on Documents / Files / Inbox pages
   ───────────────────────────────────────────── */
body.editorial-calm .documents-filters,
body.editorial-calm .files-filters,
body.editorial-calm .filter-bar,
body.editorial-calm .filters-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
}
body.editorial-calm .view-toggle,
body.editorial-calm .view-mode-toggle {
  display: inline-flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 0;
}
body.editorial-calm .view-toggle button,
body.editorial-calm .view-mode-toggle button {
  width: 28px; height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 6px;
  color: var(--fg-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
body.editorial-calm .view-toggle button.active,
body.editorial-calm .view-mode-toggle button.active {
  background: var(--bg-secondary);
  color: var(--fg);
}

/* ─────────────────────────────────────────────
   Integration cards — hover lift, refined connect button
   ───────────────────────────────────────────── */
body.editorial-calm .integration-card {
  transition: border-color var(--duration-fast) var(--easing-standard),
              box-shadow var(--duration-fast) var(--easing-standard),
              transform var(--duration-fast) var(--easing-standard);
}
body.editorial-calm .integration-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}
body.editorial-calm .integration-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
body.editorial-calm .integration-icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}
body.editorial-calm .integration-icon img { width: 24px; height: 24px; }
body.editorial-calm .integration-name {
  font: 600 14.5px/1.3 var(--font-sans);
  color: var(--fg);
}
body.editorial-calm .integration-category {
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-top: 3px;
}
body.editorial-calm .integration-description {
  font: 400 13px/1.55 var(--font-sans);
  color: var(--fg-body);
  margin-bottom: 14px;
}
body.editorial-calm .connect-btn,
body.editorial-calm .integration-card .btn-connect {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  font: 600 12.5px/1 var(--font-sans);
  border: 0;
  cursor: pointer;
  transition: background var(--duration-fast) var(--easing-standard);
}
body.editorial-calm .connect-btn:hover { background: var(--accent-hover); }

/* Filter pills row (used on Integrations + Documents) */
body.editorial-calm .filter-tabs,
body.editorial-calm .integration-filters,
body.editorial-calm .category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0;
}
body.editorial-calm .filter-tabs button,
body.editorial-calm .integration-filters button,
body.editorial-calm .category-filters button {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-body);
  font: 500 12.5px/1 var(--font-sans);
  cursor: pointer;
}
body.editorial-calm .filter-tabs button:hover,
body.editorial-calm .integration-filters button:hover,
body.editorial-calm .category-filters button:hover {
  background: var(--bg-secondary);
  color: var(--fg);
}
body.editorial-calm .filter-tabs button.active,
body.editorial-calm .integration-filters button.active,
body.editorial-calm .category-filters button.active {
  background: var(--fg);
  color: var(--bg-elevated);
  border-color: var(--fg);
}

/* ─────────────────────────────────────────────
   Deploy page — surface tabs + cards
   ───────────────────────────────────────────── */
body.editorial-calm .deploy-tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
body.editorial-calm .deploy-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 14px 18px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  cursor: pointer;
  color: var(--fg-muted);
  margin-bottom: -1px; /* overlap container border-bottom */
  font-family: var(--font-sans);
  text-align: left;
}
body.editorial-calm .deploy-tab:hover {
  color: var(--fg);
  background: var(--bg-secondary);
}
body.editorial-calm .deploy-tab.active {
  color: var(--fg);
  border-bottom-color: var(--accent);
  background: transparent;
}
body.editorial-calm .deploy-tab span:first-child {
  font: 600 14px/1.2 var(--font-sans);
}
body.editorial-calm .deploy-tab-sub {
  font: 500 11px/1.2 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
body.editorial-calm .deploy-tab.active .deploy-tab-sub {
  color: var(--accent);
}

/* ─────────────────────────────────────────────
   Documents — card grid
   ───────────────────────────────────────────── */
body.editorial-calm .document-card {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--easing-standard),
              box-shadow var(--duration-fast) var(--easing-standard),
              transform var(--duration-fast) var(--easing-standard);
  min-height: 220px;
}
body.editorial-calm .document-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}

body.editorial-calm .document-card .checkbox-zone {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  opacity: 0;
  transition: opacity 150ms;
  display: inline-flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px;
  line-height: 0;
}
body.editorial-calm .document-card .document-checkbox {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
body.editorial-calm .document-card:hover .checkbox-zone,
body.editorial-calm .document-card:focus-within .checkbox-zone { opacity: 1; }
body.editorial-calm .document-card .checkbox-zone input:checked {
  outline: 2px solid var(--accent);
}
/* When a card is in a selection — keep checkbox visible */
body.editorial-calm .document-card .document-checkbox:checked {
  /* sibling combinator hack: when checked, parent label's opacity is preserved */
}

body.editorial-calm .document-card .delete-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 28px;
  height: 28px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 150ms, background 150ms, color 150ms;
  color: var(--fg-muted);
}
body.editorial-calm .document-card:hover .delete-btn { opacity: 1; }
body.editorial-calm .document-card .delete-btn:hover {
  background: #FEE2E2;
  color: var(--color-danger);
  border-color: transparent;
}

/* Category eyebrow above the title */
body.editorial-calm .document-card .category-badge {
  order: -1;
  align-self: flex-start;
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0 0 2px;
}
body.editorial-calm .document-card .document-header { padding: 0; margin: 0; border: 0; }
body.editorial-calm .document-card .document-title {
  font: 600 16px/1.35 var(--font-sans);
  letter-spacing: -0.005em;
  color: var(--fg);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
body.editorial-calm .document-card .document-preview {
  font: 400 13px/1.55 var(--font-sans);
  color: var(--fg-body);
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

body.editorial-calm .document-card .document-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
body.editorial-calm .document-card .document-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 500 11px/1 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
body.editorial-calm .document-card .document-version,
body.editorial-calm .document-card .document-size,
body.editorial-calm .document-card .document-date { background: transparent; padding: 0; }
body.editorial-calm .document-card .document-author {
  font: 500 11.5px/1 var(--font-sans);
  color: var(--fg-muted);
}

/* ─────────────────────────────────────────────
   Document editor (/document-editor.html)
   ───────────────────────────────────────────── */
/* Category subtitle under the H1 — turn into accent eyebrow style */
body.editorial-calm #document-subtitle {
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 6px 0 0 !important;
}

/* The "info card" toolbar row above the editor body */
body.editorial-calm .document-info-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 20px;
  box-shadow: none;
}
body.editorial-calm .document-info-card .info-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  row-gap: 10px;
}
body.editorial-calm #back-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-body);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font: 600 12.5px/1 var(--font-sans);
  margin-right: 6px !important;
}
body.editorial-calm #back-btn:hover {
  background: var(--bg-secondary);
  color: var(--fg);
}
/* info-item label/value pattern → mono eyebrow + Manrope value */
body.editorial-calm .info-item {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
body.editorial-calm .info-item .info-label {
  font: 500 10px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
body.editorial-calm .info-item .info-value {
  font: 600 13px/1.2 var(--font-sans);
  color: var(--fg);
  background: transparent;
  padding: 0;
  border: 0;
}
/* Category value gets accent treatment */
body.editorial-calm #doc-category {
  color: var(--accent);
}
/* Purpose item — single line, italic-ish, color muted */
body.editorial-calm .info-item.purpose-item {
  flex: 1;
  min-width: 200px;
  max-width: 420px;
}
body.editorial-calm #doc-purpose {
  font: 400 13px/1.5 var(--font-sans);
  color: var(--fg-body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-style: italic;
}

/* Action button cluster, top-right of the info row */
body.editorial-calm .info-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
body.editorial-calm .info-actions .btn-icon-only {
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--fg-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
body.editorial-calm .info-actions .btn-icon-only:hover {
  background: var(--bg-secondary);
  border-color: var(--border);
  color: var(--fg);
}

/* Editor body — refined typography on rendered markdown */
body.editorial-calm .collaborative-edit-wrapper,
body.editorial-calm #collaborative-editor-container {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 40px;
  box-shadow: var(--shadow-1);
}
body.editorial-calm .collaborative-edit-wrapper h1,
body.editorial-calm .collaborative-edit-wrapper h2,
body.editorial-calm #collaborative-editor-container h1,
body.editorial-calm #collaborative-editor-container h2 {
  font-family: var(--font-serif);
  letter-spacing: -0.015em;
  color: var(--fg);
  font-weight: 400;
}
body.editorial-calm .collaborative-edit-wrapper h1 { font-size: 28px; line-height: 1.2; }
body.editorial-calm .collaborative-edit-wrapper h2 { font-size: 22px; line-height: 1.25; margin-top: 28px; }
body.editorial-calm .collaborative-edit-wrapper h3,
body.editorial-calm #collaborative-editor-container h3 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 17px;
  color: var(--fg);
  margin-top: 22px;
  letter-spacing: -0.005em;
}
body.editorial-calm .collaborative-edit-wrapper p,
body.editorial-calm #collaborative-editor-container p {
  font: var(--text-body-lg-weight) var(--text-body-lg-size)/var(--text-body-lg-lh) var(--font-sans);
  letter-spacing: var(--text-body-lg-track);
  color: var(--fg-body);
  margin: 10px 0;
}
body.editorial-calm .collaborative-edit-wrapper code,
body.editorial-calm #collaborative-editor-container code {
  font-family: var(--font-mono);
  background: var(--bg-secondary);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 13px;
}

/* Contents (TOC) sidebar */
body.editorial-calm .toc-sidebar,
body.editorial-calm .document-toc,
body.editorial-calm .contents-panel,
body.editorial-calm [class*="toc-"]:not(p) {
  background: transparent;
}
body.editorial-calm .toc-header,
body.editorial-calm .toc-title {
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 10px;
}
body.editorial-calm .toc-item,
body.editorial-calm .toc-link,
body.editorial-calm .toc-entry {
  display: block;
  padding: 5px 10px;
  border-radius: var(--radius-md);
  color: var(--fg-body);
  font: 500 13px/1.4 var(--font-sans);
  text-decoration: none;
}
body.editorial-calm .toc-item:hover,
body.editorial-calm .toc-link:hover,
body.editorial-calm .toc-entry:hover {
  background: var(--bg-secondary);
  color: var(--fg);
}
body.editorial-calm .toc-item.active,
body.editorial-calm .toc-link.active,
body.editorial-calm .toc-entry.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* ─────────────────────────────────────────────
   Chat conversation pane (right side of /chat.html)
   ───────────────────────────────────────────── */

/* Header strip above the conversation */
body.editorial-calm .chat-header {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
body.editorial-calm .chat-title {
  font: 400 22px/1.25 var(--font-serif);
  letter-spacing: -0.015em;
  color: var(--fg);
}
body.editorial-calm .chat-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
body.editorial-calm .chat-actions .btn-icon {
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--fg-muted);
}
body.editorial-calm .chat-actions .btn-icon:hover {
  background: #FEE2E2;
  color: var(--color-danger);
  border-color: transparent;
}

/* Empty placeholder card — "👋 Start a conversation" */
body.editorial-calm #messagesContainer .empty-state {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  text-align: center;
  max-width: 640px;
  margin: 32px auto;
}
body.editorial-calm #messagesContainer .empty-state::before {
  content: "Ask anything";
  display: block;
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
body.editorial-calm #messagesContainer .empty-state h2 {
  font: 400 26px/1.25 var(--font-serif);
  letter-spacing: -0.02em;
  color: var(--fg);
  margin-bottom: 10px;
}
body.editorial-calm #messagesContainer .empty-state p {
  font: 400 14.5px/1.6 var(--font-sans);
  color: var(--fg-muted);
  margin: 0;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* Messages — user is right-aligned, assistant is left-aligned */
body.editorial-calm .messages-container {
  background: var(--bg);
  padding: 32px 28px;
  gap: 24px;
}
body.editorial-calm .message-avatar {
  width: 28px;
  height: 28px;
  font-size: 12px;
  font-family: var(--font-sans);
  font-weight: 600;
}
body.editorial-calm .message.user .message-avatar {
  background: oklch(0.92 0.04 200);
  color: oklch(0.4 0.07 200);
}
body.editorial-calm .message.assistant .message-avatar {
  background: var(--accent-soft);
  color: var(--accent);
}

/* User bubble — soft cream pill, ink text (not flat teal) */
body.editorial-calm .message.user .message-bubble {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  font: 400 14.5px/1.6 var(--font-sans);
}
body.editorial-calm .message.user .message-bubble a {
  color: var(--accent);
}

/* Assistant card — white card with shadow, signature surface */
body.editorial-calm .message.assistant .message-bubble {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  color: var(--fg-body);
  font: 400 14.5px/1.6 var(--font-sans);
  box-shadow: var(--shadow-1);
}
body.editorial-calm .message.assistant .message-bubble p { color: var(--fg-body); }
body.editorial-calm .message.assistant .message-bubble strong { color: var(--fg); }
body.editorial-calm .message.assistant .message-bubble a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Composer (input-container) — pill row at the bottom */
body.editorial-calm .input-container {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 14px 24px 18px;
}
body.editorial-calm .input-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}
body.editorial-calm .btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--fg-body);
  font: 500 12.5px/1 var(--font-sans);
  cursor: pointer;
  transition: background var(--duration-fast) var(--easing-standard);
}
body.editorial-calm .btn-action:hover {
  background: var(--bg-secondary);
  color: var(--fg);
}
body.editorial-calm .help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--fg-muted);
  font: 600 12px/1 var(--font-mono);
  cursor: help;
  border: 1px solid var(--border);
  transition: background var(--duration-fast) var(--easing-standard), color var(--duration-fast) var(--easing-standard);
}
body.editorial-calm .help-icon:hover {
  background: var(--bg-secondary);
  color: var(--fg);
}

/* Voice status pill — replaces inline-styled status span */
body.editorial-calm .ec-voice-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--bg-secondary);
  border-radius: var(--radius-pill);
  font: 500 11px/1 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
body.editorial-calm .ec-input-hint-sep { margin: 0 8px; color: var(--border-strong); }

/* ─────────────────────────────────────────────
   Onboarding tour modal — restyle to Editorial Calm
   ───────────────────────────────────────────── */
body.editorial-calm .onboarding-overlay {
  background: rgba(27, 28, 32, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
body.editorial-calm .onboarding-modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-3);
  padding: 32px 28px 24px;
  max-width: 420px;
  font-family: var(--font-sans);
}
body.editorial-calm .onboarding-progress {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
}
body.editorial-calm .onboarding-dot {
  width: 26px;
  height: 3px;
  border-radius: 999px;
  background: var(--border);
  transition: background var(--duration-fast) var(--easing-standard);
}
body.editorial-calm .onboarding-dot.active { background: var(--accent); }
body.editorial-calm .onboarding-dot.completed { background: var(--color-teal-400); }
body.editorial-calm .onboarding-icon {
  width: 56px;
  height: 56px;
  margin: 0 0 18px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
}
body.editorial-calm .onboarding-icon svg { width: 28px; height: 28px; }
body.editorial-calm .onboarding-title {
  font: 400 24px/1.2 var(--font-serif);
  letter-spacing: -0.015em;
  color: var(--fg);
  margin: 0 0 8px;
}
body.editorial-calm .onboarding-text {
  font: 400 14.5px/1.6 var(--font-sans);
  color: var(--fg-muted);
  margin: 0 0 22px;
}
body.editorial-calm .onboarding-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
body.editorial-calm .onboarding-skip {
  background: transparent;
  border: 0;
  color: var(--fg-muted);
  font: 500 13px/1 var(--font-sans);
  cursor: pointer;
  padding: 8px 4px;
  transition: color var(--duration-fast) var(--easing-standard);
}
body.editorial-calm .onboarding-skip:hover { color: var(--fg); }
body.editorial-calm .onboarding-next {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius-pill);
  padding: 10px 22px;
  font: 600 13.5px/1 var(--font-sans);
  cursor: pointer;
  transition: background var(--duration-fast) var(--easing-standard);
}
body.editorial-calm .onboarding-next:hover { background: var(--accent-hover); }

/* ─────────────────────────────────────────────
   Integrations — inner section title
   The page uses <h2> inside .section-header with an SVG + text.
   Bring it into the calm: ink colour, Manrope 600, sans-icon kept.
   ───────────────────────────────────────────── */
body.editorial-calm .integrations-section .section-header h2 {
  font: 600 17px/1.3 var(--font-sans);
  letter-spacing: -0.005em;
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  background: none;
}
body.editorial-calm .integrations-section .section-header h2 svg { color: var(--fg-muted); }
body.editorial-calm .integrations-section .section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
body.editorial-calm .integrations-section .section-count {
  font: 500 11px/1 var(--font-mono);
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  background: var(--bg-secondary);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}

/* ─────────────────────────────────────────────
   Conflicts — resolution decision buttons
   Four-button row: Keep / Accept / Merge / False positive.
   Lucide icons replace 🔒 ✅ ✏️ ❌ emoji.
   ───────────────────────────────────────────── */
body.editorial-calm .resolution-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
body.editorial-calm .resolution-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 14px 14px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color var(--duration-fast) var(--easing-standard),
              box-shadow var(--duration-fast) var(--easing-standard),
              transform var(--duration-fast) var(--easing-standard);
}
body.editorial-calm .resolution-btn:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-1);
  transform: translateY(-1px);
}
body.editorial-calm .resolution-btn.selected,
body.editorial-calm .resolution-btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}
body.editorial-calm .resolution-btn__icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--fg-muted);
  margin-bottom: 6px;
}
body.editorial-calm .resolution-btn[data-decision="update"] .resolution-btn__icon { background: #D1FAE5; color: #065F46; }
body.editorial-calm .resolution-btn[data-decision="keep_original"] .resolution-btn__icon { background: var(--bg-secondary); color: var(--fg-muted); }
body.editorial-calm .resolution-btn[data-decision="custom"] .resolution-btn__icon { background: #DBEAFE; color: #1E40AF; }
body.editorial-calm .resolution-btn[data-decision="error"] .resolution-btn__icon { background: #FEE2E2; color: var(--color-danger); }
body.editorial-calm .resolution-btn__title {
  font: 600 14px/1.3 var(--font-sans);
  color: var(--fg);
  letter-spacing: -0.005em;
}
body.editorial-calm .resolution-btn__meta {
  font: 400 12px/1.4 var(--font-sans);
  color: var(--fg-muted);
}

/* ─────────────────────────────────────────────
   Inbox transcript modal — Q+A bubbles + composer + side panels
   (Built by js/inbox.js openTranscript)
   ───────────────────────────────────────────── */
/* Loading / error text utilities */
body.editorial-calm .ec-loading-text,
body.editorial-calm .ec-notes-loading {
  color: var(--fg-muted);
  font: 500 12.5px/1.5 var(--font-sans);
  margin: 0;
  padding: 8px 0;
}
body.editorial-calm .ec-error-text {
  color: var(--color-danger);
  font: 500 13.5px/1.55 var(--font-sans);
  margin: 8px 0;
}

/* Inline eyebrow label (used inline alongside a value, e.g. "VISITOR <chip>") */
body.editorial-calm .ec-eyebrow-inline {
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-right: 2px;
}

/* Transcript headerbar — visitor + presence + session row */
body.editorial-calm .ec-transcript-headerbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font: 400 12px/1.4 var(--font-sans);
  color: var(--fg-muted);
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* Presence pill — visitor online/offline indicator */
body.editorial-calm .ec-presence-pill {
  display: inline-flex;
  align-items: center;
  font: 600 11px/1 var(--font-sans);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: -0.005em;
}
body.editorial-calm .ec-presence-pill.is-online { background: #D1FAE5; color: #065F46; }
/* Offline is a normal, expected state (visitor closed their tab) — a neutral
   grey, not amber, so it reads as info rather than a warning. */
body.editorial-calm .ec-presence-pill.is-offline { background: var(--bg-secondary); color: var(--fg-muted); }

/* Session id — kept for support/debugging but visually recessive so it doesn't
   compete with the visitor + presence in the header. */
body.editorial-calm .ec-session-ref {
  font: 500 11px/1 var(--font-mono);
  color: var(--fg-muted);
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

/* Status pill — assignment/state indicator */
body.editorial-calm .ec-status-pill {
  display: inline-flex;
  align-items: center;
  font: 600 11px/1 var(--font-sans);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  letter-spacing: -0.005em;
}
body.editorial-calm .ec-status-pill--bot { background: var(--bg-secondary); color: var(--fg-muted); }
body.editorial-calm .ec-status-pill--awaiting_agent { background: #FEF3C7; color: #92400E; }
body.editorial-calm .ec-status-pill--assigned { background: var(--accent-soft); color: var(--accent); }
body.editorial-calm .ec-status-pill--resolved { background: #D1FAE5; color: #065F46; }
body.editorial-calm .ec-status-pill--archived { background: var(--bg-secondary); color: var(--fg-muted); }

/* Assignment bar — status pill + action buttons row */
body.editorial-calm .ec-assignment-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  flex-wrap: wrap;
}
body.editorial-calm .ec-assignment-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Reassign picker (revealed when user clicks Reassign…) */
body.editorial-calm .ec-assignment-picker {
  padding: 10px 12px;
  background: #FEF3C7;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}
body.editorial-calm .ec-assignment-picker__label {
  font: 500 12px/1 var(--font-sans);
  color: var(--fg);
  margin-bottom: 6px;
}
body.editorial-calm .ec-assignment-picker__row {
  display: flex;
  gap: 6px;
  align-items: center;
}
body.editorial-calm .ec-assignment-picker__select { flex: 1; min-width: 0; }

/* Tags panel — chips + add-form */
body.editorial-calm .ec-tags-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 6px 0;
}
body.editorial-calm .ec-tags-panel__label {
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-right: 4px;
}
body.editorial-calm .ec-tags-panel__chips {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
body.editorial-calm .ec-tags-panel__add {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
body.editorial-calm .ec-tags-panel__input { width: 140px; }
body.editorial-calm .ec-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 500 11px/1.3 var(--font-sans);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}
body.editorial-calm .ec-tag-chip__x {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.6;
}
body.editorial-calm .ec-tag-chip__x:hover { opacity: 1; }
body.editorial-calm .ec-tags-empty {
  color: var(--fg-muted);
  font: 400 12px/1.4 var(--font-sans);
}

/* Notes panel — agent-only internal notes */
body.editorial-calm .ec-notes-panel {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
body.editorial-calm .ec-notes-panel__label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 10px;
}
body.editorial-calm .ec-notes-panel__hint {
  font-family: var(--font-sans);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: var(--fg-muted);
}
body.editorial-calm .ec-notes-list {
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 10px;
}
body.editorial-calm .ec-notes-add {
  display: flex;
  gap: 6px;
}
body.editorial-calm .ec-notes-textarea {
  flex: 1 1 auto;
  resize: vertical;
  min-height: 44px;
  font-size: 13px;
}
body.editorial-calm .ec-notes-add-btn {
  align-self: flex-end;
  width: auto;
  min-width: 70px;
  flex: 0 0 auto;
}

/* Transcript message thread */
body.editorial-calm .ec-transcript-thread {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 4px 0;
}
body.editorial-calm .ec-transcript-row {
  display: flex;
  margin-bottom: 4px;
}
body.editorial-calm .ec-transcript-row.is-user { justify-content: flex-end; }
body.editorial-calm .ec-transcript-row.is-assistant { justify-content: flex-start; }
body.editorial-calm .ec-transcript-bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  white-space: pre-wrap;
  word-wrap: break-word;
  font: 400 14px/1.55 var(--font-sans);
}
body.editorial-calm .ec-transcript-bubble.is-user {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--fg);
  border-bottom-right-radius: 6px;
}
body.editorial-calm .ec-transcript-bubble.is-assistant {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--fg-body);
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow-1);
}
body.editorial-calm .ec-transcript-meta {
  font: 500 11px/1 var(--font-mono);
  color: var(--fg-muted);
  letter-spacing: 0.04em;
  margin: 2px 4px 12px 0;
}
body.editorial-calm .ec-transcript-meta.is-user { text-align: right; margin-right: 4px; }
body.editorial-calm .ec-transcript-meta.is-assistant { text-align: left; margin-left: 4px; }
body.editorial-calm .ec-transcript-empty {
  color: var(--fg-muted);
  font: 400 14px/1.55 var(--font-sans);
  text-align: center;
  padding: 24px 0;
}

/* Reply composer */
body.editorial-calm .ec-transcript-composer {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
body.editorial-calm .ec-transcript-textarea {
  flex: 1 1 auto;
  resize: vertical;
  min-height: 44px;
  font: 400 14px/1.55 var(--font-sans);
}
body.editorial-calm .ec-transcript-send {
  align-self: flex-end;
  width: auto;
  min-width: 88px;
  flex: 0 0 auto;
}
body.editorial-calm .ec-transcript-status {
  font: 500 11.5px/1.4 var(--font-mono);
  color: var(--fg-muted);
  letter-spacing: 0.04em;
  margin-top: 6px;
}

/* ─────────────────────────────────────────────
   Form patterns (used inside modals)
   ───────────────────────────────────────────── */
body.editorial-calm .modal-content--lg { max-width: 720px; max-height: 90vh; overflow-y: auto; }

body.editorial-calm .ec-form-lede {
  font: 400 14px/1.55 var(--font-sans);
  color: var(--fg-muted);
  margin: 0 0 18px;
}

body.editorial-calm .form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
body.editorial-calm .form-group label {
  font: 500 12px/1 var(--font-sans);
  letter-spacing: 0;
  color: var(--fg);
  margin: 0;
  text-transform: none;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
body.editorial-calm .ec-field-required {
  font: 600 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-danger);
}
body.editorial-calm .ec-field-optional {
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

/* Form input field defaults inside modal (overrides legacy .form-control) */
body.editorial-calm .modal-body .form-control,
body.editorial-calm .modal-body input.form-control,
body.editorial-calm .modal-body textarea.form-control {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font: 400 14px/1.5 var(--font-sans);
  color: var(--fg);
  margin: 0;
}
body.editorial-calm .modal-body select.form-control { width: 100%; }

/* Two-column inline field row (select + free-text fallback, etc.) */
body.editorial-calm .ec-field-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
body.editorial-calm .ec-field-row__half { flex: 0 0 50%; }
body.editorial-calm .ec-field-row .form-control:not(.ec-field-row__half) { flex: 1; }

/* iOS-style toggle (replaces legacy .toggle-input checkbox) */
body.editorial-calm .ec-toggle-group { padding: 8px 0 4px; }
body.editorial-calm .ec-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
body.editorial-calm .ec-toggle-input {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px;
  border: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
}
body.editorial-calm .ec-toggle-track {
  position: relative;
  width: 34px;
  height: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  flex-shrink: 0;
  transition: background var(--duration-fast) var(--easing-standard),
              border-color var(--duration-fast) var(--easing-standard);
}
body.editorial-calm .ec-toggle-track::before {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-1);
  transition: transform var(--duration-fast) var(--easing-standard);
}
body.editorial-calm .ec-toggle-input:checked + .ec-toggle-track {
  background: var(--accent);
  border-color: var(--accent);
}
body.editorial-calm .ec-toggle-input:checked + .ec-toggle-track::before {
  transform: translateX(14px);
}
body.editorial-calm .ec-toggle-input:focus-visible + .ec-toggle-track {
  outline: 2px solid var(--color-teal-400);
  outline-offset: 2px;
}
body.editorial-calm .ec-toggle-text {
  font: 500 13.5px/1.3 var(--font-sans);
  color: var(--fg);
}
body.editorial-calm .ec-toggle-hint {
  font: 500 11.5px/1.3 var(--font-mono);
  color: var(--fg-muted);
  letter-spacing: 0.04em;
}

/* Inline progress block inside a form */
body.editorial-calm .ec-form-progress {
  margin-top: 18px;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}
body.editorial-calm .ec-form-progress__label {
  font: 500 13px/1.4 var(--font-sans);
  color: var(--fg-body);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Input box — single pill row */
body.editorial-calm .input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
body.editorial-calm .input-box {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--duration-fast) var(--easing-standard);
}
body.editorial-calm .input-box:focus-within {
  border-color: var(--accent);
  box-shadow: none;
}
body.editorial-calm .input-field {
  width: 100%;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  font: 400 14.5px/1.55 var(--font-sans);
  color: var(--fg);
  min-height: 24px;
  max-height: 220px;
  padding: 0;
}
body.editorial-calm .input-field::placeholder {
  color: var(--fg-muted);
}
body.editorial-calm .input-hint {
  font: 500 11px/1 var(--font-mono);
  color: var(--fg-muted);
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Send button — primary teal pill, lifts out of the input box */
body.editorial-calm .btn-send {
  flex: 0 0 auto;
  align-self: flex-end;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius-pill);
  font: 600 13.5px/1 var(--font-sans);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background var(--duration-fast) var(--easing-standard);
  min-height: 44px;
}
body.editorial-calm .btn-send:hover:not(:disabled) {
  background: var(--accent-hover);
}
body.editorial-calm .btn-send:disabled {
  background: var(--color-ink-300);
  cursor: not-allowed;
}

/* Sessions panel (left side of chat page) */
body.editorial-calm .session-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 6px;
  transition: border-color var(--duration-fast) var(--easing-standard),
              background var(--duration-fast) var(--easing-standard);
}
body.editorial-calm .session-item:hover {
  border-color: var(--border-strong);
  background: var(--bg-secondary);
}
body.editorial-calm .session-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
body.editorial-calm .session-name {
  font: 600 13.5px/1.35 var(--font-sans);
  color: var(--fg);
  letter-spacing: -0.005em;
}
body.editorial-calm .session-meta,
body.editorial-calm .session-item-header + div {
  font: 500 11px/1 var(--font-mono);
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  margin-top: 4px;
}

/* ─────────────────────────────────────────────
   Modals — confirm dialogs, file preview, profile edit,
   invite member, delete chat, etc.
   Two roots: .modal-overlay (used in some places) and
   .modal (used by confirm-modal.js). Style both.
   ───────────────────────────────────────────── */
body.editorial-calm .modal-overlay,
body.editorial-calm .modal {
  background: rgba(27, 28, 32, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: var(--space-6);
}

body.editorial-calm .modal-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-3);
  max-width: 540px;
  width: 100%;
}
body.editorial-calm .modal-small .modal-content { max-width: 440px; }
body.editorial-calm .modal-large .modal-content { max-width: 920px; }
/* Extracted-text modal: bound the height and let the body scroll (extractions
   can run to many pages). Chunks flow at natural height — the modal scrolls,
   not each chunk, so reading is one smooth scroll. */
body.editorial-calm #context-modal .modal-content {
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
body.editorial-calm #context-modal .modal-body {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}
body.editorial-calm #context-modal .context-content { max-height: none; overflow: visible; }
/* Section summary (content-type shown once) + numbered section labels
   (replace the content-type badge that was repeated on every chunk). */
body.editorial-calm #context-modal .context-summary { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
body.editorial-calm #context-modal .context-summary-count { color: var(--fg-muted); font-size: 12px; }
body.editorial-calm #context-modal .context-section-label {
  font: 600 11px/1 var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
}
/* Rendered Markdown — real headings, lists, emphasis instead of raw text. */
body.editorial-calm #context-modal .context-content.markdown-body { white-space: normal; }
body.editorial-calm #context-modal .markdown-body > *:first-child { margin-top: 0; }
body.editorial-calm #context-modal .markdown-body > *:last-child { margin-bottom: 0; }
body.editorial-calm #context-modal .markdown-body h1,
body.editorial-calm #context-modal .markdown-body h2,
body.editorial-calm #context-modal .markdown-body h3,
body.editorial-calm #context-modal .markdown-body h4 { font-weight: 600; line-height: 1.3; margin: 14px 0 6px; }
body.editorial-calm #context-modal .markdown-body h1 { font-size: 18px; }
body.editorial-calm #context-modal .markdown-body h2 { font-size: 16px; }
body.editorial-calm #context-modal .markdown-body h3 { font-size: 14px; }
body.editorial-calm #context-modal .markdown-body h4 { font-size: 13px; }
body.editorial-calm #context-modal .markdown-body p { margin: 6px 0; }
body.editorial-calm #context-modal .markdown-body ul,
body.editorial-calm #context-modal .markdown-body ol { margin: 6px 0; padding-left: 20px; }
body.editorial-calm #context-modal .markdown-body li { margin: 2px 0; }
body.editorial-calm #context-modal .markdown-body strong { font-weight: 600; }
body.editorial-calm #context-modal .markdown-body a { color: var(--accent); }
body.editorial-calm #context-modal .markdown-body code {
  background: var(--bg-secondary); padding: 1px 5px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 0.9em;
}
body.editorial-calm #context-modal .markdown-body pre {
  background: var(--bg-secondary); padding: 10px 12px; border-radius: 6px; overflow-x: auto; margin: 8px 0;
}
body.editorial-calm #context-modal .markdown-body pre code { background: none; padding: 0; }
body.editorial-calm #context-modal .markdown-body blockquote {
  border-left: 3px solid var(--border); margin: 8px 0; padding: 2px 0 2px 12px; color: var(--fg-muted);
}
body.editorial-calm #context-modal .markdown-body table { border-collapse: collapse; margin: 8px 0; }
body.editorial-calm #context-modal .markdown-body th,
body.editorial-calm #context-modal .markdown-body td { border: 1px solid var(--border); padding: 4px 8px; text-align: left; }
/* Deploy (WhatsApp/widget/hosted) connect+edit modal: wider so the full-width
   handoff fields and 2-col rows aren't squeezed. Scoped to the deploy modal so
   other modals are unaffected. (Note: the generic .modal-content--lg modifier is
   itself shadowed by the 540px base above due to source order — a separate latent
   bug; this scoped rule sidesteps it.) */
body.editorial-calm #deploy-modal .modal-content.deploy-modal-content {
  max-width: 820px; max-height: 92vh; overflow-y: auto;
}
/* CTA: keep footer buttons content-width and right-aligned — the primary
   shouldn't stretch across the modal. Scoped to the deploy modal. */
body.editorial-calm #deploy-modal .modal-footer { justify-content: flex-end; }
body.editorial-calm #deploy-modal .modal-footer .btn { flex: 0 0 auto; width: auto; min-width: 104px; }

/* Inline info trigger with hover/focus tooltip — used in form labels to give
   extra context without cluttering the field (e.g. the WhatsApp handoff rule). */
body.editorial-calm .ec-field-info {
  align-self: center;
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; padding: 0; border: 0; background: none;
  color: var(--color-ink-400, #9ca3af); cursor: help; position: relative;
}
body.editorial-calm .ec-field-info:hover,
body.editorial-calm .ec-field-info:focus-visible { color: var(--accent); outline: none; }
body.editorial-calm .ec-field-info::after {
  content: attr(data-ec-tip);
  position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  width: 340px; max-width: 80vw; white-space: normal; text-align: left;
  background: var(--color-ink-900, #1B1C20); color: #fff;
  font: 400 12.5px/1.55 var(--font-sans);
  padding: 11px 13px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.18);
  opacity: 0; visibility: hidden; transition: opacity .15s, visibility .15s;
  z-index: 1000; pointer-events: none;
}
body.editorial-calm .ec-field-info:hover::after,
body.editorial-calm .ec-field-info:focus-visible::after { opacity: 1; visibility: visible; }

body.editorial-calm .modal-header {
  padding: 22px 24px 14px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  position: relative;
}
/* Optional eyebrow above the title — add data-eyebrow="..." on .modal-header */
body.editorial-calm .modal-header[data-eyebrow]::before {
  content: attr(data-eyebrow);
  display: block;
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
body.editorial-calm .modal-header h2,
body.editorial-calm .modal-header h3 {
  font: 400 22px/1.25 var(--font-serif);
  letter-spacing: -0.015em;
  color: var(--fg);
  font-weight: 400;
  margin: 0;
}

body.editorial-calm .modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--fg-muted);
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
body.editorial-calm .modal-close:hover {
  background: var(--bg-secondary);
  border-color: var(--border);
  color: var(--fg);
}

body.editorial-calm .modal-body {
  padding: 18px 24px 24px;
  background: transparent;
}
body.editorial-calm .modal-body p {
  font: 400 14.5px/1.6 var(--font-sans);
  color: var(--fg-body);
  margin: 0 0 10px;
}
body.editorial-calm .modal-body p:last-child { margin-bottom: 0; }
/* Description block that may contain block-level children (lists, alerts) —
   same look as a modal paragraph but a valid <div> wrapper. */
body.editorial-calm .modal-body-text {
  font: 400 14.5px/1.6 var(--font-sans);
  color: var(--fg-body);
  margin: 0 0 16px;
}
body.editorial-calm .modal-body p em {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--fg);
}
body.editorial-calm .modal-body label {
  display: block;
  font: 500 12px/1 var(--font-sans);
  color: var(--fg);
  margin-bottom: 6px;
}

body.editorial-calm .modal-footer {
  padding: 14px 24px 20px;
  border-top: 1px solid var(--border);
  background: transparent;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}
/* Lists inside modal bodies get a readable indent (was an inline style on the
   cloud-error modal). */
body.editorial-calm .modal-body ul { margin: 8px 0 0 20px; color: var(--fg-body); }
/* Connected-account panel in the cloud-error modal (was fully inline-styled). */
body.editorial-calm .modal-account-info {
  background: var(--bg-secondary);
  padding: 12px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}
body.editorial-calm .modal-account-info__label { font-size: 12px; color: var(--fg-body); }
body.editorial-calm .modal-account-info__email { font-weight: 500; margin: 4px 0; }
/* Paste-text dialog: opens OVER the questions modal, so it must stack above the
   standard z-index:1000 overlay. Textarea was previously inline-styled. */
body.editorial-calm #textarea-dialog-overlay { z-index: 10000; }
body.editorial-calm .ec-textarea-dialog-input {
  width: 100%; height: 200px; padding: 12px;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  font-family: var(--font-sans); font-size: 14px; resize: vertical;
}
body.editorial-calm .modal-footer .btn {
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font: 600 13px/1 var(--font-sans);
  /* Override the global `.btn-primary { width: 100% }` (styles.css): in a
     flex footer that makes the primary action stretch to fill the row while
     the secondary stays content-width — a lopsided CTA. Footer buttons are
     auto-width and cluster at flex-end. */
  width: auto;
}
body.editorial-calm .modal-footer .btn-secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
}
body.editorial-calm .modal-footer .btn-secondary:hover {
  background: var(--bg-secondary);
}

/* Inline form/input inside modal body */
body.editorial-calm .modal-body input[type="text"],
body.editorial-calm .modal-body input[type="email"],
body.editorial-calm .modal-body input[type="password"],
body.editorial-calm .modal-body textarea,
body.editorial-calm .modal-body select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font: 400 14px/1.5 var(--font-sans);
  color: var(--fg);
  margin-bottom: 14px;
}
body.editorial-calm .modal-body input:focus,
body.editorial-calm .modal-body textarea:focus,
body.editorial-calm .modal-body select:focus {
  border-color: var(--accent);
  outline: none;
}

/* ─────────────────────────────────────────────
   Files page — inline expanded preview
   (rendered inside .preview-row > .file-preview-container)
   ───────────────────────────────────────────── */
body.editorial-calm .expand-preview-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--duration-fast) var(--easing-standard),
              background var(--duration-fast) var(--easing-standard);
}
body.editorial-calm .expand-preview-btn:hover { background: var(--bg-secondary); color: var(--fg); }
body.editorial-calm .expand-preview-btn.expanded { transform: rotate(90deg); color: var(--accent); }
body.editorial-calm .expand-preview-btn svg { width: 14px; height: 14px; }

body.editorial-calm tr.preview-row { background: var(--bg-secondary); }
body.editorial-calm tr.preview-row > td {
  padding: 0 !important;
  border-bottom: 1px solid var(--border);
}
body.editorial-calm .file-preview-container {
  padding: 18px 24px;
  background: var(--bg-secondary);
}

body.editorial-calm .file-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
body.editorial-calm .file-preview-title {
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
body.editorial-calm .file-preview-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
body.editorial-calm .file-preview-actions .btn,
body.editorial-calm .file-preview-actions button {
  padding: 5px 12px;
  font: 600 12px/1 var(--font-sans);
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--fg-body);
  cursor: pointer;
}
body.editorial-calm .file-preview-actions .btn:hover,
body.editorial-calm .file-preview-actions button:hover {
  background: var(--bg);
  color: var(--fg);
  border-color: var(--border-strong);
}

body.editorial-calm .file-preview-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font: 400 13.5px/1.65 var(--font-sans);
  color: var(--fg-body);
  white-space: pre-wrap;
  max-height: 360px;
  overflow-y: auto;
}
body.editorial-calm .file-preview-content pre,
body.editorial-calm .file-preview-content code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 6px;
}

body.editorial-calm .file-preview-truncated {
  margin-top: 8px;
  padding: 8px 12px;
  background: #FEF3C7;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-md);
  font: 500 12px/1.5 var(--font-sans);
  color: #92400E;
  display: flex;
  align-items: center;
  gap: 8px;
}

body.editorial-calm .file-preview-meta {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}
body.editorial-calm .file-preview-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
body.editorial-calm .file-preview-meta-label {
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
body.editorial-calm .file-preview-meta-value {
  font: 600 13px/1.2 var(--font-sans);
  color: var(--fg);
}

/* Loading / error / empty states inside the preview card */
body.editorial-calm .file-preview-loading,
body.editorial-calm .file-preview-error,
body.editorial-calm .file-preview-empty {
  padding: 24px;
  text-align: center;
  background: var(--bg-elevated);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  font: 400 13.5px/1.55 var(--font-sans);
  color: var(--fg-muted);
}
body.editorial-calm .file-preview-error { color: #92400E; border-color: #FDE68A; background: #FEF3C7; }

/* ─────────────────────────────────────────────
   Workspace Settings (team-settings.html)
   ───────────────────────────────────────────── */

/* Top workspace profile card */
body.editorial-calm #team-profile-section { padding: 0; }
body.editorial-calm #team-profile-section .card-body {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 22px !important;
}
body.editorial-calm .team-logo-display,
body.editorial-calm .team-logo-large {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  overflow: hidden;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
body.editorial-calm .team-logo-display img,
body.editorial-calm .team-logo-large img { width: 100%; height: 100%; object-fit: cover; }

/* Workspace identity stack (name + edit hint) */
body.editorial-calm #team-profile-section .team-name {
  font: 600 18px/1.2 var(--font-sans);
  letter-spacing: -0.005em;
  color: var(--fg);
  background: none;
  padding: 0;
  border: 0;
  display: block;
  white-space: normal;
}
body.editorial-calm .team-name-edit-hint,
body.editorial-calm #team-profile-section .edit-hint {
  font: 500 11px/1.4 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

/* Preferences grid — variants for 2-col / 4-col */
body.editorial-calm .preferences-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
body.editorial-calm .preferences-grid.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
body.editorial-calm .preferences-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Members table (users-table) */
body.editorial-calm .users-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
body.editorial-calm .users-table thead th {
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  background: var(--bg-secondary);
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
body.editorial-calm .users-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-sans);
}
body.editorial-calm .user-row { transition: background var(--duration-fast) var(--easing-standard); }
body.editorial-calm .user-row:hover { background: var(--bg-secondary); }

body.editorial-calm .user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
body.editorial-calm .user-avatar-small {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: oklch(0.92 0.04 200);
  color: oklch(0.4 0.07 200);
  display: grid;
  place-items: center;
  font: 600 12px var(--font-sans);
  flex-shrink: 0;
  text-transform: uppercase;
}
body.editorial-calm .user-name-cell {
  font: 600 13.5px/1.3 var(--font-sans);
  color: var(--fg);
}
body.editorial-calm .user-email-cell {
  font: 400 12px/1.3 var(--font-sans);
  color: var(--fg-muted);
  margin-top: 2px;
}

/* Role badges — colored pills per role */
body.editorial-calm .role-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font: 600 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
body.editorial-calm .role-badge.role-master {
  background: var(--accent-soft);
  color: var(--accent);
}
body.editorial-calm .role-badge.role-admin {
  background: #FEE2E2;
  color: #991B1B;
}
body.editorial-calm .role-badge.role-editor {
  background: var(--bg-secondary);
  color: var(--fg-body);
  border-color: var(--border);
}
body.editorial-calm .role-badge.role-viewer {
  background: transparent;
  color: var(--fg-muted);
  border-color: var(--border);
}

/* Status badge in members table (active / suspended / pending) */
body.editorial-calm .status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font: 600 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-muted);
}
body.editorial-calm .status-badge.active,
body.editorial-calm .status-badge.status-active {
  background: #D1FAE5;
  color: #065F46;
  border-color: transparent;
}
body.editorial-calm .status-badge.suspended,
body.editorial-calm .status-badge.status-suspended {
  background: #FEE2E2;
  color: #991B1B;
  border-color: transparent;
}

/* Action buttons in the user row */
body.editorial-calm .users-table .btn-icon {
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--fg-muted);
}
body.editorial-calm .users-table .btn-icon:hover {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--fg);
}

/* "Role Permissions" + "Invite Member" buttons row above the table */
body.editorial-calm #team-profile-section + .stats-grid,
body.editorial-calm .stats-grid.section-gap { margin-bottom: 24px; }

/* ─────────────────────────────────────────────
   Deploy + Inbox shared resource tables
   (.resource-table is used on hosted pages, widgets, whatsapp,
   and the inbox conversation list)
   ───────────────────────────────────────────── */
body.editorial-calm .resource-table {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}
body.editorial-calm .resource-table th {
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  background: var(--bg-secondary);
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
body.editorial-calm .resource-table td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--fg-body);
  vertical-align: middle;
}
body.editorial-calm .resource-table tbody tr:last-child td { border-bottom: 0; }
body.editorial-calm .resource-table tbody tr { transition: background var(--duration-fast) var(--easing-standard); }
body.editorial-calm .resource-table tbody tr:hover { background: var(--bg-secondary); }
/* Inbox unread row marker — override the inline yellow style with cream + accent */

/* Mono "key" chip for slugs / source ids / api keys / spaces */
body.editorial-calm .kbd-key {
  display: inline-flex;
  align-items: center;
  font: 500 11.5px/1 var(--font-mono);
  letter-spacing: 0.02em;
  background: var(--bg-secondary);
  color: var(--fg-body);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* Pill status badges (Active / Inactive / Pending / Suspended) */
body.editorial-calm .badge-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font: 600 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-muted);
}
body.editorial-calm .badge-pill.badge-active {
  background: #D1FAE5;
  color: #065F46;
  border-color: transparent;
}
body.editorial-calm .badge-pill.badge-inactive {
  background: var(--bg-secondary);
  color: var(--fg-muted);
  border-color: var(--border);
}
body.editorial-calm .badge-pill.badge-warning,
body.editorial-calm .badge-pill.badge-pending {
  background: #FEF3C7;
  color: #92400E;
  border-color: transparent;
}
body.editorial-calm .badge-pill.badge-danger,
body.editorial-calm .badge-pill.badge-error {
  background: #FEE2E2;
  color: #991B1B;
  border-color: transparent;
}

/* Copy button next to slugs */
body.editorial-calm .copy-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  font: 600 10.5px/1 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  margin-left: 8px;
  transition: background var(--duration-fast) var(--easing-standard),
              color var(--duration-fast) var(--easing-standard);
}
body.editorial-calm .copy-btn:hover {
  background: var(--bg-secondary);
  color: var(--fg);
}

/* Row action cluster */
body.editorial-calm .row-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
body.editorial-calm .row-actions .btn-sm {
  padding: 5px 12px;
  font: 600 12px/1 var(--font-sans);
  border-radius: var(--radius-pill);
}

/* Inbox tag chip (.conv-tag-chip is inline-styled, override) */
body.editorial-calm .conv-tag-chip {
  display: inline-flex !important;
  align-items: center;
  padding: 2px 8px !important;
  border-radius: var(--radius-pill) !important;
  background: var(--bg-secondary) !important;
  color: var(--fg-body) !important;
  font: 500 11px/1.3 var(--font-sans) !important;
  border: 1px solid var(--border);
}
body.editorial-calm .conv-tag-chip:hover {
  background: var(--bg) !important;
  border-color: var(--accent);
  color: var(--accent) !important;
}

/* Deploy filter empty state */
body.editorial-calm .deploy-filter-empty {
  padding: 32px 24px;
  text-align: center;
  background: var(--bg-secondary);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  font: 400 13.5px/1.55 var(--font-sans);
  color: var(--fg-muted);
}

/* Deploy filter bar (search + count) */
body.editorial-calm .deploy-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
body.editorial-calm .deploy-filter-bar input[type="search"],
body.editorial-calm .deploy-filter-bar input[type="text"] {
  flex: 1;
  max-width: 360px;
  padding: 8px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font: 400 13.5px/1 var(--font-sans);
}
body.editorial-calm .deploy-filter-bar input:focus { border-color: var(--accent); outline: none; }

/* Deploy summary cards (top stat row on Deploy) */
body.editorial-calm .deploy-summary-strip {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 16px !important;
}
@media (max-width: 1080px) {
  body.editorial-calm .deploy-summary-strip { grid-template-columns: repeat(2, 1fr) !important; }
}
/* Stat tiles — flat, inset, no border. Passive "at a glance" numbers; visually
   the opposite of the raised, clickable surface cards below them. */
body.editorial-calm .deploy-summary-card {
  background: var(--bg-secondary) !important;
  border: 0 !important;
  border-radius: var(--radius-md) !important;
  padding: 12px 16px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
  box-shadow: none !important;
  text-decoration: none !important;
  color: var(--fg) !important;
}
body.editorial-calm .deploy-summary-card::before { display: none !important; }
body.editorial-calm .deploy-summary-card [data-card-label],
body.editorial-calm .deploy-summary-card .summary-label,
body.editorial-calm .deploy-summary-card .deploy-summary-label {
  font: 500 10px/1 var(--font-mono) !important;
  letter-spacing: 0.07em !important;
  text-transform: uppercase !important;
  color: var(--fg-muted) !important;
  margin-bottom: 0 !important;
}
body.editorial-calm .deploy-summary-card [data-card-value],
body.editorial-calm .deploy-summary-card .summary-value,
body.editorial-calm .deploy-summary-card .deploy-summary-value {
  font: 400 26px/1 var(--font-serif) !important;
  letter-spacing: -0.02em !important;
  color: var(--fg) !important;
  margin: 2px 0 0 !important;
}
body.editorial-calm .deploy-summary-link:hover { background: var(--bg-tertiary, #ECEAE2) !important; }

/* ─────────────────────────────────────────────
   Tables
   ───────────────────────────────────────────── */
body.editorial-calm table {
  border-collapse: separate;
  border-spacing: 0;
}
body.editorial-calm th {
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 12px 14px;
}
body.editorial-calm td {
  border-bottom: 1px solid var(--border);
  padding: 14px;
  font-family: var(--font-sans);
  color: var(--fg-body);
}

/* ─────────────────────────────────────────────
   Icon buttons — small ghost squares used in table rows,
   doc cards, popovers (.btn-icon set across the app)
   ───────────────────────────────────────────── */
body.editorial-calm .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--fg-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--duration-fast) var(--easing-standard),
              border-color var(--duration-fast) var(--easing-standard),
              color var(--duration-fast) var(--easing-standard);
}
body.editorial-calm .btn-icon:hover {
  background: var(--bg-secondary);
  color: var(--fg);
  border-color: var(--border);
}
body.editorial-calm .btn-icon:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}
/* Danger-flavoured variant (delete actions). Matches both legacy onclick
   buttons and the CSP-safe data-action="delete-file" / "delete-*" buttons. */
body.editorial-calm .btn-icon[onclick*="delete" i],
body.editorial-calm .btn-icon[onclick*="trash" i],
body.editorial-calm .btn-icon[data-action*="delete" i],
body.editorial-calm .btn-icon[data-action*="trash" i],
body.editorial-calm .btn-icon.btn-delete,
body.editorial-calm .btn-icon.btn-danger {
  color: var(--color-danger);
}
body.editorial-calm .btn-icon[onclick*="delete" i]:hover,
body.editorial-calm .btn-icon[onclick*="trash" i]:hover,
body.editorial-calm .btn-icon[data-action*="delete" i]:hover,
body.editorial-calm .btn-icon[data-action*="trash" i]:hover,
body.editorial-calm .btn-icon.btn-delete:hover,
body.editorial-calm .btn-icon.btn-danger:hover {
  background: var(--color-danger-soft);
  border-color: transparent;
  color: var(--color-danger);
}
/* Row cells that group multiple .btn-icon get standard gap */
body.editorial-calm td .btn-icon + .btn-icon,
body.editorial-calm .actions .btn-icon + .btn-icon { margin-left: 4px; }

/* ─────────────────────────────────────────────
   User avatar — guarantee a readable initial when no image
   ───────────────────────────────────────────── */
body.editorial-calm .user-avatar,
body.editorial-calm #user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-weight: 600;
  color: oklch(0.4 0.07 200);
  background: oklch(0.92 0.04 200);
  border: 0;
  text-transform: uppercase;
  letter-spacing: 0;
}
body.editorial-calm .user-avatar img {
  width: 100%; height: 100%; border-radius: inherit; object-fit: cover;
}

/* ─────────────────────────────────────────────
   Source chip (.ub-source) — extends tokens.css with row-friendly
   sizing + a label-prefix variant for citation lines.
   ───────────────────────────────────────────── */
body.editorial-calm .ub-sources {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
body.editorial-calm .ub-sources .ub-sources__label {
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-right: 2px;
}
/* Local-source variant — no icon, dimmer */
body.editorial-calm .ub-source--local {
  background: var(--bg-secondary);
  color: var(--fg-muted);
  border-color: transparent;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ─────────────────────────────────────────────
   Editorial Calm — page structure utilities
   (Used by the dashboard rewrite; designed to be reusable
   on Files, Documents, etc. when they get the same pass.)
   ───────────────────────────────────────────── */

/* Hero — big Newsreader display headline with italic em accent */
body.editorial-calm .ec-hero {
  border-bottom: 1px solid var(--border);
  padding-bottom: 28px;
  margin-bottom: 28px;
  max-width: 880px;
}
body.editorial-calm .ec-hero-title {
  font: 400 44px/1.05 var(--font-serif) !important;
  letter-spacing: -0.025em !important;
  color: var(--fg) !important;
  margin: 0 0 14px !important;
  max-width: 760px;
}
body.editorial-calm .ec-hero-title em {
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}
body.editorial-calm .ec-hero-lede {
  font: 400 17px/1.55 var(--font-sans) !important;
  letter-spacing: -0.005em;
  color: var(--fg-muted) !important;
  margin: 0 !important;
  max-width: 640px;
}
/* Hero CTAs — primary + secondary pair under the lede */
body.editorial-calm .ec-hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  align-items: center;
  justify-content: flex-start;
}
body.editorial-calm .ec-hero-cta .btn {
  padding: 10px 22px;
  width: auto !important;
  flex: 0 0 auto;
  text-decoration: none;
}

/* Section — eyebrow + h2 above a card/grid */
body.editorial-calm .ec-section {
  margin-bottom: 36px;
}
body.editorial-calm .ec-section-head {
  margin-bottom: 14px;
}
/* Row variant — left content + right-aligned action(s) */
body.editorial-calm .ec-section-head--row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
body.editorial-calm .ec-section-head--row > div:first-child { flex: 1; min-width: 0; }
body.editorial-calm .ec-section-head .ub-eyebrow {
  display: block;
  margin-bottom: 6px;
}
body.editorial-calm .ec-section-head h2 {
  font: 400 26px/1.2 var(--font-serif);
  letter-spacing: -0.02em;
  color: var(--fg);
  margin: 0;
  font-weight: 400;
}
body.editorial-calm .ec-section-sub {
  font: 400 14px/1.55 var(--font-sans);
  color: var(--fg-muted);
  margin: 6px 0 0;
  max-width: 560px;
}

/* 3-col grid (and auto-fit for smaller widths) */
body.editorial-calm .ec-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 960px) {
  body.editorial-calm .ec-grid-3 { grid-template-columns: 1fr; }
}

/* Stat grid — pilot pattern (no icons, mono label + serif number + trend) */
body.editorial-calm .ec-stats-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}
body.editorial-calm .ec-stat {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: none;
  /* Override the inherited teal-top-border treatment from styles.css */
  border-top: 1px solid var(--border);
}
body.editorial-calm .ec-stat::before { display: none; }   /* kill any old ::before bar */
body.editorial-calm .ec-stat .stat-label {
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
body.editorial-calm .ec-stat .ec-stat-value {
  font: 400 36px/1 var(--font-serif);
  letter-spacing: -0.025em;
  color: var(--fg) !important;
  margin: 4px 0 6px;
  text-align: left !important;
}
body.editorial-calm .ec-stat .ec-stat-trend {
  font: 500 12px/1.4 var(--font-sans);
  color: var(--fg-muted);
  min-height: 1.4em;
}
/* Reserve the brand accent for genuinely positive trends, not every label. */
body.editorial-calm .ec-stat .ec-stat-trend--positive { color: var(--accent); }
body.editorial-calm .ec-stat.clickable {
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--easing-standard),
              box-shadow var(--duration-fast) var(--easing-standard);
}
body.editorial-calm .ec-stat.clickable:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-1);
}

/* Card with eyebrow header + body content (Master/Editor system stats) */
body.editorial-calm .ec-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 !important;   /* override legacy .card margin-bottom */
  box-shadow: none;
}
body.editorial-calm .ec-card--lg { padding: 24px; }
body.editorial-calm .ec-card .ub-eyebrow { margin: 0; }
body.editorial-calm .ec-card-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
body.editorial-calm .ec-card-stat-value {
  font: 400 32px/1 var(--font-serif);
  letter-spacing: -0.02em;
  color: var(--fg);
}
/* Pending count is a *count*, not a warning. Keep it ink; the eyebrow + meta
   carry the meaning. Red gets reserved for true alerts (failed jobs, errors). */
body.editorial-calm .ec-card-stat-value--warning { color: var(--fg); }
body.editorial-calm .ec-card-stat-meta {
  font: 400 13px/1.4 var(--font-sans);
  color: var(--fg-muted);
}
body.editorial-calm .ec-card-foot {
  display: flex;
  justify-content: space-between;
  font: 500 12px/1.4 var(--font-sans);
  color: var(--fg-muted);
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
body.editorial-calm .ec-card-loading {
  padding: 8px 0;
  color: var(--fg-muted);
}

/* Progress bar refinement */
body.editorial-calm .ec-progress {
  background: var(--bg-secondary);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
  margin: 0;
}
body.editorial-calm .ec-progress .progress-bar-fill {
  background: var(--accent);
  height: 100%;
  border-radius: 999px;
  transition: width var(--duration-base) var(--easing-emphasis);
}
/* Default progress-fill start state — kills inline style="width:0%" need */
body.editorial-calm .progress-bar-fill {
  width: 0;
  transition: width var(--duration-base) var(--easing-emphasis);
}

/* Questions-by-user rows (under "Open Questions" master card) */
body.editorial-calm .ec-questions-by-user {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  font: 400 13px/1.4 var(--font-sans);
  color: var(--fg-body);
}
body.editorial-calm .ec-questions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font: 400 13px/1.4 var(--font-sans);
}
body.editorial-calm .ec-questions-row:last-of-type { border-bottom: 0; }
body.editorial-calm .ec-questions-row__name { color: var(--fg); }
body.editorial-calm .ec-questions-row__count {
  color: var(--fg);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
body.editorial-calm .ec-questions-row__more {
  display: block;
  text-align: center;
  padding: 8px 0;
  color: var(--accent);
  font: 500 12px/1 var(--font-sans);
  text-decoration: none;
  margin-top: 4px;
}
body.editorial-calm .ec-questions-row__more:hover { text-decoration: underline; }
body.editorial-calm .ec-questions-empty,
body.editorial-calm .ec-load-failed {
  color: var(--fg-muted);
  text-align: center;
  font: 500 12.5px/1.4 var(--font-sans);
  padding: 10px 0;
  margin: 0;
}

/* Files-by-type chart rows */
body.editorial-calm .ec-type-row { margin-bottom: 10px; }
body.editorial-calm .ec-type-row__head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font: 400 13px/1.4 var(--font-sans);
  color: var(--fg-body);
}
body.editorial-calm .ec-type-row__name {
  text-transform: capitalize;
}
body.editorial-calm .ec-type-row__count {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
}
body.editorial-calm .ec-type-row__bar { height: 6px; }
body.editorial-calm .ec-type-row__bar .progress-bar-fill { background: var(--accent); }
body.editorial-calm .ec-type-row__total {
  text-align: center;
  padding-top: 6px;
  font: 500 12px/1.4 var(--font-sans);
  color: var(--fg-muted);
}

/* File-icon emoji wrapper (replaces inline font-size: 20px in JS) */
body.editorial-calm .file-icon--emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-muted);
  width: 28px;
  height: 28px;
  background: var(--bg-secondary, #F1EFE9);
  border-radius: var(--radius-sm, 6px);
}
body.editorial-calm .file-icon--emoji svg { width: 16px; height: 16px; }

/* File-type label ("TEXT" / "PDF" / "AUDIO") — should read as a mono tag,
   not body type that competes with the filename. */
body.editorial-calm .file-type-label {
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

/* Badge sizing — match the spec (11.5px Manrope 600 with tight tracking) */
body.editorial-calm .badge,
body.editorial-calm .badge-pending,
body.editorial-calm .badge-processing,
body.editorial-calm .badge-ready,
body.editorial-calm .badge-failed {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}
/* Status badge tones from the semantic soft tokens (were legacy hardcoded hex
   inherited from styles.css). */
body.editorial-calm .badge-ready      { background: var(--color-success-soft, #D1FAE5); color: var(--color-success-fg, #065F46); border-color: transparent; }
body.editorial-calm .badge-pending    { background: var(--color-warning-soft, #FEF3C7); color: var(--color-warning-fg, #92400E); border-color: transparent; }
body.editorial-calm .badge-processing { background: var(--color-info-soft, #DBEAFE);    color: var(--color-info-fg, #1E40AF);    border-color: transparent; }
body.editorial-calm .badge-failed     { background: var(--color-danger-soft, #FEE2E2);  color: var(--color-danger-fg, #991B1B);  border-color: transparent; }
/* Neutral type badge (was legacy .badge-secondary on --light/--dark tokens). */
body.editorial-calm .badge-secondary  { background: var(--bg-secondary); color: var(--fg-body); border: 1px solid var(--border); }
/* Context-modal caption meta (section date + quality) — was inline font/colour. */
body.editorial-calm #context-modal .context-section-meta { font: 500 12px/1.5 var(--font-sans); color: var(--fg-muted); margin-top: 8px; }
/* Error variant of a file-details value (was inline colour). */
body.editorial-calm .detail-value--error { color: var(--color-danger); }

/* Bulk-selection bar — legacy styles.css painted it a bold var(--primary)
   (wrong teal) band with translucent-white buttons + hardcoded #dc2626 red,
   heavier than the calm page. Re-tone to a soft branded selection surface. */
body.editorial-calm .bulk-actions-bar {
  background: var(--accent-soft);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
body.editorial-calm .bulk-actions-left span,
body.editorial-calm #selected-count { color: var(--accent); font-weight: 600; }
body.editorial-calm .bulk-actions-bar .btn-secondary {
  background: var(--bg-elevated); border-color: var(--border); color: var(--fg-body);
}
body.editorial-calm .bulk-actions-bar .btn-secondary:hover {
  background: var(--bg); border-color: var(--border-strong, var(--border)); color: var(--fg);
}
body.editorial-calm .bulk-actions-bar .btn-danger {
  background: var(--color-danger); border-color: var(--color-danger); color: #fff;
}

/* Block-button modifier (replaces inline width:100%) */
body.editorial-calm .btn.btn--block,
body.editorial-calm .btn--block { width: 100%; justify-content: center; }

/* Modal width modifier (replaces inline max-width on .modal-content) */
body.editorial-calm .modal-content--sm { max-width: 500px; }

/* Empty-state icon — circular muted container holding a line icon */
body.editorial-calm .ec-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
}

/* ─────────────────────────────────────────────
   Validator-driven fixes
   ───────────────────────────────────────────── */

/* F10: kill the legacy .page-header flex:row layout on the hero —
   .ec-hero is a vertical stack (eyebrow → h1 → lede → CTAs). */
body.editorial-calm .ec-hero {
  display: block;
  align-items: initial;
  justify-content: initial;
}

/* F4: flat file-list rows. Drop the boxy 6px-radius chip-in-card nesting,
   replace with rule-separated list rows that hover-tint. */
body.editorial-calm .file-list .file-item {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  margin: 0;
  padding: 14px 4px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background var(--duration-fast) var(--easing-standard);
}
body.editorial-calm .file-list .file-item:last-child { border-bottom: 0; }
body.editorial-calm .file-list .file-item:hover { background: var(--bg-secondary); }
body.editorial-calm .file-list .file-item .file-icon {
  width: 32px;
  height: 32px;
  background: transparent;
  border: 0;
  font-size: 18px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}
body.editorial-calm .file-list .file-item .file-info { flex: 1; min-width: 0; }
body.editorial-calm .file-list .file-item .file-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
body.editorial-calm .file-list .file-item .file-meta .badge { margin: 0; }
body.editorial-calm .file-list .file-item .file-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* F7: upload-zone + cloud-import-zone — single 1px dashed border-strong,
   matching .empty-state weight. */
body.editorial-calm .upload-zone,
body.editorial-calm .cloud-import-zone {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  padding: 28px 24px;
  transition: border-color var(--duration-fast) var(--easing-standard),
              background var(--duration-fast) var(--easing-standard);
}
body.editorial-calm .upload-zone:hover,
body.editorial-calm .upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}
body.editorial-calm .upload-zone h4,
body.editorial-calm .cloud-import-zone h4 {
  font: 600 14.5px/1.3 var(--font-sans);
  letter-spacing: -0.005em;
  color: var(--fg);
  margin: 8px 0 4px;
}
body.editorial-calm .upload-zone p,
body.editorial-calm .cloud-import-zone p,
body.editorial-calm .cloud-import-zone .cloud-hint {
  font: 400 13px/1.55 var(--font-sans);
  color: var(--fg-muted);
  margin: 0;
}
body.editorial-calm .upload-icon { margin-bottom: 4px; }
body.editorial-calm .upload-divider span {
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 0 10px;
  background: var(--bg);
}

/* F8: provider-icon-btn — use Editorial Calm surface + radius */
body.editorial-calm .provider-icon-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  transition: border-color var(--duration-fast) var(--easing-standard),
              background var(--duration-fast) var(--easing-standard),
              transform var(--duration-fast) var(--easing-standard);
}
body.editorial-calm .provider-icon-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}
body.editorial-calm .provider-icon-btn .provider-label {
  font: 500 11.5px/1.4 var(--font-sans);
  color: var(--fg);
}
body.editorial-calm .provider-icon-btn.coming-soon { opacity: 0.6; cursor: not-allowed; }
body.editorial-calm .provider-icon-btn.coming-soon:hover { transform: none; background: var(--bg-elevated); border-color: var(--border); }
body.editorial-calm .provider-badge {
  font: 500 10px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  background: var(--bg-secondary);
  color: var(--fg-muted);
  border-radius: var(--radius-pill);
}
/* Spinner — use accent */
body.editorial-calm .spinner,
body.editorial-calm .spinner-sm {
  border-top-color: var(--accent);
}

/* Destructive action hover — any ghost button with a delete intent
   gains a soft red tint on hover so intent is visible without screaming
   at rest. Targets data-action="delete-*" so it generalises across
   delete-file, delete-page, delete-chat, etc. */
body.editorial-calm .btn[data-action^="delete"],
body.editorial-calm .btn.btn-danger-ghost,
body.editorial-calm .btn-icon[data-action="delete-file"] {
  transition: background var(--duration-fast) var(--easing-standard),
              border-color var(--duration-fast) var(--easing-standard),
              color var(--duration-fast) var(--easing-standard);
}
body.editorial-calm .btn[data-action^="delete"]:hover,
body.editorial-calm .btn.btn-danger-ghost:hover,
body.editorial-calm .btn-icon[data-action="delete-file"]:hover {
  background: #FEE2E2;
  border-color: transparent;
  color: var(--color-danger);
}
body.editorial-calm .btn[data-action^="delete"]:focus-visible,
body.editorial-calm .btn-icon[data-action="delete-file"]:focus-visible {
  outline: 2px solid var(--color-danger);
  outline-offset: 2px;
}

/* Files page — icon buttons in table rows.
   Lucide-style line SVGs at 16px, ghost square, hover bg-secondary. */
body.editorial-calm .table-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
body.editorial-calm .table-actions .btn-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--fg-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}
body.editorial-calm .table-actions .btn-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}
body.editorial-calm .table-actions .btn-icon:hover {
  background: var(--bg-secondary);
  color: var(--fg);
  border-color: var(--border);
}

/* Question flash: brief accent ring when scrolled into view (was an inline
   box-shadow toggle in files.js). Self-fades via keyframes. */
@keyframes ecQuestionFlash {
  0%   { box-shadow: 0 0 0 2px var(--accent); }
  100% { box-shadow: 0 0 0 2px transparent; }
}
body.editorial-calm .ec-question-flash { animation: ecQuestionFlash 1.5s ease-out; }
@keyframes ecQuestionFlashSuccess {
  0%   { box-shadow: 0 0 0 2px var(--color-success); }
  100% { box-shadow: 0 0 0 2px transparent; }
}
body.editorial-calm .ec-question-flash--success { animation: ecQuestionFlashSuccess 2s ease-out; }

/* Questions icon state colors — match data severity, calm at rest */
body.editorial-calm .btn-icon--questions.is-pending { color: var(--color-warning); }
body.editorial-calm .btn-icon--questions.is-pending:hover {
  background: var(--color-warning-soft);
  border-color: transparent;
  color: var(--color-warning-fg);
}
body.editorial-calm .btn-icon--questions.is-resolved { color: var(--color-success); }
body.editorial-calm .btn-icon--questions.is-neutral { color: var(--fg-muted); }
body.editorial-calm .btn-icon-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--color-warning-fg);
  color: #fff;
  font: 600 9px/1 var(--font-mono);
  padding: 1px 4px;
  border-radius: 999px;
  min-width: 14px;
  text-align: center;
}

/* ─────────────────────────────────────────────
   Auth pages — login / signup / forgot-password / accept-invitation
   Common chrome shared by all 5 auth surfaces. Scoped to .editorial-calm
   so legacy styles still work if the class is removed.
   ───────────────────────────────────────────── */
body.editorial-calm .login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg) !important;
  padding: 32px 20px;
}
body.editorial-calm .login-box {
  background: var(--bg-elevated, #fff) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-lg, 14px) !important;
  box-shadow: var(--shadow-1, 0 1px 2px rgba(27, 28, 32, 0.04)) !important;
  padding: 36px 36px 32px !important;
  width: 100%;
  max-width: 420px;
}
body.editorial-calm .login-box.login-box--wide { max-width: 480px; }

/* Brand mark + product name above the title */
body.editorial-calm .ec-auth-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  color: var(--accent);
}
body.editorial-calm .ec-auth-mark svg { width: 28px; height: 28px; }

body.editorial-calm .login-header {
  text-align: center !important;
  margin-bottom: 24px !important;
  border-bottom: none !important;
  padding-bottom: 0 !important;
}
body.editorial-calm .login-header .ub-eyebrow {
  display: inline-block;
  margin-bottom: 8px;
}
body.editorial-calm .login-header h1 {
  font: 400 26px/1.15 var(--font-serif) !important;
  letter-spacing: -0.015em !important;
  color: var(--fg) !important;
  margin: 0 0 8px !important;
}
body.editorial-calm .login-header h1 em {
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}
body.editorial-calm .login-header p {
  font: 400 14px/1.5 var(--font-sans) !important;
  color: var(--fg-muted) !important;
  margin: 0 !important;
}

/* Form fields inside auth box */
body.editorial-calm .login-box .form-group { margin-bottom: 14px; }
body.editorial-calm .login-box .form-group label {
  font: 500 11px/1 var(--font-mono) !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  color: var(--fg-muted) !important;
  margin-bottom: 6px !important;
  display: block;
}
body.editorial-calm .login-box .form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-md, 10px) !important;
  background: var(--bg-elevated, #fff) !important;
  font: 400 14px/1.4 var(--font-sans) !important;
  color: var(--fg) !important;
  transition: border-color 160ms var(--ease-standard, ease), box-shadow 160ms var(--ease-standard, ease);
}
body.editorial-calm .login-box .form-control:focus-visible {
  outline: 2px solid var(--color-teal-400, #2DD4BF);
  outline-offset: 2px;
  border-color: var(--accent) !important;
}

/* Primary CTA — full-width inside the auth box (override the global
   inline-flex narrowing for hero CTAs) */
body.editorial-calm .login-box .btn.btn-primary,
body.editorial-calm .login-box button[type="submit"].btn-primary {
  width: 100% !important;
  display: inline-flex !important;
  justify-content: center !important;
  padding: 11px 16px !important;
  font-weight: 500;
}

/* "or" divider between password + Google OAuth */
body.editorial-calm .oauth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--fg-muted);
  font: 500 11px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
body.editorial-calm .oauth-divider::before,
body.editorial-calm .oauth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}
body.editorial-calm .oauth-divider span {
  background: transparent !important;
  padding: 0 !important;
  color: var(--fg-muted) !important;
}

/* Google OAuth pill */
body.editorial-calm .btn-google {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  /* Match the primary CTA height/width treatment exactly (see .login-box .btn-primary):
     pill radius + 11px 16px padding. Google button stays a secondary/outline pill. */
  padding: 11px 16px !important;
  background: var(--bg-elevated, #fff) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-pill) !important;
  color: var(--fg) !important;
  /* line-height 1.6 matches .login-box .btn-primary so the Google pill is the
     same height as the Sign In pill (was /1 → ~4px shorter). */
  font: 500 14px/1.6 var(--font-sans) !important;
  text-decoration: none !important;
  cursor: pointer;
  transition: background 160ms var(--ease-standard, ease), border-color 160ms var(--ease-standard, ease);
}
body.editorial-calm .btn-google:hover {
  background: var(--bg-secondary, #F1EFE9) !important;
  border-color: var(--fg-muted) !important;
}

/* Footer link block */
body.editorial-calm .login-footer {
  margin-top: 22px;
  text-align: center;
  font: 400 13px/1.5 var(--font-sans);
  color: var(--fg-muted);
}
body.editorial-calm .login-footer a,
body.editorial-calm .login-box a {
  color: var(--accent) !important;
  text-decoration: none;
}
body.editorial-calm .login-footer a:hover,
body.editorial-calm .login-box a:hover {
  text-decoration: underline;
}

/* ─────────────────────────────────────────────
   Documents page — category tab strip + table layout
   Mirrors A.Documents spec from design directions.
   ───────────────────────────────────────────── */

/* Tab strip — All / <category> / … with inline counts */
body.editorial-calm .ec-doc-tabs {
  display: flex;
  align-items: stretch;
  gap: 18px;
  border-bottom: 1px solid var(--border-color);
  margin: 4px 0 18px;
  overflow-x: auto;
}
body.editorial-calm .ec-doc-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 0;
  margin-bottom: -1px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font: 400 13px/1 var(--font-sans);
  color: var(--fg-muted);
  white-space: nowrap;
  transition: color 160ms var(--ease-standard, ease), border-color 160ms var(--ease-standard, ease);
}
body.editorial-calm .ec-doc-tab:hover { color: var(--fg); }
body.editorial-calm .ec-doc-tab.is-active {
  color: var(--fg);
  font-weight: 500;
  border-bottom-color: var(--fg);
}
body.editorial-calm .ec-doc-tab__count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
}
body.editorial-calm .ec-doc-tab.is-active .ec-doc-tab__count { color: var(--fg); }
body.editorial-calm .ec-doc-tab__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}
body.editorial-calm .ec-doc-tab__icon svg { width: 14px; height: 14px; }

/* Recycle bin — header stats and table */
body.editorial-calm .ec-recycle-stats {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 500 11px/1 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0 0 16px;
}
body.editorial-calm .ec-recycle-stats__value {
  color: var(--fg);
  font-weight: 500;
}
body.editorial-calm .ec-recycle-stats__dot { color: var(--border-color); }

/* Recycle bin table — match Documents list-view treatment */
body.editorial-calm .recycle-bin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-elevated, #fff);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg, 14px);
  overflow: hidden;
}
body.editorial-calm .recycle-bin-table thead th {
  font: 500 11px/1 var(--font-mono) !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase;
  color: var(--fg-muted) !important;
  text-align: left;
  padding: 10px 22px !important;
  border-bottom: 1px solid var(--border-color);
  background: transparent !important;
}
body.editorial-calm .recycle-bin-table tbody td {
  padding: 14px 22px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--fg);
  vertical-align: middle;
}
body.editorial-calm .recycle-bin-table tbody tr:last-child td { border-bottom: none; }
body.editorial-calm .recycle-bin-table tbody tr:hover { background: var(--bg-secondary, #F1EFE9); }
body.editorial-calm .recycle-bin-table .deleted-info,
body.editorial-calm .recycle-bin-table .deleted-by {
  font: 500 11px/1.4 var(--font-mono);
  color: var(--fg-muted);
  letter-spacing: 0.04em;
}

/* List header — mono uppercase column labels */
body.editorial-calm .ec-doc-list-header {
  font: 500 11px/1 var(--font-mono) !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase;
  color: var(--fg-muted) !important;
  background: transparent !important;
  border-bottom: 1px solid var(--border-color) !important;
  padding: 10px 22px !important;
}
body.editorial-calm .ec-doc-list-header .sortable {
  cursor: pointer;
  user-select: none;
}
body.editorial-calm .ec-doc-list-header .sortable:hover { color: var(--fg) !important; }

/* List view container — wrap items in a card */
body.editorial-calm .documents-grid.list-view {
  background: var(--bg-elevated, #fff);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg, 14px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0 !important;
  padding: 0 !important;
}
body.editorial-calm .documents-grid.list-view .document-card {
  border-bottom: 1px solid var(--border-color);
  border-radius: 0;
  padding: 14px 22px;
  background: transparent;
  box-shadow: none;
  transition: background 160ms var(--ease-standard, ease);
}
body.editorial-calm .documents-grid.list-view .document-card:last-child { border-bottom: none; }
body.editorial-calm .documents-grid.list-view .document-card:hover { background: var(--bg-secondary, #F1EFE9); }
body.editorial-calm .documents-grid.list-view .document-title {
  font: 500 14px/1.3 var(--font-sans) !important;
  letter-spacing: -0.005em !important;
  color: var(--fg) !important;
  margin: 0 !important;
}
body.editorial-calm .documents-grid.list-view .document-preview {
  font: 400 12.5px/1.5 var(--font-sans) !important;
  color: var(--fg-muted) !important;
  padding: 0 12px !important; /* match header .col-preview so the description doesn't touch the category badge */
}
body.editorial-calm .documents-grid.list-view .document-meta,
body.editorial-calm .documents-grid.list-view .document-author,
body.editorial-calm .documents-grid.list-view .document-version,
body.editorial-calm .documents-grid.list-view .document-size,
body.editorial-calm .documents-grid.list-view .document-date {
  font: 500 11px/1 var(--font-mono) !important;
  letter-spacing: 0.04em !important;
  color: var(--fg-muted) !important;
}
body.editorial-calm .documents-grid.list-view .category-badge {
  /* Flow in column order (after the title) to match the Title→Category header.
     The grid-view rule sets order:-1 to make it a card eyebrow; in the list that
     wrongly pulls it ahead of the title, so reset it here. */
  order: 0;
  align-self: center;
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font: 500 10.5px/1.4 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--bg-secondary, #F1EFE9);
  color: var(--fg-muted);
  border: 1px solid var(--border);
  /* Truncate long category names instead of wrapping into a tall "blob". */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
body.editorial-calm .documents-grid.list-view .category-badge.category-empty {
  background: transparent;
  border-color: transparent;
  color: var(--fg-muted);
  padding-left: 0;
}

/* Status pill: pulse for generating state (keeps the existing animation) */
body.editorial-calm .ec-status-pill--pending.is-generating {
  animation: ec-pulse 2s infinite;
}
@keyframes ec-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ═══════════════════════════════════════════════
   Document surface v1.0 — Read/Edit chrome
   Top action bar · title block · byline · right TOC
   ═══════════════════════════════════════════════ */

/* Hide legacy chrome in editorial-calm doc view — title now lives in .ec-doc-title-block.
   #legacy-page-header needs !important: .page-header{display:flex} overrides the [hidden] attr. */
body.editorial-calm #legacy-page-header,
body.editorial-calm .document-info-card,
body.editorial-calm .purpose-container { display: none !important; }

/* ── Top action bar ── */
body.editorial-calm .ec-doc-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
body.editorial-calm .ec-doc-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font: 500 12.5px/1 var(--font-sans);
}
body.editorial-calm .ec-doc-breadcrumb__link {
  color: var(--fg-muted);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
body.editorial-calm a.ec-doc-breadcrumb__link:hover { color: var(--accent); }
body.editorial-calm .ec-doc-breadcrumb__sep {
  display: inline-flex;
  color: var(--fg-faint, var(--fg-muted));
  opacity: 0.6;
}
body.editorial-calm .ec-doc-breadcrumb__current {
  color: var(--fg);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

body.editorial-calm .ec-doc-topbar__actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
body.editorial-calm .ec-doc-topbar__divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 2px;
}
body.editorial-calm .ec-doc-saved {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 500 11px/1 var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-muted);
  white-space: nowrap;
}
body.editorial-calm .ec-doc-saved__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
body.editorial-calm .ec-doc-saved.is-saving .ec-doc-saved__dot {
  background: var(--color-warning, #F59E0B);
  animation: ec-doc-pulse 1.2s ease-in-out infinite;
}
@keyframes ec-doc-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
/* Uniform pill height/padding for all three top-bar buttons (Back/Export/Edit).
   Overrides the tighter #back-btn padding so the row aligns. */
body.editorial-calm .ec-doc-topbar .btn-sm,
body.editorial-calm .ec-doc-topbar #back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px !important;
  font: 600 12.5px/1 var(--font-sans);
  line-height: 1;
  white-space: nowrap;
  border-radius: var(--radius-pill);
}
body.editorial-calm .ec-doc-topbar .btn-sm svg { flex-shrink: 0; }

/* ── Overflow menu ── */
body.editorial-calm .ec-doc-overflow { position: relative; }
body.editorial-calm .ec-doc-overflow__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 188px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-2, 0 8px 24px rgba(0,0,0,0.12));
  padding: 6px;
  z-index: 120;
}
body.editorial-calm .ec-doc-overflow__menu[hidden] { display: none; }
body.editorial-calm .ec-doc-overflow__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm, 6px);
  font: 500 13px/1 var(--font-sans);
  color: var(--fg-body);
  text-align: left;
  cursor: pointer;
}
body.editorial-calm .ec-doc-overflow__item[hidden] { display: none !important; }
body.editorial-calm .ec-doc-overflow__item:hover {
  background: var(--bg-secondary);
  color: var(--fg);
}
body.editorial-calm .ec-doc-overflow__item svg { color: var(--fg-muted); }
body.editorial-calm .ec-doc-overflow__item:hover svg { color: var(--fg); }
body.editorial-calm .ec-doc-overflow__item--danger { color: var(--color-danger); }
body.editorial-calm .ec-doc-overflow__item--danger svg { color: var(--color-danger); }
body.editorial-calm .ec-doc-overflow__item--danger:hover {
  background: #FEE2E2;
  color: var(--color-danger);
}
body.editorial-calm .ec-doc-overflow__item--danger:hover svg { color: var(--color-danger); }
body.editorial-calm .ec-doc-overflow__divider {
  height: 1px;
  background: var(--border);
  margin: 6px 4px;
}

/* ── Title block ── */
body.editorial-calm .ec-doc-title-block {
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
body.editorial-calm .ec-doc-eyebrow { margin-bottom: 12px; }
body.editorial-calm .ec-doc-title {
  font: 400 44px/1.1 var(--font-serif);
  letter-spacing: -0.02em;
  color: var(--fg);
  margin: 0 0 16px;
}
body.editorial-calm .ec-doc-byline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font: 500 13px/1.3 var(--font-sans);
  color: var(--fg-muted);
}
body.editorial-calm .ec-doc-byline__author {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
body.editorial-calm .ec-doc-byline__avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 600 11px/1 var(--font-sans);
  text-transform: uppercase;
  flex-shrink: 0;
}
body.editorial-calm .ec-doc-byline__name { color: var(--fg); font-weight: 600; }
body.editorial-calm .ec-doc-byline__dot { color: var(--fg-faint, var(--fg-muted)); opacity: 0.5; }
body.editorial-calm .ec-doc-byline__version {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.02em;
}
body.editorial-calm .ec-doc-byline__sources {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  font-weight: 600;
}
body.editorial-calm .ec-doc-byline__sources[hidden] { display: none; }
body.editorial-calm .ec-doc-byline__sources svg { color: var(--accent); }

/* ── View layout: prose left (1080max), TOC sticky right ── */
body.editorial-calm .ec-doc-view-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 40px;
  align-items: start;
}
body.editorial-calm .ec-doc-view-layout.is-toc-collapsed {
  grid-template-columns: minmax(0, 1fr) 56px;
}
body.editorial-calm .ec-doc-content-wrapper {
  min-width: 0;
  max-width: 1080px;
}
body.editorial-calm .ec-doc-content-wrapper .document-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: none;
  padding: 48px 56px;
}

/* ── TOC right rail ── */
body.editorial-calm .ec-doc-toc {
  position: sticky;
  top: 20px;
  width: auto;
  align-self: start;
  background: transparent;
  border-left: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  padding: 4px 0 4px 24px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}
body.editorial-calm .ec-doc-toc__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 0;
  border-bottom: 0;
}
body.editorial-calm .ec-doc-toc__toggle {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
body.editorial-calm .ec-doc-view-layout.is-toc-collapsed .ec-doc-toc__toggle {
  transform: rotate(180deg);
}
body.editorial-calm .ec-doc-toc__nav { display: flex; flex-direction: column; gap: 2px; }

/* Collapsed: 56px rail with sideways label */
body.editorial-calm .ec-doc-view-layout.is-toc-collapsed .ec-doc-toc {
  padding: 4px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
body.editorial-calm .ec-doc-view-layout.is-toc-collapsed .ec-doc-toc__nav { display: none; }
body.editorial-calm .ec-doc-view-layout.is-toc-collapsed .ec-doc-toc__header {
  flex-direction: column-reverse;
  gap: 14px;
  margin-bottom: 0;
}
body.editorial-calm .ec-doc-view-layout.is-toc-collapsed .ec-doc-toc__header .ub-eyebrow {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
}

@media (max-width: 960px) {
  body.editorial-calm .ec-doc-view-layout,
  body.editorial-calm .ec-doc-view-layout.is-toc-collapsed {
    grid-template-columns: 1fr;
  }
  body.editorial-calm .ec-doc-toc { display: none; }
  body.editorial-calm .ec-doc-content-wrapper .document-content { padding: 28px 22px; }
  body.editorial-calm .ec-doc-title { font-size: 32px; }
}

/* Document editor — export-option rows in the export modal */
body.editorial-calm .ec-export-option {
  display: flex !important;
  align-items: center;
  gap: 12px;
  padding: 14px 16px !important;
  border-radius: var(--radius-md, 10px) !important;
  font-size: 14px !important;
  text-align: left;
  width: 100%;
  justify-content: flex-start !important;
  border: 1px solid var(--border-color) !important;
  background: var(--bg-elevated, #fff) !important;
}
body.editorial-calm .ec-export-option:hover {
  background: var(--bg-secondary, #F1EFE9) !important;
  border-color: var(--fg-muted) !important;
}
body.editorial-calm .ec-export-option__icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary, #F1EFE9);
  border-radius: var(--radius-sm, 6px);
  color: var(--accent);
  flex: 0 0 auto;
}
body.editorial-calm .ec-export-option__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
body.editorial-calm .ec-export-option__title {
  font-weight: 500;
  color: var(--fg);
}
body.editorial-calm .ec-export-option__hint {
  font-size: 12px;
  color: var(--fg-muted);
}

/* Search-in-doc control buttons */
body.editorial-calm .btn-search {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm, 6px);
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
}
body.editorial-calm .btn-search:hover {
  background: var(--bg-secondary, #F1EFE9);
  color: var(--fg);
  border-color: var(--border-color);
}

/* TOC sidebar header — eyebrow + collapse button */
body.editorial-calm .toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

/* Inline icon + label inside a .btn (e.g. "+ Invite Member") */
body.editorial-calm .btn > span[data-ec-icon] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: -2px;
  margin-right: 2px;
}
body.editorial-calm .btn > span[data-ec-icon] svg {
  width: 14px;
  height: 14px;
}

/* Row click affordance for Files table */
body.editorial-calm .ec-file-row { cursor: pointer; }
body.editorial-calm .ec-file-row:hover { background: var(--bg-secondary); }
body.editorial-calm .ec-row-actions-cell { white-space: nowrap; }
/* TYPE column: a touch wider + tighter cell/badge padding so short cloud labels
   (Slides/Drawing/Notion) fit on one line and never bleed into the SIZE column. */
body.editorial-calm .files-table th:nth-child(3),
body.editorial-calm .files-table td:nth-child(3) { width: 88px; }
body.editorial-calm .files-table td:nth-child(3) { padding-left: 10px; padding-right: 4px; }
body.editorial-calm .files-table td:nth-child(3) .badge { white-space: nowrap; padding: 4px 8px; }
/* File-name cell on ONE line: the eye + type icon + source badge never shrink,
   and the name truncates. (Previously flex-wrap:wrap stacked it onto 3 lines,
   giving 122px-tall rows that broke the list's column alignment.) */
body.editorial-calm .ec-file-namecell { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: nowrap; }
body.editorial-calm .ec-file-namecell > .expand-preview-btn,
body.editorial-calm .ec-file-namecell > .ub-source,
body.editorial-calm .ec-file-namecell > .file-icon--emoji,
body.editorial-calm .ec-file-namecell > .tab-badge,
body.editorial-calm .ec-file-namecell > img,
body.editorial-calm .ec-file-namecell > svg { flex-shrink: 0; }
body.editorial-calm .ec-file-namecell > .file-name-cell { flex: 0 1 auto; min-width: 0; }
/* File name as a real control (button local / link cloud): reset UA styling so
   it reads as the former plain-text span; underline on hover/focus for affordance. */
body.editorial-calm .file-name-open {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
body.editorial-calm .file-name-open:hover,
body.editorial-calm .file-name-open:focus-visible { text-decoration: underline; }
/* File-list checkboxes: consistent 16px in the brand colour (were the browser's
   chunky native default). */
body.editorial-calm .files-table input.file-checkbox,
body.editorial-calm .files-table input#select-all-checkbox {
  width: 16px; height: 16px; margin: 0; cursor: pointer; accent-color: var(--accent);
}

/* ── Topics / Tags: re-tone the off-brand Material blue + purple (legacy
   styles.css uses #2196f3 / #7c3aed / grey gradients) to the teal palette.
   Scoped to Editorial Calm so the legacy rules are unaffected elsewhere. ── */
body.editorial-calm .tag-badge {
  background: var(--accent-soft);
  border: 1px solid transparent;
  color: var(--accent);
  box-shadow: none;
  font-weight: 600;
}
body.editorial-calm .tag-badge:hover {
  background: var(--accent-soft); border-color: var(--accent); box-shadow: none; transform: none;
}
/* Hidden overflow tags: .tag-hidden stays as the query marker; .is-revealed
   (toggled by the "See All" button) controls visibility instead of inline style. */
body.editorial-calm .tag-badge.tag-hidden { display: none; }
body.editorial-calm .tag-badge.tag-hidden.is-revealed { display: inline-flex; }
body.editorial-calm .tag-remove-btn { color: var(--accent); }
body.editorial-calm .tag-remove-btn:hover { background-color: var(--bg-secondary); color: var(--color-danger); }
/* Confidence tiers → teal intensity (were blue-opacity swatches) */
body.editorial-calm .tag-badge.tag-confidence-high {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
body.editorial-calm .tag-badge.tag-confidence-high:hover { background: var(--accent); border-color: var(--accent); box-shadow: none; }
body.editorial-calm .tag-badge.tag-confidence-medium {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent);
}
body.editorial-calm .tag-badge.tag-confidence-medium:hover { background: var(--accent-soft); border-color: var(--accent); box-shadow: none; }
body.editorial-calm .tag-badge.tag-confidence-low,
body.editorial-calm .tag-badge.tag-confidence-very-low {
  background: var(--accent-soft); border-color: transparent; color: var(--accent);
}
body.editorial-calm .tag-badge.tag-confidence-low:hover,
body.editorial-calm .tag-badge.tag-confidence-very-low:hover { background: var(--accent-soft); border-color: var(--accent); box-shadow: none; }
/* User-added tags → semantic success green (distinct from AI teal) */
body.editorial-calm .tag-badge.tag-user-added {
  background: var(--color-success-soft); border-color: transparent; color: var(--color-success-fg);
}
body.editorial-calm .tag-badge.tag-user-added:hover { background: var(--color-success-soft); border-color: var(--color-success); box-shadow: none; }
body.editorial-calm .tag-confidence-badge { background: rgba(255, 255, 255, 0.35); }
/* Tag action buttons → ghost pill / teal-primary (were Material blue + purple) */
body.editorial-calm .btn-see-all-tags,
body.editorial-calm .btn-tag-action {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-sans); font-weight: 600; font-size: 13px;
  padding: 6px 12px; cursor: pointer;
  background: transparent; border: 1px solid var(--border); color: var(--fg-body);
  border-radius: 999px; box-shadow: none; transform: none;
}
body.editorial-calm .btn-see-all-tags:hover,
body.editorial-calm .btn-tag-action:hover {
  background: var(--bg-secondary); border-color: var(--border-strong, var(--border)); color: var(--fg); box-shadow: none; transform: none;
}
body.editorial-calm .btn-tag-action.primary,
body.editorial-calm .btn-tag-action.btn-generate-tags {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
body.editorial-calm .btn-tag-action.primary:hover,
body.editorial-calm .btn-tag-action.btn-generate-tags:hover {
  background: var(--accent-strong, var(--accent)); border-color: var(--accent-strong, var(--accent));
}
body.editorial-calm .btn-tag-action.btn-regenerate-tags {
  background: var(--accent-soft); border-color: transparent; color: var(--accent);
}
body.editorial-calm .btn-tag-action.btn-regenerate-tags:hover { background: var(--accent-soft); border-color: var(--accent); }

/* ─────────────────────────────────────────────
   Layout root: app uses a sidebar + main grid pattern
   already; ensure full height and no double bg.
   ───────────────────────────────────────────── */
body.editorial-calm .app-container,
body.editorial-calm .layout,
body.editorial-calm .app {
  background: var(--bg);
}

/* ─────────────────────────────────────────────
   Workspace Settings — Editorial Calm
   ───────────────────────────────────────────── */

/* 4-up stat grid (mirrors .ec-grid-3) */
body.editorial-calm .ec-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 1080px) {
  body.editorial-calm .ec-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* Section head actions cluster (right-aligned buttons next to eyebrow+h2) */
body.editorial-calm .ec-section-head__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

/* Members toolbar — flat row, not boxed */
body.editorial-calm .ec-members-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 12px;
  flex-wrap: wrap;
}
body.editorial-calm .ec-members-toolbar .filter-select {
  min-width: 140px;
}

/* Search field with leading icon */
body.editorial-calm .ec-search-field {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 360px;
}
body.editorial-calm .ec-search-field input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 10px);
  background: var(--surface, #fff);
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--fg);
  transition: border-color 160ms var(--ease-standard, ease), box-shadow 160ms var(--ease-standard, ease);
}
body.editorial-calm .ec-search-field input::placeholder { color: var(--fg-muted); }
body.editorial-calm .ec-search-field input:focus-visible {
  outline: 2px solid var(--color-teal-400, #2DD4BF);
  outline-offset: 2px;
  border-color: var(--accent);
}
body.editorial-calm .ec-search-field__icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--fg-muted);
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Members body — no card wrap, just clean table. Scroll the wide member table
   within its pane on narrow viewports instead of forcing the whole settings
   column wider (which made the Workspace pane overflow vs the Space pane). */
body.editorial-calm .ec-members-body { margin-top: 4px; overflow-x: auto; }
body.editorial-calm .ec-members-body .users-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
body.editorial-calm .ec-members-body .users-table thead,
body.editorial-calm .ec-members-body .users-table thead tr {
  background: transparent !important;
}
body.editorial-calm .ec-members-body .users-table thead th {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted) !important;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  background: transparent !important;
}
body.editorial-calm .ec-members-body .users-table tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--fg);
  vertical-align: middle;
}
body.editorial-calm .ec-members-body .users-table tbody tr:last-child td { border-bottom: none; }
body.editorial-calm .ec-members-body .users-table tbody tr:hover { background: var(--bg-secondary, rgba(0,0,0,0.02)); }
body.editorial-calm .ec-members-body .user-cell { display: flex; align-items: center; gap: 10px; }
body.editorial-calm .ec-members-body .user-name-cell { font-weight: 500; color: var(--fg); }
body.editorial-calm .ec-members-body .user-email-cell { font-size: 12px; color: var(--fg-muted); }
body.editorial-calm .ec-members-body .clickable-profile { cursor: pointer; }
body.editorial-calm .ec-members-body .clickable-profile:hover .user-name-cell { color: var(--accent); }

/* Numeric cells (Files, Tokens) — ink, mono numerals, not accent */
body.editorial-calm .ec-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--fg);
}
body.editorial-calm .ec-num--muted { color: var(--fg-muted); }

/* Meta cells (dates, "You", expiry text) */
body.editorial-calm .ec-cell-meta {
  font-size: 12px;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
body.editorial-calm .ec-cell-meta.is-expired { color: #B91C1C; }

/* Role pills — muted variants, not bright */
body.editorial-calm .ec-role-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--bg-secondary, #F1EFE9);
  color: var(--fg-muted);
  border: 1px solid var(--border-color);
}
body.editorial-calm .ec-role-pill--master { background: var(--accent-soft, #CCFBF1); color: #0F766E; border-color: rgba(15,118,110,0.18); }
body.editorial-calm .ec-role-pill--admin { background: #FEF3C7; color: #92400E; border-color: rgba(146,64,14,0.18); }
body.editorial-calm .ec-role-pill--editor { background: #DBEAFE; color: #1E40AF; border-color: rgba(30,64,175,0.18); }
body.editorial-calm .ec-role-pill--member { background: var(--bg-secondary, #F1EFE9); color: var(--fg); border-color: var(--border-color); }
body.editorial-calm .ec-role-pill--viewer { background: var(--bg-secondary, #F1EFE9); color: var(--fg-muted); border-color: var(--border-color); }

/* Status pills — active / inactive / pending (re-use & extend) */
body.editorial-calm .ec-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
body.editorial-calm .ec-status-pill--active { background: #D1FAE5; color: #065F46; }
body.editorial-calm .ec-status-pill--inactive { background: var(--bg-secondary, #F1EFE9); color: var(--fg-muted); }
body.editorial-calm .ec-status-pill--pending { background: #FEF3C7; color: #92400E; }

/* ── docs-v1 list/grid badges: Draft / AI-drafted / Generating ── */
body.editorial-calm .ec-doc-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1.5px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}
body.editorial-calm .ec-doc-badge--draft { background: #FEF3C7; color: #92400E; }
body.editorial-calm .ec-doc-badge--generating { background: var(--bg-secondary); color: var(--fg-muted); }
body.editorial-calm .ec-doc-badge__pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--fg-muted);
  animation: ec-doc-pulse 1.2s ease-in-out infinite;
}

/* ── Live presence chip (real online-collaborator count) ── */
body.editorial-calm .ec-doc-presence {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-success, #10B981);
  flex-shrink: 0;
}
body.editorial-calm .ec-doc-presence__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--color-success, #10B981);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-success, #10B981) 22%, transparent);
}
/* Generating-doc card affordances (replaces former inline styles) */
body.editorial-calm .resume-btn { margin-top: 8px; }
body.editorial-calm .ec-doc-interrupted { color: var(--fg-muted); font-style: italic; }

/* Author cell now wraps optional presence + name */
body.editorial-calm .document-author {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
body.editorial-calm .document-author__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* ══════════════════════════════════════════════
   Documents empty state — docs-v1 start paths
   ══════════════════════════════════════════════ */
body.editorial-calm .ec-docs-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 56px 24px;
}
body.editorial-calm .ec-docs-empty__hero {
  max-width: 640px;
  text-align: center;
  margin-bottom: 36px;
}
body.editorial-calm .ec-docs-empty__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--accent);
  margin-bottom: 20px;
}
body.editorial-calm .ec-docs-empty__hero .ub-eyebrow { margin-bottom: 10px; }
body.editorial-calm .ec-docs-empty__hero h2 {
  font: 400 44px/1.08 var(--font-serif);
  letter-spacing: -0.025em;
  color: var(--fg);
  margin: 0 0 12px;
}
body.editorial-calm .ec-docs-empty__hero p {
  font: 400 16px/1.6 var(--font-sans);
  color: var(--fg-body);
  margin: 0;
  max-width: 540px;
  margin-inline: auto;
}
body.editorial-calm .ec-docs-empty__paths {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
  max-width: 720px;
}
body.editorial-calm .ec-start-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  padding: 22px 22px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  font-family: var(--font-sans);
}
body.editorial-calm .ec-start-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-1);
  transform: translateY(-1px);
}
body.editorial-calm .ec-start-card--feature {
  background: var(--accent-soft);
  border-color: transparent;
}
body.editorial-calm .ec-start-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--fg-body);
}
body.editorial-calm .ec-start-card--feature .ec-start-card__icon {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: transparent;
  color: var(--accent);
}
body.editorial-calm .ec-start-card__title {
  font: 400 22px/1.2 var(--font-serif);
  letter-spacing: -0.015em;
  color: var(--fg);
}
body.editorial-calm .ec-start-card--feature .ec-start-card__title { color: var(--accent); }
body.editorial-calm .ec-start-card__desc {
  font: 400 13px/1.55 var(--font-sans);
  color: var(--fg-body);
}
body.editorial-calm .ec-start-card--feature .ec-start-card__desc { color: var(--accent); opacity: 0.85; }
body.editorial-calm .ec-start-card__cta {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 600 13px/1 var(--font-sans);
  color: var(--fg);
}
body.editorial-calm .ec-start-card--feature .ec-start-card__cta { color: var(--accent); }
body.editorial-calm .ec-start-card__cta svg { width: 13px; height: 13px; }

body.editorial-calm .ec-docs-empty__connect {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 36px;
  padding: 16px 22px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 720px;
  width: 100%;
}
body.editorial-calm .ec-docs-empty__connect > [data-ec-icon],
body.editorial-calm .ec-docs-empty__connect svg { color: var(--fg-muted); flex-shrink: 0; }
body.editorial-calm .ec-docs-empty__connect-text {
  flex: 1;
  font: 400 13px/1.5 var(--font-sans);
  color: var(--fg-body);
}
body.editorial-calm .ec-docs-empty__connect-text strong { color: var(--fg); font-weight: 600; }
body.editorial-calm .ec-docs-empty__brands {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}
body.editorial-calm .ec-docs-empty__brands img {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}
@media (max-width: 720px) {
  body.editorial-calm .ec-docs-empty__paths { grid-template-columns: 1fr; }
  body.editorial-calm .ec-docs-empty__connect { flex-wrap: wrap; }
}

/* ══════════════════════════════════════════════
   Floating dark bulk-select bar — docs-v1
   ══════════════════════════════════════════════ */
body.editorial-calm .ec-bulk-bar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 12px 10px 16px;
  background: var(--fg);
  color: var(--bg);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22), 0 4px 12px rgba(15, 23, 42, 0.1);
  font-family: var(--font-sans);
}
body.editorial-calm .ec-bulk-bar__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: 700 11px/1 var(--font-sans);
}
body.editorial-calm .ec-bulk-bar__label {
  font: 600 13px/1 var(--font-sans);
  margin: 0 10px 0 4px;
  color: var(--bg);
}
body.editorial-calm .ec-bulk-bar__action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 0;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--bg);
  font: 600 12.5px/1 var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s;
}
body.editorial-calm .ec-bulk-bar__action:hover { background: rgba(255, 255, 255, 0.14); }
body.editorial-calm .ec-bulk-bar__action svg { width: 13px; height: 13px; }
body.editorial-calm .ec-bulk-bar__action--danger {
  color: #FCA5A5;
  background: rgba(239, 68, 68, 0.12);
}
body.editorial-calm .ec-bulk-bar__action--danger:hover { background: rgba(239, 68, 68, 0.22); }
body.editorial-calm .ec-bulk-bar__divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.16);
  margin: 0 6px;
}
body.editorial-calm .ec-bulk-bar__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
body.editorial-calm .ec-bulk-bar__close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--bg);
}
/* Export format menu — pops above the dark bar */
body.editorial-calm .ec-bulk-export-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 200px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-2, 0 8px 24px rgba(0,0,0,0.12));
  padding: 6px;
}
body.editorial-calm .ec-bulk-export-menu .export-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm, 6px);
  background: transparent;
  color: var(--fg-body);
  font: 500 13px/1 var(--font-sans);
  text-align: left;
  cursor: pointer;
}
body.editorial-calm .ec-bulk-export-menu .export-option:hover { background: var(--bg-secondary); color: var(--fg); }
body.editorial-calm .ec-bulk-export-menu .export-option svg { color: var(--fg-muted); }

/* Row action icon buttons — flat, hover-tinted */
body.editorial-calm .ec-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
body.editorial-calm .ec-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: var(--radius-sm, 6px);
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-muted);
  cursor: pointer;
  transition: background 160ms var(--ease-standard, ease), color 160ms var(--ease-standard, ease), border-color 160ms var(--ease-standard, ease);
}
body.editorial-calm .ec-icon-btn:hover {
  background: var(--bg-secondary, #F1EFE9);
  color: var(--fg);
  border-color: var(--border-color);
}
body.editorial-calm .ec-icon-btn:focus-visible {
  outline: 2px solid var(--color-teal-400, #2DD4BF);
  outline-offset: 2px;
}
body.editorial-calm .ec-icon-btn[data-ec-icon] svg,
body.editorial-calm .ec-icon-btn span svg,
body.editorial-calm .ec-icon-btn span[data-ec-icon] { width: 16px; height: 16px; }
body.editorial-calm .ec-icon-btn--danger:hover { background: #FEE2E2; color: #B91C1C; border-color: rgba(185,28,28,0.18); }

/* Form helpers — used in invite/edit modals */

/* Mono uppercase eyebrow above a field/group (e.g. "Invitation method") */
body.editorial-calm label.ec-field-eyebrow,
body.editorial-calm .form-group > label.ec-field-eyebrow,
body.editorial-calm .ec-field-eyebrow {
  display: block;
  font-family: var(--font-mono) !important;
  font-size: 10.5px !important;
  font-weight: 500 !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted) !important;
  margin-bottom: 8px;
}

/* Input + side-button row (e.g. password + Generate) */
body.editorial-calm .ec-input-with-action {
  display: flex;
  align-items: center;
  gap: 8px;
}
body.editorial-calm .ec-input-with-action > .form-control { flex: 1; min-width: 0; }
body.editorial-calm .ec-input-with-action > .btn { flex: 0 0 auto; }

/* Radio cards — used for invite method choice */
body.editorial-calm .ec-radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
body.editorial-calm .ec-radio-card {
  display: grid;
  grid-template-columns: 18px 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 10px);
  background: var(--surface, #fff);
  cursor: pointer;
  transition: border-color 160ms var(--ease-standard, ease), background 160ms var(--ease-standard, ease);
}
body.editorial-calm .ec-radio-card:hover { border-color: var(--accent); }
body.editorial-calm .ec-radio-card input[type="radio"] {
  grid-column: 1;
  grid-row: 1 / span 2;
  margin: 2px 0 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}
body.editorial-calm .ec-radio-card__title {
  grid-column: 2;
  grid-row: 1;
  font-weight: 500;
  font-size: 14px;
  color: var(--fg);
}
body.editorial-calm .ec-radio-card__hint {
  grid-column: 2;
  grid-row: 2;
  font-size: 12.5px;
  color: var(--fg-muted);
  line-height: 1.4;
}
body.editorial-calm .ec-radio-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft, #ECFDF5);
}

/* Checkbox card — used for reset-password toggle */
body.editorial-calm .ec-checkbox-card {
  display: grid;
  grid-template-columns: 18px 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 10px);
  background: var(--surface, #fff);
  cursor: pointer;
}
body.editorial-calm .ec-checkbox-card input[type="checkbox"] {
  grid-column: 1;
  grid-row: 1 / span 2;
  margin: 2px 0 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}
body.editorial-calm .ec-checkbox-card__title { grid-column: 2; grid-row: 1; font-weight: 500; font-size: 14px; color: var(--fg); }
body.editorial-calm .ec-checkbox-card__hint { grid-column: 2; grid-row: 2; font-size: 12.5px; color: var(--fg-muted); line-height: 1.4; }
body.editorial-calm .ec-checkbox-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft, #ECFDF5); }

/* Success card — credentials display after creating user */
body.editorial-calm .ec-success-card {
  margin-top: 16px;
  padding: 16px 18px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-md, 10px);
  background: var(--accent-soft, #ECFDF5);
}
body.editorial-calm .ec-success-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
body.editorial-calm .ec-success-card__title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--fg);
  margin: 0 0 12px;
}
body.editorial-calm .ec-success-card__list {
  display: grid;
  gap: 8px;
  margin: 0;
}
body.editorial-calm .ec-success-card__list > div {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  align-items: center;
}
body.editorial-calm .ec-success-card__list dt {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0;
}
body.editorial-calm .ec-success-card__list dd {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--fg);
}
body.editorial-calm .ec-password-chip {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 4px 8px;
  background: var(--surface, #fff);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm, 6px);
  color: var(--fg);
}

/* ============================================================
   WhatsApp connect wizard (deploy.html → WhatsApp tab → modal)
   ------------------------------------------------------------
   Phase A — three-step wizard inside the existing connect modal.
   Steps: 1) path picker  2) coexistence limits  3) credentials.
   Edit mode skips the wizard and uses the standard form.
   ============================================================ */
body.editorial-calm .wa-step { display: none; }
body.editorial-calm .wa-step.active { display: block; }

body.editorial-calm .wa-step-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-ink-500, #6b7280);
  margin-bottom: 6px;
}

body.editorial-calm .wa-step-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--color-ink-900, #111827);
  margin: 0 0 4px 0;
}

body.editorial-calm .wa-step-lede {
  font-size: 13px;
  line-height: 1.55;
  color: var(--color-ink-600, #4b5563);
  margin: 0 0 16px 0;
}

body.editorial-calm .wa-back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--color-ink-500, #6b7280);
  text-decoration: none;
  cursor: pointer;
  margin-bottom: 12px;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
}
body.editorial-calm .wa-back-link:hover {
  color: var(--color-ink-700, #374151);
}

body.editorial-calm .wa-path-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 720px) {
  body.editorial-calm .wa-path-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

body.editorial-calm .wa-path-card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 16px;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: var(--radius-md, 8px);
  background: var(--color-paper, #ffffff);
  cursor: pointer;
  transition: border-color var(--duration-fast, 150ms) var(--easing-standard, ease),
              background-color var(--duration-fast, 150ms) var(--easing-standard, ease);
}
body.editorial-calm .wa-path-card:hover {
  background: var(--color-paper-2, #f9fafb);
  border-color: var(--color-ink-300, #d1d5db);
}
body.editorial-calm .wa-path-card.selected {
  border-color: var(--color-teal-400);
  background: var(--color-teal-50, #f0fdfa);
}
body.editorial-calm .wa-path-card .wa-path-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--color-ink-900, #111827);
}
/* Badge now straddles the top edge (outside the box), so the title needs
   no extra top reservation. */
body.editorial-calm .wa-path-card:has(.wa-recommend-badge) .wa-path-title {
  margin-top: 0;
}
body.editorial-calm .wa-path-card .wa-path-sub {
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-ink-600, #4b5563);
  margin-bottom: 12px;
}
body.editorial-calm .wa-path-card .wa-path-tradeoff {
  font-size: 12px;
  line-height: 1.5;
  color: var(--color-ink-500, #6b7280);
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed var(--color-border, #e5e7eb);
}
/* Sits on the card's top edge (half outside the box) as a "recommended" tab. */
body.editorial-calm .wa-recommend-badge {
  position: absolute;
  top: -11px;
  left: 14px;
  right: auto;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--color-teal-700, #0f766e);
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--color-teal-700, #0f766e);
  box-shadow: 0 1px 3px rgba(15, 118, 110, .25);
}

body.editorial-calm .wa-limits-list {
  list-style: none;
  padding: 0;
  margin: 0 0 14px 0;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
  background: var(--color-paper, #ffffff);
}
body.editorial-calm .wa-limits-list li {
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-ink-700, #374151);
  border-bottom: 1px solid var(--color-border, #e5e7eb);
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
body.editorial-calm .wa-limits-list li:last-child { border-bottom: none; }
body.editorial-calm .wa-limits-list li::before {
  content: "—";
  color: var(--color-ink-400, #9ca3af);
  flex-shrink: 0;
}
body.editorial-calm .wa-limits-list li strong {
  color: var(--color-ink-900, #111827);
  font-weight: 600;
}

body.editorial-calm .wa-limits-ack {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  background: var(--color-paper-2, #f9fafb);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: var(--radius-md, 8px);
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-ink-800, #1f2937);
  cursor: pointer;
}
body.editorial-calm .wa-limits-ack input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
}

/* ── Embedded Signup block (step 3 "Connect with Facebook") ── */
body.editorial-calm .wa-es-block {
  margin: 0 0 18px 0;
}
body.editorial-calm .wa-es-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #1877F2;        /* Meta blue — intentional brand cue, not the app accent */
  border-color: #1877F2;
}
body.editorial-calm .wa-es-btn:hover:not(:disabled) {
  background: #166fe0;
  border-color: #166fe0;
}
body.editorial-calm .wa-es-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  background: #fff;
  color: #1877F2;
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
}
body.editorial-calm .wa-es-hint {
  font-size: 12px;
  line-height: 1.5;
  color: var(--color-ink-500, #6b7280);
  margin: 8px 2px 0;
  text-align: center;
}
body.editorial-calm .wa-es-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 4px;
  color: var(--color-ink-400, #9ca3af);
  font-size: 12px;
}
body.editorial-calm .wa-es-divider::before,
body.editorial-calm .wa-es-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border, #e5e7eb);
}

/* WhatsApp wizard: stack paired field rows on narrow viewports so the two-up
   inputs aren't cramped on mobile. Mobile-first, matching the 720px breakpoint
   used by .wa-path-grid above. Scoped to .wa-step so the shared .form-row
   helper is unchanged elsewhere. */
body.editorial-calm .wa-step .form-row { flex-direction: column; }
@media (min-width: 720px) {
  body.editorial-calm .wa-step .form-row { flex-direction: row; }
}


/* ═══════════════════════════════════════════════
   Generate-document flow — G1 (Topic + template)
   ═══════════════════════════════════════════════ */
body.editorial-calm .ec-gen-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-wrap: wrap;
}
body.editorial-calm .ec-gen-topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: 600 10.5px/1 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
body.editorial-calm .ec-gen-topbar__brand svg { color: var(--accent); }
body.editorial-calm .ec-gen-topbar__actions { margin-left: auto; display: inline-flex; align-items: center; gap: 10px; }

/* Step strip */
body.editorial-calm .ec-gen-steps { display: inline-flex; align-items: center; gap: 8px; }
body.editorial-calm .ec-gen-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 600 10px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-faint, var(--fg-muted));
}
body.editorial-calm .ec-gen-step__num {
  width: 16px; height: 16px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font: 700 9px/1 var(--font-mono);
  border: 1.5px solid var(--fg-faint, var(--fg-muted));
  color: var(--fg-muted);
}
body.editorial-calm .ec-gen-step.is-active { color: var(--accent); }
body.editorial-calm .ec-gen-step.is-active .ec-gen-step__num { background: var(--accent); border-color: var(--accent); color: #fff; }
body.editorial-calm .ec-gen-step.is-done { color: var(--fg-body); }
body.editorial-calm .ec-gen-step.is-done .ec-gen-step__num { background: var(--fg); border-color: var(--fg); color: #fff; }
body.editorial-calm .ec-gen-step__bar { width: 16px; height: 1px; background: var(--border); }

/* Body */
body.editorial-calm .ec-gen-body { flex: 1; overflow-y: auto; padding: 48px 56px 64px; }
body.editorial-calm .ec-gen-inner { max-width: 880px; margin: 0 auto; }
body.editorial-calm .ec-gen-eyebrow { margin-bottom: 10px; }
body.editorial-calm .ec-gen-title {
  font: 400 44px/1.1 var(--font-serif);
  letter-spacing: -0.025em;
  color: var(--fg);
  margin: 0 0 14px;
}
body.editorial-calm .ec-gen-lede {
  font: 400 15px/1.6 var(--font-sans);
  color: var(--fg-body);
  margin: 0 0 24px;
  max-width: 640px;
}
body.editorial-calm .ec-gen-space {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
  padding: 7px 12px;
  background: var(--accent-soft);
  border-radius: var(--radius-pill);
  font: 500 12px/1 var(--font-sans);
  color: var(--accent);
}
body.editorial-calm .ec-gen-space__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
body.editorial-calm .ec-gen-space strong { font-weight: 700; }

/* Topic input card */
body.editorial-calm .ec-gen-topic {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: var(--shadow-1);
}
body.editorial-calm .ec-gen-topic__label { display: block; margin-bottom: 8px; }
body.editorial-calm .ec-gen-topic__input {
  width: 100%;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  font: 400 22px/1.4 var(--font-serif);
  letter-spacing: -0.015em;
  color: var(--fg);
  min-height: 60px;
}
body.editorial-calm .ec-gen-topic__input::placeholder { color: var(--fg-faint, var(--fg-muted)); opacity: 0.6; }
body.editorial-calm .ec-gen-topic__foot {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
body.editorial-calm .ec-gen-tones { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
body.editorial-calm .ec-gen-tone {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font: 600 11.5px/1 var(--font-sans);
  background: var(--bg-elevated);
  color: var(--fg-body);
  border: 1px solid var(--border);
  cursor: pointer;
}
body.editorial-calm .ec-gen-tone.is-active { background: var(--fg); color: var(--bg); border-color: transparent; }
body.editorial-calm .ec-gen-charcount { font: 500 10.5px/1 var(--font-mono); letter-spacing: 0.04em; color: var(--fg-muted); white-space: nowrap; }

/* Templates */
body.editorial-calm .ec-gen-section { margin-top: 36px; }
body.editorial-calm .ec-gen-section__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
body.editorial-calm .ec-gen-section__count { font: 400 12px/1 var(--font-sans); color: var(--fg-muted); }
body.editorial-calm .ec-gen-templates { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
body.editorial-calm .ec-gen-tpl {
  text-align: left;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
body.editorial-calm .ec-gen-tpl:hover { border-color: var(--accent); box-shadow: var(--shadow-1); transform: translateY(-1px); }
body.editorial-calm .ec-gen-tpl.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
body.editorial-calm .ec-gen-tpl__icon {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--fg-body);
  display: inline-flex; align-items: center; justify-content: center;
}
body.editorial-calm .ec-gen-tpl.is-muted .ec-gen-tpl__icon { color: var(--fg-muted); }
body.editorial-calm .ec-gen-tpl__name { display: block; font: 600 13px/1.2 var(--font-sans); color: var(--fg); letter-spacing: -0.005em; }
body.editorial-calm .ec-gen-tpl__desc { display: block; font: 400 11.5px/1.4 var(--font-sans); color: var(--fg-muted); margin-top: 2px; }

/* Suggested prompts */
body.editorial-calm .ec-gen-prompts { display: flex; flex-wrap: wrap; gap: 8px; }
body.editorial-calm .ec-gen-prompt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  border: 0;
  font: 600 12.5px/1.3 var(--font-sans);
  letter-spacing: -0.005em;
  cursor: pointer;
  text-align: left;
}
body.editorial-calm .ec-gen-prompt svg { color: var(--accent); flex-shrink: 0; }
body.editorial-calm .ec-gen-prompt:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }

@media (max-width: 860px) {
  body.editorial-calm .ec-gen-templates { grid-template-columns: repeat(2, 1fr); }
  body.editorial-calm .ec-gen-body { padding: 32px 22px 48px; }
  body.editorial-calm .ec-gen-title { font-size: 32px; }
}

/* ── Generate flow — G3 (Outline preview / edit) ── */
body.editorial-calm .ec-gen-split {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  overflow: hidden;
}
body.editorial-calm .ec-gen-split__main { overflow-y: auto; padding: 40px 56px 100px; }
body.editorial-calm .ec-gen-split__rail {
  border-left: 1px solid var(--border);
  padding: 40px 28px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: var(--bg);
}
body.editorial-calm .ec-gen-title--sm { font-size: 32px; margin-bottom: 12px; }

body.editorial-calm .ec-gen-outline { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
body.editorial-calm .ec-gen-osec {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
}
body.editorial-calm .ec-gen-osec__handle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-top: 6px;
  color: var(--fg-faint, var(--fg-muted));
}
body.editorial-calm .ec-gen-osec__num {
  font: 600 11px/1 var(--font-mono);
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  width: 18px;
}
body.editorial-calm .ec-gen-osec__body { min-width: 0; }
body.editorial-calm .ec-gen-osec__title {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font: 600 15px/1.3 var(--font-sans);
  letter-spacing: -0.01em;
  color: var(--fg);
  padding: 0;
}
body.editorial-calm .ec-gen-osec__desc {
  width: 100%;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  font: 400 13px/1.5 var(--font-sans);
  color: var(--fg-body);
  margin-top: 4px;
  padding: 0;
  overflow: hidden;
}
body.editorial-calm .ec-gen-osec__remove {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--radius-md);
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
}
body.editorial-calm .ec-gen-osec__remove:hover { background: #FEE2E2; color: var(--color-danger); }

body.editorial-calm .ec-gen-outline-add {
  margin-top: 10px;
  width: 100%;
  padding: 12px 16px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: transparent;
  color: var(--fg-muted);
  font: 600 13px/1 var(--font-sans);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
body.editorial-calm .ec-gen-outline-add:hover { border-color: var(--accent); color: var(--accent); }

/* Right rail rows */
body.editorial-calm .ec-gen-rail-rows { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
body.editorial-calm .ec-gen-rail-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font: 500 13px/1.3 var(--font-sans);
}
body.editorial-calm .ec-gen-rail-row > span:first-child { color: var(--fg-muted); font-size: 12px; }
body.editorial-calm .ec-gen-rail-row > span:last-child { color: var(--fg); font-weight: 600; text-align: right; }
body.editorial-calm .ec-gen-rail-out { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
body.editorial-calm .ec-gen-rail-outitem {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  font: 500 12px/1.3 var(--font-sans);
  color: var(--fg-body);
}
body.editorial-calm .ec-gen-rail-outitem svg { color: var(--fg-muted); flex-shrink: 0; }

@media (max-width: 860px) {
  body.editorial-calm .ec-gen-split { grid-template-columns: 1fr; }
  body.editorial-calm .ec-gen-split__rail { display: none; }
  body.editorial-calm .ec-gen-split__main { padding: 32px 22px 80px; }
}

/* Generate flow — full-screen "generating" overlay (G3; G4 will replace with streaming) */
body.editorial-calm .ec-gen-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: none;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(2px);
}
body.editorial-calm .ec-gen-overlay.is-visible { display: flex; }
body.editorial-calm .ec-gen-overlay__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 36px 44px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-2, 0 18px 48px rgba(15,23,42,.18));
  text-align: center;
  max-width: 420px;
}
body.editorial-calm .ec-gen-overlay__spinner {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2.5px solid var(--accent-soft);
  border-top-color: var(--accent);
  animation: ec-gen-spin 0.8s linear infinite;
}
@keyframes ec-gen-spin { to { transform: rotate(360deg); } }
body.editorial-calm .ec-gen-overlay__title { font: 400 22px/1.25 var(--font-serif); letter-spacing: -0.015em; color: var(--fg); }
body.editorial-calm .ec-gen-overlay__sub { font: 400 13px/1.5 var(--font-sans); color: var(--fg-muted); }

/* ── Generate flow — G4 (Full-screen streaming) ── */
body.editorial-calm .ec-gen-stream {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  overflow: hidden;
  position: relative;
}
body.editorial-calm .ec-gen-stream__main { overflow-y: auto; padding: 40px 56px 120px; }
body.editorial-calm .ec-gen-stream__rail {
  border-left: 1px solid var(--border);
  padding: 36px 24px;
  overflow-y: auto;
  background: var(--bg);
}
body.editorial-calm .ec-gen-stream__byline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 28px;
  font: 500 12.5px/1 var(--font-sans);
  color: var(--fg-muted);
}
body.editorial-calm .ec-gen-stream__avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
}
body.editorial-calm .ec-gen-stream__dot { color: var(--fg-faint, var(--fg-muted)); opacity: 0.5; }

/* Section rows in the main column */
body.editorial-calm .ec-gen-stream__sections { display: flex; flex-direction: column; gap: 4px; }
body.editorial-calm .ec-gen-srow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  font: 400 22px/1.25 var(--font-serif);
  letter-spacing: -0.018em;
  color: var(--fg-muted);
  transition: color 0.2s;
}
body.editorial-calm .ec-gen-srow__mark {
  width: 20px; height: 20px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
body.editorial-calm .ec-gen-srow.is-done { color: var(--fg); }
body.editorial-calm .ec-gen-srow.is-done .ec-gen-srow__mark svg { color: var(--color-success, #10B981); }
body.editorial-calm .ec-gen-srow.is-pending { color: var(--fg-faint, var(--fg-muted)); opacity: 0.55; font-size: 18px; }
body.editorial-calm .ec-gen-srow.is-pending .ec-gen-srow__mark::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%;
  border: 1.5px solid var(--fg-faint, var(--fg-muted));
}
body.editorial-calm .ec-gen-srow.is-active {
  display: block;
  margin: 10px 0;
  padding: 16px 18px;
  background: var(--accent-soft);
  border: 1px dashed var(--accent);
  border-radius: 12px;
  color: var(--fg);
}
body.editorial-calm .ec-gen-srow.is-active .ec-gen-srow__writing {
  display: inline-flex; align-items: center; gap: 8px;
  font: 700 11px/1 var(--font-mono);
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
body.editorial-calm .ec-gen-srow.is-active .ec-gen-srow__pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  animation: ec-gen-pulse 1.4s ease-in-out infinite;
}
body.editorial-calm .ec-gen-srow.is-active .ec-gen-srow__name {
  display: block;
  font: 400 26px/1.2 var(--font-serif);
  letter-spacing: -0.02em;
  color: var(--fg);
}
@keyframes ec-gen-pulse { 0%, 100% { opacity: 0.5; transform: scale(0.85); } 50% { opacity: 1; transform: scale(1.15); } }

/* Right rail progress */
body.editorial-calm .ec-gen-stream__progress { margin-top: 14px; display: flex; flex-direction: column; gap: 4px; }
body.editorial-calm .ec-gen-prow {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 8px;
  font: 500 12.5px/1.3 var(--font-sans);
  color: var(--fg-muted);
}
body.editorial-calm .ec-gen-prow.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
body.editorial-calm .ec-gen-prow.is-done { color: var(--fg-body); }
body.editorial-calm .ec-gen-prow__icon { width: 14px; height: 14px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
body.editorial-calm .ec-gen-prow.is-done .ec-gen-prow__icon svg { color: var(--color-success, #10B981); }
body.editorial-calm .ec-gen-prow__spin {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--accent); border-top-color: transparent;
  animation: ec-gen-spin 0.8s linear infinite;
}
body.editorial-calm .ec-gen-prow__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--bg-secondary); }
body.editorial-calm .ec-gen-prow__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Sticky dark control bar */
body.editorial-calm .ec-gen-stream__bar {
  position: absolute;
  left: 50%; bottom: 24px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px 9px 16px;
  background: var(--fg);
  color: var(--bg);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(15,23,42,.22), 0 4px 10px rgba(15,23,42,.08);
  z-index: 50;
}
body.editorial-calm .ec-gen-stream__bardot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  animation: ec-gen-pulse 1.4s ease-in-out infinite;
}
body.editorial-calm .ec-gen-stream__barlabel { font: 600 12.5px/1 var(--font-sans); }
body.editorial-calm .ec-gen-stream__bardiv { width: 1px; height: 18px; background: rgba(255,255,255,.16); margin: 0 4px; }
body.editorial-calm .ec-gen-stream__stop {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border: 0; border-radius: 8px;
  background: rgba(239,68,68,.18); color: #FCA5A5;
  font: 700 12.5px/1 var(--font-sans);
  cursor: pointer;
}
body.editorial-calm .ec-gen-stream__stop:hover { background: rgba(239,68,68,.28); }

@media (max-width: 860px) {
  body.editorial-calm .ec-gen-stream { grid-template-columns: 1fr; }
  body.editorial-calm .ec-gen-stream__rail { display: none; }
}

/* Generate flow — make the [hidden] attribute authoritative over the display rules
   on the step views (grid/flex) and the top-bar buttons (.btn inline-flex). */
body.editorial-calm .ec-gen-body[hidden],
body.editorial-calm .ec-gen-split[hidden],
body.editorial-calm .ec-gen-stream[hidden],
body.editorial-calm .ec-gen-topbar .btn[hidden] { display: none !important; }


/* ════════════════════════════════════════════
   Merged from _ec-add-chat.css
   ════════════════════════════════════════════ */

/* =====================================================
   Editorial Calm — chat page additions (staging)
   Extracted from the former inline <style> block in
   chat.html + class hooks used by js/lib/chat.js.
   Merge into editorial-calm.css once stable. Never
   duplicate rules that already live in editorial-calm.css
   (sessions cards, chat header, bubbles, composer, modals
   and .btn-action are canonical there).
   ===================================================== */

/* chat.html — sessions + messages chrome */

/* ---- Layout ---- */
body.editorial-calm .chat-layout {
  display: flex;
  height: calc(100vh - 180px);
  gap: 0;
}

/* ---- Sessions sidebar ---- */
body.editorial-calm .sessions-sidebar {
  width: 280px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: visible;
}

body.editorial-calm .sessions-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

body.editorial-calm .sessions-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

body.editorial-calm .sessions-header-default {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

body.editorial-calm .sessions-header-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Icon buttons in the sessions header — match editorial-calm .btn-icon */
body.editorial-calm .btn-search,
body.editorial-calm .btn-close-search {
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-muted);
  transition: background var(--duration-fast) var(--easing-standard),
              color var(--duration-fast) var(--easing-standard);
}

body.editorial-calm .btn-search svg {
  width: 16px;
  height: 16px;
}

body.editorial-calm .btn-search:hover,
body.editorial-calm .btn-close-search:hover {
  background: var(--bg-secondary);
  color: var(--fg);
}

/* ---- Session search ---- */
body.editorial-calm .search-expanded {
  display: none;
  width: 100%;
}

body.editorial-calm .sessions-header.searching .sessions-header-default {
  display: none;
}

body.editorial-calm .sessions-header.searching .search-expanded {
  display: flex;
  gap: 8px;
  align-items: center;
}

body.editorial-calm .search-input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

body.editorial-calm .search-input-wrapper .search-icon {
  position: absolute;
  left: 10px;
  color: var(--fg-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

/* Documents / integrations / recycle-bin search field (markup uses .search-box + .form-control) */
body.editorial-calm .search-box { position: relative; display: flex; align-items: center; }
body.editorial-calm .search-box .search-icon { position: absolute; left: 12px; color: var(--fg-muted); pointer-events: none; display: flex; align-items: center; }
body.editorial-calm .search-box .form-control { padding-left: 36px; }

body.editorial-calm .search-input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  background: var(--bg-elevated);
  transition: border-color var(--duration-fast) var(--easing-standard);
}

body.editorial-calm .search-input:focus {
  outline: none;
  border-color: var(--accent);
}

body.editorial-calm .no-sessions-match {
  padding: 20px;
  text-align: center;
  color: var(--fg-muted);
  font-size: 13px;
}

/* ---- Sessions list ---- */
body.editorial-calm .sessions-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: visible;
  padding: 8px;
  position: relative;
}

/* .session-item / :hover / .active / .session-meta are canonical
   in editorial-calm.css — only layout extras live here. */
body.editorial-calm .session-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

body.editorial-calm .session-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

body.editorial-calm .session-menu-btn {
  opacity: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--fg-muted);
  font-size: 18px;
  border-radius: var(--radius-sm);
  transition: background var(--duration-fast) var(--easing-standard),
              opacity var(--duration-fast) var(--easing-standard);
  display: flex;
  align-items: center;
  justify-content: center;
}

body.editorial-calm .session-item:hover .session-menu-btn,
body.editorial-calm .session-menu-btn.active {
  opacity: 1;
}

body.editorial-calm .session-menu-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

body.editorial-calm .session-dropdown {
  display: none;
  position: absolute;
  right: 16px;
  top: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-2);
  z-index: 1000;
  min-width: 160px;
  overflow: visible;
}

body.editorial-calm .session-dropdown.show {
  display: block;
}

body.editorial-calm .dropdown-item {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  color: var(--fg);
  transition: background var(--duration-fast) var(--easing-standard);
  display: flex;
  align-items: center;
  gap: 8px;
}

body.editorial-calm .dropdown-item:hover {
  background: var(--bg-secondary);
}

body.editorial-calm .dropdown-item.danger {
  color: var(--color-danger);
}

body.editorial-calm .dropdown-item.danger:hover {
  background: #FEE2E2;
}

/* ---- Chat container ---- */
/* .chat-header / .chat-title / .chat-actions / .btn-icon are canonical
   in editorial-calm.css. */
body.editorial-calm .chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  min-width: 0;
}

/* ---- Messages area ---- */
/* Background/padding/gap are canonical in editorial-calm.css. */
body.editorial-calm .messages-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

body.editorial-calm .message {
  display: flex;
  gap: 12px;
  max-width: 800px;
  animation: ec-chat-slide-in var(--duration-base) var(--easing-standard);
}

@keyframes ec-chat-slide-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

body.editorial-calm .message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

/* Avatar sizing/colors are canonical in editorial-calm.css. */
body.editorial-calm .message-avatar {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

body.editorial-calm .message-content {
  flex: 1;
  min-width: 0;
}

/* Bubble surfaces/fonts are canonical in editorial-calm.css. */
body.editorial-calm .message-bubble {
  word-wrap: break-word;
}

body.editorial-calm .message-bubble p {
  margin-bottom: 12px;
}

body.editorial-calm .message-bubble p:last-child {
  margin-bottom: 0;
}

/* ---- Markdown rendering inside bubbles ---- */
body.editorial-calm .message-bubble h1,
body.editorial-calm .message-bubble h2,
body.editorial-calm .message-bubble h3,
body.editorial-calm .message-bubble h4 {
  margin: 16px 0 8px 0;
  font-weight: 600;
  line-height: 1.3;
}

body.editorial-calm .message-bubble h1:first-child,
body.editorial-calm .message-bubble h2:first-child,
body.editorial-calm .message-bubble h3:first-child {
  margin-top: 0;
}

body.editorial-calm .message-bubble h1 { font-size: 1.4em; }
body.editorial-calm .message-bubble h2 { font-size: 1.25em; }
body.editorial-calm .message-bubble h3 { font-size: 1.1em; }
body.editorial-calm .message-bubble h4 { font-size: 1em; }

body.editorial-calm .message-bubble ul,
body.editorial-calm .message-bubble ol {
  margin: 12px 0;
  padding-left: 24px;
}

body.editorial-calm .message-bubble li {
  margin: 6px 0;
  line-height: 1.5;
}

body.editorial-calm .message-bubble li > ul,
body.editorial-calm .message-bubble li > ol {
  margin: 4px 0;
}

body.editorial-calm .message-bubble blockquote {
  margin: 12px 0;
  padding: 10px 16px;
  border-left: 4px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

body.editorial-calm .message-bubble blockquote p {
  margin: 0;
}

/* Inline code */
body.editorial-calm .message-bubble code:not(pre code) {
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--color-info);
}

/* Code blocks */
body.editorial-calm .message-bubble pre {
  margin: 12px 0;
  padding: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

body.editorial-calm .message-bubble pre code {
  display: block;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  tab-size: 2;
}

/* Code block header with language label and copy button */
body.editorial-calm .code-block-wrapper {
  position: relative;
  margin: 12px 0;
}

body.editorial-calm .code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-size: 12px;
  color: var(--fg-muted);
}

body.editorial-calm .code-block-header + pre {
  margin-top: 0;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

body.editorial-calm .code-copy-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  color: var(--fg-muted);
  transition: background var(--duration-fast) var(--easing-standard),
              color var(--duration-fast) var(--easing-standard);
}

body.editorial-calm .code-copy-btn:hover {
  background: var(--bg-elevated);
  color: var(--accent);
  border-color: var(--accent);
}

/* Tables */
body.editorial-calm .message-bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 14px;
}

body.editorial-calm .message-bubble th,
body.editorial-calm .message-bubble td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
}

body.editorial-calm .message-bubble th {
  background: var(--bg-secondary);
  font-weight: 600;
}

body.editorial-calm .message-bubble tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}

/* Horizontal rule */
body.editorial-calm .message-bubble hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* Dark mode support for code */
html[data-theme="dark"] body.editorial-calm .message-bubble pre {
  background: var(--bg-inverse);
  border-color: #333;
}

html[data-theme="dark"] body.editorial-calm .code-block-header {
  background: #2d2d2d;
  border-color: #333;
}

html[data-theme="dark"] body.editorial-calm .message-bubble code:not(pre code) {
  background: rgba(255, 255, 255, 0.1);
  color: #f472b6;
}

html[data-theme="dark"] body.editorial-calm .message-bubble th {
  background: #2d2d2d;
}

/* ---- Message actions (copy / regenerate) ----
   .btn-action itself is canonical in editorial-calm.css. */
body.editorial-calm .message-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--easing-standard);
}

body.editorial-calm .message.assistant:hover .message-actions {
  opacity: 1;
}

/* ---- Sources (chips + collapsible detail panel) ---- */
body.editorial-calm .message .ub-sources {
  margin-top: 8px;
}

body.editorial-calm .message-sources {
  margin-top: 8px;
}

body.editorial-calm .sources-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  transition: background var(--duration-fast) var(--easing-standard),
              border-color var(--duration-fast) var(--easing-standard);
}

body.editorial-calm .sources-toggle:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 25%, transparent);
}

body.editorial-calm .sources-toggle-icon {
  font-size: 10px;
  transition: transform var(--duration-fast) var(--easing-standard);
}

body.editorial-calm .sources-toggle.expanded .sources-toggle-icon {
  transform: rotate(90deg);
}

/* Detail panel — neutral surface (was a yellow callout) */
body.editorial-calm .sources-details {
  display: none;
  margin-top: 8px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-md);
  animation: ec-chat-expand-down var(--duration-fast) var(--easing-standard);
}

body.editorial-calm .sources-details.show {
  display: block;
}

@keyframes ec-chat-expand-down {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}

body.editorial-calm .sources-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

body.editorial-calm .source-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

body.editorial-calm .source-item {
  font-size: 13px;
  color: var(--fg-body);
  display: flex;
  align-items: center;
  gap: 6px;
}

body.editorial-calm .source-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

body.editorial-calm .source-badge.high {
  background: color-mix(in srgb, var(--color-success) 14%, transparent);
  color: color-mix(in srgb, var(--color-success) 65%, var(--fg));
}

body.editorial-calm .source-badge.medium {
  background: color-mix(in srgb, var(--color-warning) 14%, transparent);
  color: color-mix(in srgb, var(--color-warning) 65%, var(--fg));
}

body.editorial-calm .source-badge.low {
  background: color-mix(in srgb, var(--color-danger) 14%, transparent);
  color: color-mix(in srgb, var(--color-danger) 65%, var(--fg));
}

/* ---- Inline citation links + tooltip ---- */
body.editorial-calm .citation-link {
  display: inline-block;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85em;
  vertical-align: super;
  cursor: pointer;
  text-decoration: none;
  padding: 0 2px;
  border-radius: 2px;
  transition: background var(--duration-fast) var(--easing-standard);
}

body.editorial-calm .citation-link:hover {
  background: var(--accent-soft);
}

body.editorial-calm .citation-tooltip {
  position: absolute;
  background: var(--bg-inverse);
  color: var(--fg-inverse);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  max-width: 300px;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity var(--duration-fast) var(--easing-standard),
              transform var(--duration-fast) var(--easing-standard);
  box-shadow: var(--shadow-2);
}

body.editorial-calm .citation-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

body.editorial-calm .citation-tooltip::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 20px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 5px solid var(--bg-inverse);
}

/* ---- Numbered source rows ---- */
body.editorial-calm .source-item-numbered {
  font-size: 13px;
  color: var(--fg-body);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 0;
  transition: background var(--duration-fast) var(--easing-standard);
  border-radius: var(--radius-sm);
}

body.editorial-calm .source-item-numbered:hover {
  background: rgba(0, 0, 0, 0.05);
}

body.editorial-calm .source-item-numbered.highlighted {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  padding: 4px 8px;
  margin: 0 -8px;
}

body.editorial-calm .source-number {
  font-weight: 700;
  color: var(--accent);
  min-width: 20px;
}

body.editorial-calm .source-name {
  flex: 1;
}

/* ---- Overall confidence indicator ---- */
body.editorial-calm .overall-confidence {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  font-size: 13px;
}

body.editorial-calm .overall-confidence.high {
  background: color-mix(in srgb, var(--color-success) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-success) 30%, transparent);
}

body.editorial-calm .overall-confidence.medium {
  background: color-mix(in srgb, var(--color-warning) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-warning) 30%, transparent);
}

body.editorial-calm .overall-confidence.low {
  background: color-mix(in srgb, var(--color-danger) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-danger) 30%, transparent);
}

body.editorial-calm .confidence-label {
  font-weight: 600;
  color: var(--fg-muted);
}

body.editorial-calm .confidence-level {
  font-weight: 700;
  text-transform: capitalize;
}

body.editorial-calm .overall-confidence.high .confidence-level {
  color: color-mix(in srgb, var(--color-success) 65%, var(--fg));
}

body.editorial-calm .overall-confidence.medium .confidence-level {
  color: color-mix(in srgb, var(--color-warning) 65%, var(--fg));
}

body.editorial-calm .overall-confidence.low .confidence-level {
  color: color-mix(in srgb, var(--color-danger) 65%, var(--fg));
}

body.editorial-calm .confidence-reason {
  color: var(--fg-muted);
  font-size: 12px;
}

body.editorial-calm .message-meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--fg-muted);
  display: flex;
  gap: 12px;
}

/* ---- Character counter states (chat.js toggles these) ---- */
body.editorial-calm #characterCounter {
  color: var(--fg-muted);
}

body.editorial-calm #characterCounter.chat-counter--warn {
  color: var(--color-warning);
  font-weight: 600;
}

body.editorial-calm #characterCounter.chat-counter--over {
  color: var(--color-danger);
  font-weight: 600;
}

/* ---- Typing indicator ---- */
body.editorial-calm .typing-indicator {
  display: flex;
  gap: 4px;
  padding: 14px 18px;
}

body.editorial-calm .typing-dot {
  width: 8px;
  height: 8px;
  background: var(--fg-muted);
  border-radius: 50%;
  animation: ec-chat-typing 1.4s infinite;
}

body.editorial-calm .typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

body.editorial-calm .typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes ec-chat-typing {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-10px); }
}

/* ---- Loading placeholder ---- */
body.editorial-calm .chat-layout .loading {
  text-align: center;
  padding: 20px;
  color: var(--fg-muted);
  font-size: 14px;
}

/* ---- Modal visibility ----
   chat.js toggles `.show` on the delete/rename modals while every other
   modal on the page (confirm-modal.js, credit modals) toggles `.hidden`
   against styles.css defaults — scope the .show pattern to these two so
   both mechanisms work. */
body.editorial-calm #deleteModal,
body.editorial-calm #renameModal {
  display: none;
}

body.editorial-calm #deleteModal.show,
body.editorial-calm #renameModal.show {
  display: flex;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  body.editorial-calm .sessions-sidebar {
    display: none;
  }

  body.editorial-calm .message {
    max-width: 100%;
  }
}

/* ---- Attached files (session uploads) ---- */
body.editorial-calm .attached-files-container {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}

body.editorial-calm .attached-file {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  border: 1px solid var(--border);
}

body.editorial-calm .attached-file .file-icon {
  font-size: 1rem;
}

body.editorial-calm .attached-file .file-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg-body);
}

body.editorial-calm .attached-file .file-status {
  font-size: 0.75rem;
}

body.editorial-calm .attached-file .file-status.completed {
  color: var(--color-success);
}

body.editorial-calm .attached-file .file-status.processing {
  color: var(--color-warning);
}

body.editorial-calm .attached-file .remove-file-btn {
  background: none;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 2px;
  line-height: 1;
  opacity: 0.7;
  transition: opacity var(--duration-fast) var(--easing-standard);
}

body.editorial-calm .attached-file .remove-file-btn:hover {
  opacity: 1;
  color: var(--color-danger);
}

/* ---- Attachment status message ---- */
body.editorial-calm .attachment-status {
  display: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

body.editorial-calm .attachment-status.uploading {
  background: var(--accent-soft);
  color: var(--accent);
}

body.editorial-calm .attachment-status.success {
  background: color-mix(in srgb, var(--color-success) 12%, transparent);
  color: color-mix(in srgb, var(--color-success) 65%, var(--fg));
}

body.editorial-calm .attachment-status.error {
  background: color-mix(in srgb, var(--color-danger) 12%, transparent);
  color: color-mix(in srgb, var(--color-danger) 65%, var(--fg));
}


/* ════════════════════════════════════════════
   Merged from _ec-add-deploy.css
   ════════════════════════════════════════════ */

/* ════════════════════════════════════════════════════════════════
   _ec-add-deploy.css — Editorial Calm staging additions

   Page styles migrated out of inline <style> blocks / style=""
   attributes for deploy.html and integrations.html, plus classes
   used by HTML rendered from js/deploy.js and js/integrations.js.

   Every selector is scoped to body.editorial-calm.
   Tokens: css/tokens.css · Base components: css/editorial-calm.css
   (.empty-state, .badge-pill/.badge-active/.badge-inactive, .modal
   family already live there and are NOT redefined here).
   ════════════════════════════════════════════════════════════════ */

/* deploy.html */

/* ── Tabs ─────────────────────────────────────────────────────── */
body.editorial-calm .deploy-tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--border);
  margin-bottom: 24px; padding: 0;
}
body.editorial-calm .deploy-tab {
  padding: 10px 18px; background: transparent; border: 0; cursor: pointer;
  font: inherit; font-weight: 500; color: var(--fg-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  line-height: 1.2;
}
body.editorial-calm .deploy-tab-sub {
  font-size: 11px; font-weight: 400; color: var(--fg-muted);
}
body.editorial-calm .deploy-tab:hover { color: var(--fg); }
body.editorial-calm .deploy-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
body.editorial-calm .deploy-tab.active .deploy-tab-sub { color: var(--accent); opacity: 0.7; }
body.editorial-calm .deploy-tab-panel { display: none; }
body.editorial-calm .deploy-tab-panel.active { display: block; }

/* Shared "subhead + primary CTA" header inside each tab panel */
body.editorial-calm .deploy-panel-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 16px;
}

/* ── Resource table ───────────────────────────────────────────── */
body.editorial-calm .resource-table {
  width: 100%; border-collapse: collapse; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden;
}
body.editorial-calm .resource-table th,
body.editorial-calm .resource-table td {
  padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border);
  font-size: 14px; vertical-align: middle;
}
body.editorial-calm .resource-table th {
  background: var(--bg-secondary); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.03em; color: var(--fg-muted);
}
body.editorial-calm .resource-table tbody tr:last-child td { border-bottom: 0; }
body.editorial-calm .resource-table .row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ── Badges ───────────────────────────────────────────────────────
   .badge-pill / .badge-active / .badge-inactive come from
   editorial-calm.css (mono uppercase 10.5px, pill radius).
   deploy.js also emits .badge-warn — map it onto the documented
   badge-warning pair. */
body.editorial-calm .badge-pill.badge-warn {
  background: #FEF3C7;   /* documented badge-warning pair */
  color: #92400E;
  border-color: transparent;
}
body.editorial-calm .badge-pill[title]:not([title=""]) { cursor: help; }

/* ── Small primitives ─────────────────────────────────────────── */
body.editorial-calm .kbd-key {
  font-family: var(--font-mono); font-size: 12px; padding: 2px 6px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
body.editorial-calm .copy-btn {
  all: unset; cursor: pointer; padding: 4px 8px;
  border-radius: var(--radius-sm); font-size: 12px; color: var(--accent);
}
body.editorial-calm .copy-btn:hover { background: var(--color-teal-50); }

/* ── First-run wizard cards ───────────────────────────────────── */
body.editorial-calm .deploy-wizard-card-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin: 0 0 20px;
}
@media (max-width: 900px) {
  body.editorial-calm .deploy-wizard-card-grid { grid-template-columns: 1fr; }
}
body.editorial-calm .deploy-wizard-card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 18px 18px 16px;
  display: flex; flex-direction: column;
}
body.editorial-calm .deploy-wizard-card h4 {
  margin: 0 0 4px; font-size: 15px; font-weight: 600; color: var(--fg);
}
body.editorial-calm .deploy-wizard-card .muted { color: var(--fg-muted); font-size: 13px; margin: 0 0 12px; flex: 1; }
body.editorial-calm .deploy-wizard-card .fit { font-size: 12px; color: var(--fg-muted); margin: 0 0 14px; }
body.editorial-calm .deploy-wizard-card .fit b { color: var(--fg); font-weight: 600; }
body.editorial-calm .deploy-wizard-headline { margin: 0 0 12px; font-size: 14px; color: var(--fg-muted); }

/* ── Per-tab filter bar ───────────────────────────────────────── */
body.editorial-calm .deploy-filter-bar {
  display: flex; gap: 8px; align-items: center; margin: 0 0 12px;
}
body.editorial-calm .deploy-filter-bar input {
  flex: 1; max-width: 360px;
  padding: 8px 12px; font-size: 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
body.editorial-calm .deploy-filter-count { color: var(--fg-muted); font-size: 12px; }
body.editorial-calm .deploy-filter-empty {
  padding: 18px; text-align: center; color: var(--fg-muted); font-size: 14px;
  border: 1px dashed var(--border); border-radius: var(--radius-md);
  background: var(--bg-secondary);
}

/* ── Origin chips ─────────────────────────────────────────────── */
body.editorial-calm .origins-chip-list { display: flex; flex-wrap: wrap; gap: 4px; }
body.editorial-calm .origins-chip {
  background: var(--bg-secondary); padding: 2px 8px;
  border-radius: var(--radius-sm); font-size: 12px; font-family: var(--font-mono);
}
body.editorial-calm .origins-chip-remove {
  all: unset; cursor: pointer; color: var(--fg-muted); font-weight: 600; line-height: 1;
}

/* ── One-time secret callout (warning treatment) ──────────────── */
body.editorial-calm .one-time-secret {
  background: #FEF3C7;                       /* documented badge-warning pair bg */
  border: 1px solid var(--color-warning);
  border-radius: var(--radius-md);
  padding: 14px 16px; margin: 12px 0;
}
body.editorial-calm .one-time-secret-label {
  font-size: 12px; font-weight: 600; color: #92400E; margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
body.editorial-calm .one-time-secret-value {
  font-family: var(--font-mono); font-size: 13px; color: #92400E; word-break: break-all;
}
body.editorial-calm .one-time-secret-warning { margin-top: 8px; font-size: 12px; color: #92400E; }

/* ── Form helpers ─────────────────────────────────────────────── */
body.editorial-calm .form-row { display: flex; gap: 12px; }
body.editorial-calm .form-row > * { flex: 1; }
body.editorial-calm .color-pair { display: flex; gap: 8px; align-items: center; }
body.editorial-calm .color-pair input[type=color] {
  width: 40px; height: 36px; padding: 2px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
}

/* ── Embed snippet code block ─────────────────────────────────── */
body.editorial-calm .snippet-code {
  background: var(--bg-inverse); color: var(--fg-inverse);
  padding: 12px 14px; border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 12px; overflow-x: auto; white-space: nowrap;
}

body.editorial-calm .section-subhead { font-size: 13px; color: var(--fg-muted); margin: 0 0 12px; }

/* ── Header stats strip ───────────────────────────────────────── */
body.editorial-calm .deploy-summary-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin: 0 0 20px;
}
body.editorial-calm .deploy-summary-card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px 16px;
  display: block; text-decoration: none; color: inherit;
  transition: border-color 120ms ease, transform 120ms ease;
}
body.editorial-calm .deploy-summary-link:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  cursor: pointer;
}
body.editorial-calm .deploy-summary-label {
  font-size: 11px; font-weight: 600; color: var(--fg-muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
body.editorial-calm .deploy-summary-value {
  font-size: 24px; font-weight: 600; color: var(--fg); margin-top: 4px; line-height: 1.1;
}
/* Amber highlight when there's work waiting (warning pair) */
body.editorial-calm .deploy-summary-card[data-card="awaiting-reply"].has-work {
  background: #FEF3C7; border-color: var(--color-warning);
}
body.editorial-calm .deploy-summary-card[data-card="awaiting-reply"].has-work .deploy-summary-value {
  color: #92400E;
}
@media (max-width: 900px) {
  body.editorial-calm .deploy-summary-strip { grid-template-columns: repeat(2, 1fr); }
}

/* .btn-primary globally has width:100% in styles.css — size deploy tab
   toolbar CTAs to their content instead. Modal buttons keep the global
   behavior since they live outside the tab panels. */
body.editorial-calm .deploy-tab-panel .btn-primary { width: auto; }

/* ── Developer tools disclosure ───────────────────────────────── */
body.editorial-calm .deploy-developer-tools {
  margin-top: 32px; border-top: 1px solid var(--border); padding-top: 20px;
}
body.editorial-calm .deploy-developer-tools > summary {
  cursor: pointer; padding: 6px 0; list-style: none;
  color: var(--fg-muted);
}
body.editorial-calm .deploy-developer-tools > summary::-webkit-details-marker { display: none; }
body.editorial-calm .deploy-developer-tools > summary::before {
  content: '▸'; display: inline-block; margin-right: 8px;
  transition: transform 120ms ease;
}
body.editorial-calm .deploy-developer-tools[open] > summary::before { transform: rotate(90deg); }
body.editorial-calm .deploy-developer-tools-title { font-weight: 600; }
body.editorial-calm .deploy-developer-tools-hint { font-size: 12px; color: var(--fg-muted); margin-left: 8px; }
body.editorial-calm .deploy-developer-tools-panel {
  display: block; border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 16px 20px; margin-top: 12px; background: var(--bg-secondary);
}

/* js/deploy.js — classes for rendered HTML (replace raw-hex inline styles) */

body.editorial-calm .ec-text-muted { color: var(--fg-muted); }
body.editorial-calm .ec-text-danger { color: var(--color-danger); }
body.editorial-calm .ec-text-warning { color: #92400E; }  /* warning pair text */
body.editorial-calm .ec-mono { font-family: var(--font-mono); }
body.editorial-calm .ec-link-accent { color: var(--accent); font-weight: 600; }

/* Inline warning callout (e.g. widget origin suggestion) */
body.editorial-calm .ec-warn-box {
  background: #FEF3C7;                       /* documented badge-warning pair bg */
  border: 1px solid var(--color-warning);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: #92400E;
}

/* "Use this when…" info box inside empty states */
body.editorial-calm .deploy-usecase-box {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 12px 16px; margin: 12px 0;
  font-size: 13.5px; text-align: left;
}
body.editorial-calm .deploy-usecase-title { font-weight: 600; margin-bottom: 6px; }
body.editorial-calm .deploy-usecase-box ul {
  margin: 0; padding-left: 18px; color: var(--fg); line-height: 1.6;
}
/* Two-column bullet grid — halves the empty-state height so it fits without
   scrolling on most screens. */
body.editorial-calm .deploy-usecase-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 24px;
  padding-left: 0;
  list-style-position: inside;
}
@media (max-width: 620px) {
  body.editorial-calm .deploy-usecase-grid { grid-template-columns: 1fr; }
}
/* Compact WhatsApp empty state so it fits without scrolling on most screens —
   the dashed-card padding + serif title margins are trimmed right down. */
body.editorial-calm .deploy-wa-empty {
  padding: 16px 24px !important;
}
body.editorial-calm .deploy-wa-empty h3 { font-size: 18px !important; margin-bottom: 2px !important; }
body.editorial-calm .deploy-wa-empty .deploy-usecase-box { margin: 10px 0 !important; padding: 10px 14px !important; }
body.editorial-calm .deploy-wa-empty .deploy-usecase-title { margin-bottom: 4px !important; }

/* Per-account WhatsApp card + Meta setup guide */
body.editorial-calm .deploy-wa-account-card {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 12px 16px; margin-bottom: 16px; background: var(--bg-secondary);
}

/* WhatsApp card kebab (overflow) menu — Edit / Slack alerts / Disconnect */
body.editorial-calm .wa-kebab { padding: 4px 8px; line-height: 1; }
body.editorial-calm .wa-kebab svg { display: block; }
body.editorial-calm .wa-kebab-menu {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 40;
  min-width: 168px; padding: 4px;
  background: var(--bg-primary, #fff); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: 0 6px 24px rgba(0,0,0,0.12);
  display: flex; flex-direction: column;
}
body.editorial-calm .wa-kebab-menu.hidden { display: none; }
body.editorial-calm .wa-kebab-item {
  appearance: none; background: none; border: 0; cursor: pointer;
  text-align: left; padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--fg-primary, var(--text-primary));
}
body.editorial-calm .wa-kebab-item:hover { background: var(--accent-soft, var(--bg-secondary)); }
body.editorial-calm .wa-kebab-item--danger { color: var(--danger, #C0392B); }
body.editorial-calm .wa-kebab-item--danger:hover { background: rgba(192,57,43,0.08); }

/* ── WhatsApp message templates page ─────────────────────────────────────── */
body.editorial-calm .wt-toolbar { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:16px; flex-wrap:wrap; }
body.editorial-calm .wt-chips { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:14px; }
body.editorial-calm .wt-chip {
  appearance:none; cursor:pointer; font:600 12px/1 var(--font-sans);
  padding:6px 12px; border-radius:999px; border:1px solid var(--border);
  background:var(--bg-secondary); color:var(--fg-muted);
}
body.editorial-calm .wt-chip:hover { border-color:var(--accent); color:var(--fg-primary); }
body.editorial-calm .wt-chip.is-active { background:var(--accent); border-color:var(--accent); color:var(--fg-inverse,#fff); }

body.editorial-calm .wt-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:14px; }
body.editorial-calm .wt-card { border:1px solid var(--border); border-radius:var(--radius-md); padding:14px; background:var(--bg-secondary); display:flex; flex-direction:column; gap:10px; }
body.editorial-calm .wt-card__head { display:flex; justify-content:space-between; align-items:center; gap:10px; }
body.editorial-calm .wt-card__name { font-weight:600; font-size:14px; }
body.editorial-calm .wt-card__meta { font-size:12px; margin-left:6px; font-weight:400; }
body.editorial-calm .wt-card__actions { display:flex; gap:8px; flex-wrap:wrap; }
body.editorial-calm .wt-reject { font-size:12px; color:var(--danger,#C0392B); }

/* WhatsApp-style preview bubble (how the customer receives it) */
body.editorial-calm .wt-bubble {
  position:relative; background:#fff; border-radius:8px; padding:8px 10px 6px;
  box-shadow:0 1px 1px rgba(0,0,0,0.12); max-width:100%; font-size:13.5px; line-height:1.4;
}
body.editorial-calm .wt-bubble--sm { background:var(--bg-primary,#fff); }
body.editorial-calm .wt-bubble__body { white-space:pre-wrap; word-wrap:break-word; color:#111; }
body.editorial-calm .wt-bubble__footer { margin-top:6px; font-size:11.5px; color:#667781; }
body.editorial-calm .wt-bubble__time { text-align:right; font-size:10.5px; color:#8696a0; margin-top:2px; }

/* Two-column editor: form + sticky live preview */
body.editorial-calm .wt-editor { display:grid; grid-template-columns:1fr 340px; gap:24px; align-items:start; }
body.editorial-calm .wt-editor__preview { position:sticky; top:16px; }
body.editorial-calm .wt-preview-label { font:600 11px/1 var(--font-sans); letter-spacing:0.06em; text-transform:uppercase; color:var(--fg-muted); margin-bottom:8px; }
body.editorial-calm .wt-phone { background:#efeae2; border-radius:12px; padding:16px; border:1px solid var(--border); }
body.editorial-calm .wt-form-actions { display:flex; gap:8px; justify-content:flex-end; margin-top:8px; flex-wrap:wrap; }
body.editorial-calm .wt-linklike { appearance:none; background:none; border:0; padding:0; cursor:pointer; color:var(--accent); font-size:12.5px; font-weight:600; }
body.editorial-calm .wt-cat-help { }
@media (max-width: 900px) {
  body.editorial-calm .wt-editor { grid-template-columns:1fr; }
  body.editorial-calm .wt-editor__preview { position:static; }
}

/* ── templates page — polish (overrides + additions) ─────────────────────── */
/* .btn-primary is globally width:100% (styles.css); this page isn't inside
   .deploy-tab-panel, so constrain + align icon+label here. */
body.editorial-calm #wt-content .btn,
body.editorial-calm #wb-content .btn { display:inline-flex; align-items:center; gap:6px; width:auto; }
body.editorial-calm #wt-content .btn svg,
body.editorial-calm #wb-content .btn svg { display:block; }
body.editorial-calm .wt-linklike { display:inline-flex; align-items:center; gap:4px; }
body.editorial-calm .wt-linklike:hover { text-decoration:underline; color:var(--accent-hover,var(--accent)); }

/* page title + icon */
body.editorial-calm .wt-page-title { display:flex; align-items:center; gap:9px; }
body.editorial-calm .wt-title-icon { color:var(--accent); display:inline-flex; }

/* cards: full status-colored outline, hover lift, clickable to open/edit.
   Draft keeps the neutral base border (no grey accent). */
body.editorial-calm .wt-card {
  position:relative; gap:12px; cursor:pointer;
  transition:box-shadow .15s ease, border-color .15s ease;
}
body.editorial-calm .wt-card:hover { box-shadow:0 4px 16px rgba(0,0,0,0.10); }
body.editorial-calm .wt-card--approved { border-color:var(--color-success,#1B873F); }
body.editorial-calm .wt-card--pending  { border-color:#C77700; }
body.editorial-calm .wt-card--rejected { border-color:var(--color-danger,#C0392B); }

/* search box in the toolbar */
body.editorial-calm .wt-search { position:relative; flex:1; min-width:200px; max-width:420px; }
body.editorial-calm .wt-search__icon { position:absolute; left:12px; top:50%; transform:translateY(-50%); color:var(--fg-muted); display:inline-flex; pointer-events:none; }
body.editorial-calm .wt-search .form-control { padding-left:34px; }

/* locked-template banner (approved/pending) */
body.editorial-calm .wt-banner {
  display:flex; align-items:center; gap:8px; margin-bottom:16px;
  padding:10px 14px; border-radius:var(--radius-md); font-size:13px;
  background:var(--bg-secondary); border:1px solid var(--border); color:var(--fg-muted);
}
body.editorial-calm .wt-banner svg { flex-shrink:0; color:var(--fg-muted); }
body.editorial-calm .wt-card__id { display:flex; align-items:center; gap:9px; min-width:0; }
body.editorial-calm .wt-card__icon { color:var(--accent); flex-shrink:0; display:inline-flex; }
body.editorial-calm .wt-card__name { font-weight:600; font-size:14px; display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
body.editorial-calm .wt-card__meta { font-size:12px; font-weight:400; display:block; margin:0; }
body.editorial-calm .wt-card__foot { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:auto; }

/* subtle icon-only button (delete) */
body.editorial-calm .wt-icon-btn {
  appearance:none; cursor:pointer; background:none; border:1px solid transparent;
  border-radius:8px; padding:6px; display:inline-flex; align-items:center; color:var(--fg-muted);
}
body.editorial-calm .wt-icon-btn:hover { background:var(--bg-elevated,var(--bg-primary)); color:var(--fg-primary); }
body.editorial-calm .wt-icon-btn--danger:hover { background:rgba(192,57,43,0.08); color:var(--color-danger,#C0392B); }

body.editorial-calm .wt-reject { display:flex; align-items:center; gap:6px; }
body.editorial-calm .wt-reject svg { flex-shrink:0; }

/* form: grouped sections */
body.editorial-calm .wt-section { background:var(--bg-secondary); border:1px solid var(--border); border-radius:var(--radius-md); padding:16px; margin-bottom:16px; }
body.editorial-calm .wt-section__title { display:flex; align-items:center; gap:7px; font:600 12px/1 var(--font-sans); letter-spacing:0.04em; text-transform:uppercase; color:var(--fg-muted); margin-bottom:14px; }
body.editorial-calm .wt-section__title svg { color:var(--accent); }
body.editorial-calm .wt-section .form-group:last-child { margin-bottom:0; }

/* form action bar */
body.editorial-calm .wt-form-actions { display:flex; align-items:center; gap:8px; margin-top:4px; flex-wrap:wrap; }
body.editorial-calm .wt-spacer { flex:1; }
body.editorial-calm .wt-btn-ghost { background:none; border:1px solid transparent; color:var(--fg-muted); }
body.editorial-calm .wt-btn-ghost:hover { color:var(--fg-primary); background:var(--bg-secondary); }

/* empty state */
body.editorial-calm .wt-empty { text-align:center; padding:40px 24px; color:var(--fg-muted); display:flex; flex-direction:column; align-items:center; gap:6px; }
body.editorial-calm .wt-empty__icon { color:var(--accent); opacity:.75; }

/* broadcast progress + stats */
body.editorial-calm .wb-progress { height:6px; background:var(--bg-elevated,var(--border)); border-radius:999px; overflow:hidden; margin-top:2px; }
body.editorial-calm .wb-progress__bar { height:100%; background:var(--accent); transition:width .4s ease; }
body.editorial-calm .wb-stats { display:flex; gap:14px; font-size:12px; flex-wrap:wrap; }
body.editorial-calm .wb-stat-bad { color:var(--color-danger,#C0392B); }

body.editorial-calm .deploy-setup-guide {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 10px 14px; margin-bottom: 14px;
  font-size: 13px;
}

/* WhatsApp 24h stat mini-cards */
body.editorial-calm .deploy-stat-card {
  flex: 1; min-width: 120px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 10px 14px;
}
body.editorial-calm .deploy-stat-label {
  font-size: 11px; color: var(--fg-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
}
body.editorial-calm .deploy-stat-value {
  font-size: 22px; font-weight: 600; color: var(--fg); margin-top: 2px;
}
body.editorial-calm .deploy-stat-value.tone-good { color: var(--color-success); }
body.editorial-calm .deploy-stat-value.tone-warn { color: #92400E; }  /* warning pair text */
body.editorial-calm .deploy-stat-value.tone-bad { color: var(--color-danger); }

/* integrations.html / js/integrations.js */

/* Modal width modifier (replaces inline max-width:500px on .modal-content).
   Note: editorial-calm.css's .modal-content--sm is also 500px. */
body.editorial-calm .modal-content--md { max-width: 500px; }

/* Centered intro block at the top of a modal body (icon + lede) */
body.editorial-calm .ec-modal-intro { text-align: center; margin-bottom: 16px; }
body.editorial-calm .ec-modal-brand-icon { width: 48px; height: 48px; margin-bottom: 12px; }
body.editorial-calm .ec-modal-lock-icon {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--fg-muted); margin-bottom: 12px;
}

/* Inline error callout inside modals (badge-danger pair) */
body.editorial-calm .ec-error-box {
  background: #FEE2E2; color: #991B1B;
  border-radius: var(--radius-sm);
  padding: 10px; margin-bottom: 16px; font-size: 13px;
}

/* Vertical button stack (reconnect choice dialog) */
body.editorial-calm .ec-modal-btn-stack { display: flex; flex-direction: column; gap: 10px; }
body.editorial-calm .ec-modal-btn-stack .btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
body.editorial-calm .ec-btn-icon-img { width: 18px; height: 18px; }


/* ════════════════════════════════════════════
   Merged from _ec-add-inbox.css
   ════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────
   Editorial Calm — staging additions for Inbox + Inbox Analytics
   (css/_ec-add-inbox.css)

   Extends approved patterns from editorial-calm.css using tokens
   from tokens.css. Loaded after editorial-calm.css on inbox.html
   and inbox-analytics.html only. Candidate for folding into
   editorial-calm.css once approved.

   Color pairs (warning #FEF3C7/#92400E, success #D1FAE5/#065F46)
   mirror the canonical pairs already used by editorial-calm.css
   (.ec-status-pill, .badge-pill).
   ───────────────────────────────────────────────────────────── */

/* ── Filter bar extensions (shared: inbox + analytics) ─────── */
body.editorial-calm .filter-bar.ec-filter-wrap {
  flex-wrap: wrap;
  gap: 12px 16px;
}
body.editorial-calm .ec-filter-group {
  display: flex;
  gap: 8px;
  align-items: center;
}
body.editorial-calm .ec-filter-label {
  font-size: 13px;
  color: var(--fg-muted);
  margin: 0;
}
body.editorial-calm .ec-filter-group .form-control {
  width: auto;
  min-width: 150px;
}
body.editorial-calm .ec-filter-group input.form-control {
  min-width: 130px;
  padding: 6px 10px;
}
/* Icon-only clear button next to the tag filter input */
body.editorial-calm .ec-filter-clear {
  width: auto;
  min-width: auto;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Full-width search row above the filter bar */
body.editorial-calm .ec-search-row { margin: 0 0 4px; }
body.editorial-calm .ec-search-row .form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
}

/* Page-header CTA (View analytics / Back to Inbox) — the legacy
   .btn rule is width:100%; keep header actions intrinsic-width. */
body.editorial-calm .ec-header-cta {
  width: auto;
  white-space: nowrap;
}

/* ── Conversation list (rendered by js/inbox.js) ───────────── */
body.editorial-calm .resource-table tbody tr[data-action="open-transcript"] {
  cursor: pointer;
}
/* Unread rows — cream wash + accent bar (replaces the old inline
   border-left style that editorial-calm.css used to override). */
body.editorial-calm .conv-row-unread { background: var(--bg-secondary); }
body.editorial-calm .conv-row-unread td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}
body.editorial-calm .conv-name { font-weight: 600; }
body.editorial-calm .conv-row-unread .conv-name { font-weight: 700; }
body.editorial-calm .conv-session-id {
  font: 500 11px/1.4 var(--font-mono);
  color: var(--fg-muted);
  margin-top: 2px;
}
body.editorial-calm .conv-preview-cell { max-width: 420px; }
body.editorial-calm .conv-preview {
  color: var(--fg-muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.editorial-calm .conv-tag-row {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-left: 6px;
  vertical-align: middle;
}
/* Click-to-filter chips — base look comes from editorial-calm.css */
body.editorial-calm .conv-tag-chip { cursor: pointer; }

/* Presence dot — visitor tab open/closed */
body.editorial-calm .ec-presence-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
body.editorial-calm .ec-presence-dot.is-online  { background: var(--color-success); }
body.editorial-calm .ec-presence-dot.is-offline { background: var(--border-strong); }

/* Assignee badges on list rows */
body.editorial-calm .ec-assignee {
  display: inline-block;
  font: 600 10px/1.3 var(--font-sans);
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  margin-left: 6px;
  vertical-align: middle;
}
body.editorial-calm .ec-assignee--you        { background: #D1FAE5; color: #065F46; }
body.editorial-calm .ec-assignee--teammate   { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
body.editorial-calm .ec-assignee--unassigned { background: #FEF3C7; color: #92400E; }

/* ── Transcript modal (rendered by js/inbox.js) ────────────── */
body.editorial-calm #transcript-modal .modal-content { max-width: 720px; }
body.editorial-calm #transcript-modal-body {
  max-height: 60vh;
  overflow-y: auto;
}

/* Form-submission card — structured visitor form data bubble */
body.editorial-calm .ec-form-card {
  max-width: 420px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  border-bottom-right-radius: 4px;
  background: var(--accent);
  color: var(--fg-inverse);
  font-size: 14px;
}
body.editorial-calm .ec-form-card__head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.85;
}
body.editorial-calm .ec-form-card__head svg { flex-shrink: 0; }
body.editorial-calm .ec-form-card__id { opacity: 0.7; }
body.editorial-calm .ec-form-card__row {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18); /* separator on accent bg */
  font-size: 13px;
}
body.editorial-calm .ec-form-card__key {
  opacity: 0.75;
  text-transform: capitalize;
  min-width: 80px;
}
body.editorial-calm .ec-form-card__val {
  flex: 1;
  word-break: break-word;
  white-space: pre-wrap;
}

/* Tags panel add-form sizing (panel itself lives in editorial-calm.css) */
body.editorial-calm .ec-tags-panel__input {
  font-size: 12px;
  padding: 3px 8px;
  width: 110px;
}
body.editorial-calm .ec-tags-panel__add .btn {
  width: auto;
  min-width: auto;
  padding: 3px 8px;
  font-size: 12px;
}

/* Internal note cards — warning pair, agent-only context */
body.editorial-calm .ec-note-card {
  background: #FEF3C7;
  border: 1px solid color-mix(in srgb, var(--color-warning) 40%, transparent);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 6px;
}
body.editorial-calm .ec-note-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
body.editorial-calm .ec-note-author {
  font: 600 11px/1.4 var(--font-sans);
  color: #92400E;
}
body.editorial-calm .ec-note-delete {
  all: unset;
  cursor: pointer;
  color: var(--fg-muted);
  font-size: 12px;
  padding: 0 4px;
}
body.editorial-calm .ec-note-body {
  font-size: 13px;
  color: var(--fg);
  white-space: pre-wrap;
}
body.editorial-calm .ec-notes-empty {
  color: var(--fg-muted);
  font-size: 12px;
  padding: 8px 0;
  margin: 0;
}

/* Status text utilities (composer send feedback) */
body.editorial-calm .ec-text-danger  { color: var(--color-danger); }
body.editorial-calm .ec-text-success { color: #065F46; }  /* success pair text */
body.editorial-calm .ec-text-warning { color: #92400E; }  /* warning pair text */

/* ── Inbox Analytics (migrated from page <style> block) ────── */
body.editorial-calm #stat-grid { margin-bottom: 24px; }

body.editorial-calm .chart-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 900px) {
  body.editorial-calm .chart-grid { grid-template-columns: 1fr; }
}
body.editorial-calm .chart-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
body.editorial-calm .chart-card h3 {
  margin: 0 0 12px;
  font: 600 14px/1.4 var(--font-sans);
  color: var(--fg);
}
body.editorial-calm .chart-card .chart-wrap {
  position: relative;
  height: 280px;
}

body.editorial-calm .leaderboard-table { width: 100%; border-collapse: collapse; }
body.editorial-calm .leaderboard-table th,
body.editorial-calm .leaderboard-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
body.editorial-calm .leaderboard-table th {
  /* Mirror .resource-table th — mono caps header canon */
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  background: var(--bg-secondary);
}
body.editorial-calm .leaderboard-table tbody tr:last-child td { border-bottom: 0; }

body.editorial-calm .empty-note {
  padding: 28px 16px;
  text-align: center;
  color: var(--fg-muted);
  font: 400 13px/1.55 var(--font-sans);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
}


/* ════════════════════════════════════════════
   Merged from _ec-add-admin.css
   ════════════════════════════════════════════ */

/* ───────────────────────────────────────────────────────────────
   _ec-add-admin.css — Editorial Calm staging styles
   Pages: conflicts.html, users.html
   Migrated from inline <style> blocks; all rules scoped to
   body.editorial-calm and remapped to tokens.css variables.
   ─────────────────────────────────────────────────────────────── */

/* ─────────── Shared filter width utilities ─────────── */
body.editorial-calm .ec-w-110 { width: 110px; }
body.editorial-calm .ec-w-120 { width: 120px; }
body.editorial-calm .ec-w-150 { width: 150px; }

/* ─────────── Conflicts page ─────────── */
body.editorial-calm .conflicts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

body.editorial-calm .conflicts-list {
  list-style: none;
}

/* Conflict card — clean elevated card; severity expressed via badge,
   not a colored border-left. */
body.editorial-calm .conflict-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  cursor: pointer;
  transition: border-color var(--duration-fast, 150ms) var(--easing-standard, ease),
              box-shadow var(--duration-fast, 150ms) var(--easing-standard, ease);
}

body.editorial-calm .conflict-item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-1);
}

body.editorial-calm .conflict-item.is-resolved {
  cursor: default;
  opacity: 0.7;
}
body.editorial-calm .conflict-item.is-resolved:hover {
  border-color: var(--border);
  box-shadow: none;
}

body.editorial-calm .conflict-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 12px;
}

body.editorial-calm .conflict-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 4px;
}

body.editorial-calm .conflict-meta {
  font-size: 14px;
  color: var(--fg-muted);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
body.editorial-calm .conflict-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
body.editorial-calm .conflict-meta svg { flex-shrink: 0; }

body.editorial-calm .conflict-badges {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Severity badge — ub-badge pattern: pill, mono uppercase 10.5px */
body.editorial-calm .severity-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font: 500 10.5px/1.6 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

body.editorial-calm .severity-critical,
body.editorial-calm .severity-high {
  background: #FEE2E2;
  color: var(--color-danger);
}

body.editorial-calm .severity-medium {
  background: #FEF3C7;
  color: var(--color-warning);
}

body.editorial-calm .severity-low {
  background: var(--bg-secondary);
  color: var(--fg-muted);
}

body.editorial-calm .type-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font: 500 10.5px/1.6 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--bg-secondary);
  color: var(--fg-muted);
}

/* Modal styles (conflict detail modal) */
body.editorial-calm .modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

body.editorial-calm .modal-overlay .modal {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 1200px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.editorial-calm .modal-overlay .modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

body.editorial-calm .modal-overlay .modal-header h2 {
  font-size: 24px;
  color: var(--fg);
}

body.editorial-calm .modal-overlay .modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--fg-muted);
  padding: 4px 8px;
}

body.editorial-calm .modal-overlay .modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

body.editorial-calm .modal-overlay .modal-footer {
  padding: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

body.editorial-calm .comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

body.editorial-calm .comparison-panel {
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

body.editorial-calm .comparison-header {
  background: var(--bg-secondary);
  padding: 12px 16px;
  font-weight: 600;
  color: var(--fg);
  border-bottom: 2px solid var(--border);
}

body.editorial-calm .comparison-content {
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  background: var(--bg-secondary);
}

body.editorial-calm .info-section {
  margin-bottom: 24px;
}

body.editorial-calm .info-section h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--fg);
}

body.editorial-calm .info-row {
  display: flex;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

body.editorial-calm .info-label {
  font-weight: 600;
  width: 150px;
  color: var(--fg-muted);
  font-size: 14px;
}

body.editorial-calm .info-value {
  flex: 1;
  font-size: 14px;
  color: var(--fg);
}

body.editorial-calm .resolution-form {
  margin-top: 24px;
}

body.editorial-calm .resolution-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

body.editorial-calm .resolution-btn {
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  font-weight: 500;
}

body.editorial-calm .resolution-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

body.editorial-calm .resolution-btn.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

body.editorial-calm .merge-editor {
  margin-bottom: 24px;
}

body.editorial-calm .merge-editor textarea {
  width: 100%;
  min-height: 300px;
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-mono, 'Monaco', 'Menlo', 'Courier New', monospace);
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
}

/* AI questions info box — teal info treatment */
body.editorial-calm .ai-questions {
  background: var(--accent-soft);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 24px;
}

body.editorial-calm .ai-questions h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 12px;
}

body.editorial-calm .ai-questions ul {
  list-style: disc;
  margin-left: 20px;
}

body.editorial-calm .ai-questions li {
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 8px;
}

body.editorial-calm .empty-state {
  text-align: center;
  padding: 64px 32px;
  color: var(--fg-muted);
}

body.editorial-calm .batch-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

body.editorial-calm .batch-selected-count {
  margin-left: auto;
  color: var(--fg-muted);
  font-size: 14px;
}

body.editorial-calm .checkbox-cell {
  display: flex;
  align-items: center;
}

body.editorial-calm .checkbox-cell input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

@media (max-width: 768px) {
  body.editorial-calm .comparison-grid {
    grid-template-columns: 1fr;
  }

  body.editorial-calm .modal-overlay .modal {
    max-width: 100%;
  }

  body.editorial-calm .resolution-actions {
    grid-template-columns: 1fr;
  }
}

/* ─────────── Users page ─────────── */

/* Card header row (title + compact filters) */
body.editorial-calm .ec-card-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
body.editorial-calm .ec-card-head-row h3 { margin: 0; }

/* Empty-state note inside cards/modals */
body.editorial-calm .ec-empty-note {
  padding: 32px;
  color: var(--fg-muted);
}

/* Permission banners (permissions modal) */
body.editorial-calm .ec-perm-info {
  padding: 12px 14px;
  border-left: 3px solid transparent;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 14px;
}
body.editorial-calm .ec-perm-info--admin {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  color: var(--accent);
}
body.editorial-calm .ec-perm-info--editor {
  background: #FEF3C7;
  border-left-color: var(--color-warning);
  color: var(--color-warning);
}
body.editorial-calm .ec-perm-info--viewer {
  background: var(--bg-secondary);
  border-left-color: var(--fg-muted);
  color: var(--fg-muted);
}

/* Copy-button success feedback */
body.editorial-calm .btn.is-copied,
body.editorial-calm .is-copied {
  background: var(--color-success) !important;
  border-color: var(--color-success) !important;
  color: #fff !important;
}


/* ════════════════════════════════════════════
   Merged from _ec-add-settings.css
   ════════════════════════════════════════════ */

/* ============================================================
   Editorial Calm — staging additions for Workspace Settings +
   Profile pages. Extracted from inline styles during the
   design-system drift cleanup. Candidate for merge into
   editorial-calm.css once approved.
   ============================================================ */

/* ---------- team-settings: workspace logo preview ---------- */
body.editorial-calm .ec-logo-preview {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.2s ease;
}

body.editorial-calm .ec-logo-preview:hover {
  border-color: var(--border-strong, var(--border));
}

body.editorial-calm .ec-logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body.editorial-calm .ec-logo-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  border-radius: var(--radius-md);
}

body.editorial-calm .ec-logo-preview:hover .ec-logo-overlay {
  opacity: 1;
}

body.editorial-calm .ec-logo-remove {
  display: none;
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 50%;
  background: var(--color-danger);
  color: #fff;
  border: 2px solid var(--bg);
}

/* ---------- team-settings: workspace name inline editor ---------- */
body.editorial-calm .ec-name-input {
  flex: 1;
  min-width: 0;
  max-width: 240px;
  font-size: 17px;
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: border-color 0.2s, background 0.2s;
}

/* Reveal that the borderless title is an editable field on hover. */
body.editorial-calm .ec-name-input:hover:not(:focus) {
  border-color: var(--border);
  background: var(--bg);
  cursor: text;
}

/* ---------- team-settings: Smart Chat section ---------- */
body.editorial-calm .ec-sc-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

body.editorial-calm .ec-sc-item--last {
  border-bottom: none;
}

body.editorial-calm .ec-sc-title {
  font-weight: 600;
  margin-bottom: 4px;
}

body.editorial-calm .ec-sc-hint {
  font-size: 12px;
  color: var(--fg-muted);
}

body.editorial-calm .ec-sc-hint--gap {
  margin-bottom: 8px;
}

body.editorial-calm .ec-sc-textarea {
  width: 100%;
  padding: 8px 12px;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  resize: vertical;
}

body.editorial-calm .ec-sc-status {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 8px;
  text-align: right;
}

/* ---------- team-settings: view-profile modal ---------- */
body.editorial-calm .ec-vp-name {
  margin: 16px 0 4px;
  font-size: 18px;
  font-weight: 600;
}

body.editorial-calm .ec-vp-email {
  margin: 0 0 16px;
  color: var(--fg-muted);
  font-size: 14px;
}

body.editorial-calm .ec-vp-joined {
  margin: 16px 0 0;
  color: var(--fg-muted);
  font-size: 12px;
}

/* ---------- team-settings: permission banners (JS-rendered) ----------
   Kept identical to css/_ec-add-admin.css (users.html) so the two
   definitions merge cleanly into editorial-calm.css later. */
body.editorial-calm .ec-perm-info {
  padding: 12px 14px;
  border-left: 3px solid transparent;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 14px;
}

body.editorial-calm .ec-perm-info--admin {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  color: var(--accent);
}

body.editorial-calm .ec-perm-info--editor {
  background: #FEF3C7;
  border-left-color: var(--color-warning);
  color: var(--color-warning);
}

body.editorial-calm .ec-perm-info--viewer {
  background: var(--bg-secondary);
  border-left-color: var(--fg-muted);
  color: var(--fg-muted);
}

/* ---------- team-settings: password reset alert (JS-rendered) ---------- */
body.editorial-calm .ec-reset-pw-code {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  user-select: all;
}

/* ---------- profile: avatar hover overlay ---------- */
body.editorial-calm .ec-avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

body.editorial-calm .ec-avatar-overlay span {
  color: #fff;
  font-size: 10px;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
}

body.editorial-calm #avatar-setting-item:hover .ec-avatar-overlay,
body.editorial-calm #avatar-setting-item:focus .ec-avatar-overlay {
  opacity: 1;
}

/* ---------- profile: danger zone (close account) ---------- */
body.editorial-calm .ec-danger-zone {
  padding: 8px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: var(--radius-sm);
}

/* ---------- profile: MFA modals ---------- */
body.editorial-calm .mfa-intro {
  margin-bottom: 16px;
  color: var(--fg-body);
}

body.editorial-calm .mfa-qr-container {
  text-align: center;
  margin: 20px 0;
}

body.editorial-calm .mfa-qr-loading {
  padding: 40px;
  color: var(--fg-muted);
}

body.editorial-calm .mfa-qr-img {
  max-width: 200px;
  border-radius: var(--radius-md);
}

body.editorial-calm .mfa-manual-group {
  margin-top: 16px;
}

body.editorial-calm .mfa-hint-label {
  font-size: 12px;
  color: var(--fg-muted);
}

body.editorial-calm .mfa-secret {
  font-family: var(--font-mono);
  font-size: 14px;
  background: var(--bg-secondary);
  padding: 10px;
  border-radius: var(--radius-sm);
  word-break: break-all;
  margin-top: 6px;
}

body.editorial-calm .mfa-code-group {
  margin-top: 20px;
}

body.editorial-calm .mfa-code-input {
  font-size: 24px;
  letter-spacing: 8px;
  text-align: center;
  font-family: var(--font-mono);
}

body.editorial-calm .mfa-code-input--sm {
  font-size: 18px;
  letter-spacing: 4px;
  text-align: center;
  font-family: var(--font-mono);
}

body.editorial-calm .mfa-error {
  margin-top: 12px;
}

body.editorial-calm .mfa-center-head {
  text-align: center;
  margin-bottom: 20px;
}

body.editorial-calm .mfa-success-badge {
  width: 60px;
  height: 60px;
  background: color-mix(in srgb, var(--color-success) 14%, #fff);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

body.editorial-calm .mfa-success-badge svg {
  stroke: var(--color-success);
}

body.editorial-calm .mfa-heading {
  margin: 0;
  color: var(--fg);
}

body.editorial-calm .mfa-sub {
  font-size: 13px;
  color: var(--fg-muted);
  margin-top: 8px;
}

body.editorial-calm .mfa-warning-card {
  background: #FEF3C7;
  border: 1px solid var(--color-warning);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 16px;
}

body.editorial-calm .mfa-warning-title {
  color: color-mix(in srgb, var(--color-warning) 60%, #3D2500);
}

body.editorial-calm .mfa-warning-body {
  font-size: 13px;
  color: var(--fg-body);
  margin: 8px 0 0 0;
}

body.editorial-calm .mfa-backup-codes {
  background: var(--bg-secondary);
  padding: 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 14px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

body.editorial-calm .mfa-copy-btn {
  margin-top: 12px;
  width: 100%;
}

body.editorial-calm .mfa-copy-btn svg {
  margin-right: 6px;
  vertical-align: -2px;
}

body.editorial-calm .mfa-backup-info {
  background: var(--bg-secondary);
  padding: 12px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

body.editorial-calm .mfa-backup-info span {
  font-size: 13px;
  color: var(--fg-body);
}

body.editorial-calm .mfa-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------- profile: Croppie flicker fixes (migrated from inline <style>) ---------- */
body.editorial-calm .croppie-container .cr-image {
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  will-change: transform;
  transition: none !important;
}

body.editorial-calm .croppie-container .cr-boundary {
  transform: translateZ(0);
  overflow: hidden;
}

body.editorial-calm .croppie-container .cr-viewport {
  transition: none !important;
}

body.editorial-calm #avatar-croppie {
  transform: translateZ(0);
}


/* ════════════════════════════════════════════
   Merged from _ec-add-docs.css
   ════════════════════════════════════════════ */

/* =====================================================
   Editorial Calm — documents flow additions (staging)
   Extracted inline styles from documents.html,
   document-editor.html, js/documents.js and
   js/document-editor.js. Merge into editorial-calm.css
   once stable. Never duplicate rules that already live
   in editorial-calm.css.
   ===================================================== */

/* ---- Generate flow: <main> layout (generate.html) ---- */
body.editorial-calm .main-content.ec-gen-main {
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---- Generate flow: tokenized radii (overrides hardcoded 12px in editorial-calm.css) ---- */
body.editorial-calm .ec-gen-tpl { border-radius: var(--radius-md); }
body.editorial-calm .ec-gen-outline-add { border-radius: var(--radius-md); }

/* ---- Version-save section (document-editor.html edit mode) ---- */
body.editorial-calm .ec-version-save {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
body.editorial-calm .ec-version-save__row {
  display: flex;
  align-items: center;
  gap: 10px;
}
body.editorial-calm .ec-version-save__input {
  flex: 1 1 0;
  min-width: 200px;
  height: 36px;
  font-size: 13px;
  padding: 8px 12px;
}
body.editorial-calm .ec-version-save__row .btn {
  flex: 0 0 auto;
  width: auto;
  padding: 6px 14px;
  font-size: 13px;
  height: 36px;
  white-space: nowrap;
}
body.editorial-calm .ec-version-save__hint {
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 8px;
}

/* ---- Export modal: Google Docs sub-panels ---- */
body.editorial-calm .ec-export-panel {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
body.editorial-calm .ec-export-status {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
}

/* ---- Export modal: Google Docs success block ---- */
body.editorial-calm .ec-export-success {
  margin-top: 12px;
  padding: 14px;
  background: #D1FAE5;
  border: 1px solid #A7F3D0;
  border-radius: var(--radius-sm);
  text-align: center;
}
body.editorial-calm .ec-export-success__text {
  color: #065F46;
  margin-bottom: 10px;
  font-weight: 500;
  font-size: 13px;
}

/* ---- Regenerate-outline section cards (document-editor.js) ---- */
body.editorial-calm .ec-outline-sec {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  background: var(--bg-secondary);
}
body.editorial-calm .ec-outline-sec__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
body.editorial-calm .ec-outline-sec__title {
  flex: 1;
  font-weight: 600;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--fg);
}
body.editorial-calm .ec-outline-sec__focus {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--fg);
  resize: vertical;
}

/* ---- Google folder picker (document-editor.js) ---- */
body.editorial-calm .ec-folder-item {
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--fg-body);
}
body.editorial-calm .ec-folder-item:hover {
  background: var(--bg-secondary);
}
body.editorial-calm .ec-folder-item__icon {
  display: inline-flex;
  align-items: center;
  color: var(--fg-muted);
}
body.editorial-calm .ec-folder-item__name { flex: 1; }
body.editorial-calm .ec-folder-item__arrow {
  color: var(--fg-muted);
  font-size: 12px;
}
body.editorial-calm .ec-folder-msg {
  padding: 20px;
  text-align: center;
  color: var(--fg-muted);
}
body.editorial-calm .ec-folder-msg--error { color: var(--color-danger); }

/* ---- Advanced generation phase indicator (was inline in documents.html) ---- */
body.editorial-calm .advanced-progress {
  padding: 16px;
}
body.editorial-calm .phase-indicator {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
body.editorial-calm .phase-step {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  background: var(--bg-secondary);
  color: var(--fg-body);
  transition: all 0.2s;
}
body.editorial-calm .phase-step.active {
  background: var(--accent);
  color: #fff;
  font-weight: 500;
}
body.editorial-calm .phase-step.completed {
  background: #D1FAE5;
  color: #065F46;
}
body.editorial-calm .outline-preview {
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-top: 12px;
}
body.editorial-calm .section-progress {
  margin-top: 12px;
}
body.editorial-calm .section-progress__note {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 12px;
}

/* ---- Streaming-minimized widget (documents.html) ---- */
body.editorial-calm .ec-streaming-minimized {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-2);
  z-index: 1000;
  cursor: pointer;
}
body.editorial-calm .ec-streaming-minimized__row {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---- Global progress overlay (documents.js) ---- */
body.editorial-calm .ec-progress-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(27, 28, 32, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
body.editorial-calm .ec-progress-box {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 24px 32px;
  box-shadow: var(--shadow-3);
  text-align: center;
  min-width: 300px;
}
body.editorial-calm .ec-progress-box .spinner {
  margin: 0 auto 16px auto;
}
body.editorial-calm .ec-progress-box__text {
  margin: 0;
  font-size: 14px;
  color: var(--fg);
}


/* ════════════════════════════════════════════
   Merged from _ec-add-dashfiles.css
   ════════════════════════════════════════════ */

/* ============================================================
   Editorial Calm — staging additions for Dashboard & Files
   (to be merged into editorial-calm.css)

   Scope: files.html filter row, no-files empty state,
   questions modal (js/files.js renderers), cloud-error alerts.
   All selectors gated on body.editorial-calm.
   ============================================================ */

/* ---- Alerts (cloud-error modal banners) ---- */
body.editorial-calm .ec-alert {
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
}
body.editorial-calm .ec-alert--info {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
  margin-top: 12px;
}
body.editorial-calm .ec-alert--danger {
  background: #FEE2E2;
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
}

/* ---- Files page: filter / table controls row ---- */
body.editorial-calm .files-filter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
body.editorial-calm .files-filter-row .ub-eyebrow { margin: 0; }
body.editorial-calm .files-filter-row #search-input { width: 150px; }
body.editorial-calm .files-filter-row #type-filter,
body.editorial-calm .files-filter-row #status-filter { width: 110px; }
body.editorial-calm .add-file-menu img.add-file-icon { width: 20px; height: 20px; }

/* ---- Questions modal: empty state ---- */
body.editorial-calm .ec-questions-empty {
  text-align: center;
  color: var(--fg-muted);
  padding: 20px;
}
body.editorial-calm .ec-questions-empty__title {
  font: 400 20px/1.3 var(--font-serif);
  letter-spacing: -0.015em;
  margin-bottom: 8px;
  color: var(--fg);
}
body.editorial-calm .ec-questions-analyze {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
body.editorial-calm .ec-questions-analyze__hint {
  font-size: 13px;
  color: var(--fg-body);
  margin-bottom: 12px;
}
body.editorial-calm .ec-questions-analyze__note {
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 8px;
}

/* ---- Questions modal: summary strip ---- */
body.editorial-calm .ec-questions-summary {
  margin-bottom: 20px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}
body.editorial-calm .ec-questions-summary .is-pending  { color: var(--color-warning); }
body.editorial-calm .ec-questions-summary .is-answered { color: var(--color-success); }
body.editorial-calm .ec-questions-summary .is-muted    { color: var(--fg-muted); }
body.editorial-calm .ec-questions-summary .ec-questions-find-more {
  margin-left: auto;
  padding: 4px 10px;
  font-size: 12px;
}

/* ---- Questions modal: question card ---- */
body.editorial-calm .ec-question-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}
body.editorial-calm .ec-question-item__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
body.editorial-calm .ec-question-item__meta { flex: 1; }
body.editorial-calm .ec-question-item__order {
  font-size: 12px;
  color: var(--fg-muted);
}
body.editorial-calm .ec-question-item__actions { display: flex; gap: 8px; }
body.editorial-calm .ec-question-item__text {
  margin-bottom: 12px;
  color: var(--fg);
}
body.editorial-calm .ec-question-item .answer-input {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  resize: vertical;
}
body.editorial-calm .ec-question-item__controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
body.editorial-calm .ec-question-item__controls .btn { width: auto; }
body.editorial-calm .ec-question-item__controls .ec-voice-btn { padding: 4px 10px; }
body.editorial-calm .ec-question-voice-status {
  font-size: 12px;
  padding: 4px 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}

/* Answer blocks (answered + previous-answer variants) */
body.editorial-calm .ec-question-answer {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--color-success);
}
body.editorial-calm .ec-question-answer--prev {
  margin: 0 0 8px;
  padding: 8px;
  border-left-color: var(--color-warning);
}
body.editorial-calm .ec-question-answer__meta {
  font-size: 12px;
  color: var(--fg-muted);
  margin-bottom: 4px;
}
body.editorial-calm .ec-question-answer__text { color: var(--fg); }
body.editorial-calm .ec-question-answer--prev .ec-question-answer__text {
  font-size: 13px;
  color: var(--fg-body);
}

/* ---- Questions modal: bulk answer container ---- */
body.editorial-calm .ec-questions-bulk {
  margin-top: 24px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 2px dashed var(--border);
}
body.editorial-calm .ec-questions-bulk__hint {
  margin-bottom: 12px;
  color: var(--fg-body);
  font-size: 14px;
  text-align: center;
}
body.editorial-calm .ec-questions-bulk__actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
body.editorial-calm .ec-questions-bulk__actions .btn {
  padding: 8px 16px;
  font-size: 13px;
}
body.editorial-calm .ec-questions-bulk__panel {
  margin-bottom: 12px;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius-md);
  font-size: 13px;
}
body.editorial-calm .ec-questions-bulk__panel--transcript {
  border-left: 3px solid var(--accent);
}
body.editorial-calm .ec-questions-bulk__transcript-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
body.editorial-calm .ec-questions-bulk__transcript-head strong { font-size: 13px; }
body.editorial-calm .ec-questions-bulk__transcript-body {
  max-height: 200px;
  overflow-y: auto;
  font-size: 12px;
  color: var(--fg-body);
  white-space: pre-wrap;
}
body.editorial-calm .ec-questions-bulk__save { text-align: center; }
body.editorial-calm .ec-questions-bulk__save .btn {
  padding: 10px 24px;
  font-size: 14px;
}
body.editorial-calm .ec-questions-bulk__status {
  margin-top: 8px;
  font-size: 12px;
  color: var(--fg-muted);
  text-align: center;
}


/* ════════════════════════════════════════════
   Merged from _ec-add-modals.css
   ════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────
   Editorial Calm — STAGING styles for the space modals
   (create-project-modal.js + project-settings-modal.js).
   Injected on demand by those two scripts (they add this file
   as a <link> at show() time); merge into editorial-calm.css
   once approved.

   Scoping: these modals are lazy-loaded on ANY page, so nothing
   here is gated on body.editorial-calm. Everything is scoped to
   .modal-overlay + the .ec-spm namespace (spm = space modal) to
   avoid collisions with other modals. The modal shell pieces
   (overlay, header eyebrow, footer, pill buttons, inputs) are
   replicated from editorial-calm.css because its versions are
   scoped to body.editorial-calm.
   ───────────────────────────────────────────────────────────── */

/* Overlay — centered dialog with dimmed backdrop, standalone */
#create-project-modal.modal-overlay,
#project-settings-modal.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(27, 28, 32, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop, 2000);
  padding: var(--space-6, 24px);
  overflow-y: auto;
}

/* Modal shell — scrollable body between fixed header/footer */
.modal-overlay > .modal-content.ec-spm {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-3);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.modal-overlay .ec-spm .modal-header {
  padding: 22px 24px 14px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  position: relative;
  flex-shrink: 0;
}
/* Eyebrow above the title — data-eyebrow="..." on .modal-header */
.modal-overlay .ec-spm .modal-header[data-eyebrow]::before {
  content: attr(data-eyebrow);
  display: block;
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.modal-overlay .ec-spm .modal-header h3 {
  font: 400 22px/1.25 var(--font-serif);
  letter-spacing: -0.015em;
  color: var(--fg);
  margin: 0;
}
/* Header subtitle under the serif title */
.modal-overlay .ec-spm-sub {
  font: 400 13px/1.5 var(--font-sans);
  color: var(--fg-muted);
  margin: 6px 0 0;
}

.modal-overlay .ec-spm .modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--fg-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration-fast, 150ms) ease,
              color var(--duration-fast, 150ms) ease;
}
.modal-overlay .ec-spm .modal-close:hover {
  background: var(--bg-secondary);
  border-color: var(--border);
  color: var(--fg);
}
.modal-overlay .ec-spm .modal-close svg { width: 16px; height: 16px; }

.modal-overlay .ec-spm .modal-body {
  padding: 18px 24px 24px;
  background: transparent;
  overflow-y: auto;
  flex: 1;
}

.modal-overlay .ec-spm .modal-footer {
  padding: 14px 24px 20px;
  border-top: 1px solid var(--border);
  background: transparent;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* Pill buttons (replicated from editorial-calm.css .btn) */
.modal-overlay .ec-spm .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-pill);
  font: 600 13px/1 var(--font-sans);
  letter-spacing: -0.005em;
  padding: 9px 18px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--duration-fast, 150ms) ease,
              border-color var(--duration-fast, 150ms) ease,
              color var(--duration-fast, 150ms) ease;
}
/* pointer-events: none so click handlers reading e.target always get the button */
.modal-overlay .ec-spm .btn svg { width: 16px; height: 16px; flex-shrink: 0; pointer-events: none; }
.modal-overlay .ec-spm .btn-sm { padding: 7px 13px; font-size: 12px; }
.modal-overlay .ec-spm .btn-sm svg { width: 13px; height: 13px; }
.modal-overlay .ec-spm .btn-primary { background: var(--accent); color: #fff; }
.modal-overlay .ec-spm .btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.modal-overlay .ec-spm .btn-secondary {
  background: transparent;
  color: var(--fg);
  border-color: var(--border);
}
.modal-overlay .ec-spm .btn-secondary:hover:not(:disabled) { background: var(--bg-secondary); }
.modal-overlay .ec-spm .btn-danger { background: var(--color-danger); color: #fff; }
.modal-overlay .ec-spm .btn-danger-outline {
  background: transparent;
  color: var(--color-danger);
  border-color: color-mix(in srgb, var(--color-danger) 45%, transparent);
}
.modal-overlay .ec-spm .btn-danger-outline:hover:not(:disabled) {
  background: color-mix(in srgb, var(--color-danger) 8%, transparent);
  border-color: var(--color-danger);
}
.modal-overlay .ec-spm .btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Labels + inputs inside the modal body */
.modal-overlay .ec-spm .modal-body label {
  display: block;
  font: 500 12px/1 var(--font-sans);
  color: var(--fg);
  margin-bottom: 6px;
}
.modal-overlay .ec-spm .modal-body input[type="text"],
.modal-overlay .ec-spm .modal-body input[type="email"],
.modal-overlay .ec-spm .modal-body textarea,
.modal-overlay .ec-spm .modal-body select {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font: 400 14px/1.5 var(--font-sans);
  color: var(--fg);
  outline: none;
  transition: border-color var(--duration-fast, 150ms) ease;
}
.modal-overlay .ec-spm .modal-body input:focus,
.modal-overlay .ec-spm .modal-body textarea:focus,
.modal-overlay .ec-spm .modal-body select:focus {
  border-color: var(--accent);
}
.modal-overlay .ec-spm .modal-body textarea { resize: vertical; font-family: var(--font-sans); }
.modal-overlay .ec-spm input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.modal-overlay .ec-spm input[type="checkbox"]:disabled { cursor: not-allowed; }
.modal-overlay .ec-spm-req { color: var(--color-danger); }
.modal-overlay .ec-spm-opt { color: var(--fg-muted); font-weight: 400; }

/* Sections + numbered step labels */
.modal-overlay .ec-spm-section { margin-bottom: 22px; }
.modal-overlay .ec-spm-step {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.modal-overlay .ec-spm-step-num {
  font: 600 11px/1 var(--font-mono);
  color: var(--accent);
}
.modal-overlay .ec-spm-step-name {
  font: 600 13px/1 var(--font-sans);
  letter-spacing: -0.005em;
  color: var(--fg);
}

/* Fields — wrapper owns vertical rhythm, not the input */
.modal-overlay .ec-spm-field { margin-bottom: 14px; }
.modal-overlay .ec-spm-field-error {
  display: none;
  margin-top: 6px;
  font: 500 12px/1.4 var(--font-sans);
  color: var(--color-danger);
}

/* Soft accent panel (knowledge inheritance) */
.modal-overlay .ec-spm-soft {
  padding: 14px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.modal-overlay .ec-spm label.ec-spm-check {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  font: 400 14px/1.5 var(--font-sans);
  color: var(--fg);
  margin: 0;
}
.modal-overlay .ec-spm-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}
.modal-overlay .ec-spm-check strong { font-weight: 600; color: var(--fg); }
.modal-overlay .ec-spm-hint {
  display: block;
  font: 400 12px/1.5 var(--font-sans);
  color: var(--fg-muted);
  margin-top: 2px;
}

/* Bordered scroll panels (document list, member list) */
.modal-overlay .ec-spm-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  padding: 12px;
  overflow-y: auto;
}
.modal-overlay .ec-spm-panel--tint {
  background: var(--bg-secondary);
  padding: 10px;
}

/* Mono group label inside panels (e.g. DOCUMENTS) */
.modal-overlay .ec-spm-group-label {
  font: 600 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

/* Selectable option rows (documents) */
.modal-overlay .ec-spm label.ec-spm-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  font: 400 14px/1.4 var(--font-sans);
  color: var(--fg);
  padding: 10px 12px;
  margin: 0 0 4px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: var(--bg-secondary);
  transition: background var(--duration-fast, 150ms) ease,
              border-color var(--duration-fast, 150ms) ease;
}
.modal-overlay .ec-spm label.ec-spm-option:hover {
  background: var(--accent-soft);
  border-color: var(--border);
}
.modal-overlay .ec-spm-option input[type="checkbox"] { margin-top: 2px; }
.modal-overlay .ec-spm-option-title { font-weight: 600; color: var(--fg); }

/* Inline "Select All" toggle */
.modal-overlay .ec-spm label.ec-spm-selectall {
  display: flex;
  gap: 6px;
  align-items: center;
  cursor: pointer;
  font: 500 12px/1 var(--font-sans);
  color: var(--fg-muted);
  margin: 0;
  padding: 4px 8px;
  border-radius: var(--radius-md);
  transition: background var(--duration-fast, 150ms) ease;
}
.modal-overlay .ec-spm label.ec-spm-selectall:hover { background: var(--bg-secondary); }
.modal-overlay .ec-spm-selectall input[type="checkbox"] { width: 14px; height: 14px; }

/* Head row above a panel: label/step left, action right */
.modal-overlay .ec-spm-row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.modal-overlay .ec-spm-row-between .ec-spm-step { margin-bottom: 0; }
.modal-overlay .ec-spm label.ec-spm-label {
  font: 500 13px/1 var(--font-sans);
  color: var(--fg);
  margin: 0;
}

/* "Files to be included" note */
.modal-overlay .ec-spm-note {
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.modal-overlay .ec-spm-note-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 600 12px/1 var(--font-sans);
  color: var(--accent);
  margin-bottom: 4px;
}
.modal-overlay .ec-spm-note-head svg { width: 14px; height: 14px; }
.modal-overlay .ec-spm-note-body {
  font: 400 12px/1.5 var(--font-sans);
  color: var(--fg-body);
}

/* Member add row (input + role + Add) */
.modal-overlay .ec-spm-add-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 10px;
}

/* Compact role select (overrides the generic modal-body select) */
.modal-overlay .ec-spm .modal-body select.ec-spm-role {
  width: auto;
  padding: 6px 10px;
  font: 500 12.5px/1.4 var(--font-sans);
  color: var(--fg);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
}
.modal-overlay .ec-spm .modal-body select.ec-spm-role:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
/* Per-member Inbox/Deploy capability toggles in the space-members list */
.modal-overlay .ec-spm .modal-body .ec-spm-cap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: 500 11.5px/1 var(--font-sans);
  color: var(--fg-muted);
  cursor: pointer;
  white-space: nowrap;
}
.modal-overlay .ec-spm .modal-body .ec-spm-cap input { cursor: pointer; margin: 0; }
.modal-overlay .ec-spm .modal-body .ec-spm-cap input:disabled { cursor: not-allowed; opacity: 0.5; }
.modal-overlay .ec-spm .modal-body .ec-spm-cap input:checked + span { color: var(--accent); }

/* Member suggestions dropdown (positioned fixed by JS) */
.modal-overlay .ec-spm-suggest {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-2);
  max-height: 200px;
  overflow-y: auto;
  min-width: 200px;
  z-index: 100001;
}
.modal-overlay .ec-spm-suggest .member-suggestion-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  transition: background var(--duration-fast, 150ms) ease;
}
.modal-overlay .ec-spm-suggest .member-suggestion-item:last-child { border-bottom: 0; }
.modal-overlay .ec-spm-suggest .member-suggestion-item:hover { background: var(--bg-secondary); }
.modal-overlay .ec-spm-suggest-name {
  font: 600 13px/1.4 var(--font-sans);
  color: var(--fg);
}
.modal-overlay .ec-spm-suggest-mail {
  font: 400 12px/1.4 var(--font-sans);
  color: var(--fg-muted);
  margin-top: 2px;
}
.modal-overlay .ec-spm-suggest .ec-spm-suggest-new {
  background: var(--accent-soft);
  border-top: 1px solid var(--accent);
}
.modal-overlay .ec-spm-suggest .ec-spm-suggest-new:hover { background: var(--accent-soft); }
.modal-overlay .ec-spm-suggest-new .ec-spm-suggest-name,
.modal-overlay .ec-spm-suggest-new .ec-spm-suggest-mail { color: var(--accent); }

/* Member rows */
.modal-overlay .ec-spm-member {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: background var(--duration-fast, 150ms) ease;
}
.modal-overlay .ec-spm-member:hover { background: var(--accent-soft); }
.modal-overlay .ec-spm-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 600 13px/1 var(--font-sans);
  flex-shrink: 0;
}
.modal-overlay .ec-spm-member-name {
  font: 600 13px/1.4 var(--font-sans);
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modal-overlay .ec-spm-member-meta {
  font: 400 11px/1.4 var(--font-sans);
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modal-overlay .ec-spm-role-tag {
  color: var(--accent);
  font-weight: 600;
  text-transform: capitalize;
}

/* Empty / loading states inside panels */
.modal-overlay .ec-spm-empty {
  text-align: center;
  color: var(--fg-muted);
  padding: 30px 20px;
  font: 400 13px/1.5 var(--font-sans);
}
.modal-overlay .ec-spm-empty svg {
  display: block;
  margin: 0 auto 8px;
  color: var(--fg-muted);
  opacity: 0.7;
}
.modal-overlay .ec-spm-empty--sm {
  padding: 14px;
  font-size: 12px;
}
.modal-overlay .ec-spm-empty--boxed {
  background: var(--bg-secondary);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}
.modal-overlay .ec-spm-empty--danger { color: var(--color-danger); }

/* Integration chips */
.modal-overlay .ec-spm-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font: 600 13px/1 var(--font-sans);
  color: var(--fg);
}
.modal-overlay .ec-spm-chip svg {
  width: 16px;
  height: 16px;
  color: var(--fg-muted);
}
.modal-overlay .ec-spm-chip img {
  width: 16px;
  height: 16px;
}
.modal-overlay .ec-spm-chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-success);
}

/* Accent text link */
.modal-overlay .ec-spm-link {
  font: 600 12px/1.4 var(--font-sans);
  color: var(--accent);
  text-decoration: none;
}
.modal-overlay .ec-spm-link:hover { text-decoration: underline; }

/* Danger zone */
.modal-overlay .ec-spm-danger {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--color-danger) 35%, transparent);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
}
.modal-overlay .ec-spm-danger .ec-spm-step-num,
.modal-overlay .ec-spm-danger .ec-spm-step-name { color: var(--color-danger); }
.modal-overlay .ec-spm-danger .btn { width: 100%; }
.modal-overlay .ec-spm-danger-hint {
  display: block;
  margin-top: 8px;
  font: 400 11px/1.4 var(--font-sans);
  color: var(--fg-muted);
  text-align: center;
}

/* Voice-recording dot + svg chevron alignment (chat composer) */
body.editorial-calm .rec-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: var(--radius-pill);
  background: var(--color-danger);
  margin-right: 5px;
  animation: ec-rec-pulse 1.2s ease-in-out infinite;
}
@keyframes ec-rec-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}
body.editorial-calm .sources-toggle-icon { display: inline-flex; align-items: center; }

/* ════════════════════════════════════════════
   add-member-modal
   (AddMemberModal — child of create-project /
   project-settings modals; reuses the ec-spm
   namespace above. Scoped to .modal-overlay /
   #add-member-modal, not body.editorial-calm,
   because the modal is lazy-loaded on any page.)
   ════════════════════════════════════════════ */

/* Overlay — same treatment as the other space modals
   (the rule above is ID-scoped, so it must be repeated here) */
#add-member-modal.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(27, 28, 32, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop, 2000);
  padding: var(--space-6, 24px);
  overflow-y: auto;
}

/* Narrower dialog than the parent modals */
#add-member-modal .modal-content.ec-spm {
  max-width: 480px;
  max-height: 85vh;
}

/* Mono group header inside the suggestions dropdown */
.modal-overlay .ec-amm-suggest-head {
  padding: 8px 12px;
  font: 600 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

/* Rich suggestion rows (avatar + name + email) — the click
   handlers query .member-suggestion, so styles hang off it */
.modal-overlay .ec-spm-suggest .member-suggestion {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--duration-fast, 150ms) ease;
}
.modal-overlay .ec-spm-suggest .member-suggestion:last-child { border-bottom: 0; }
.modal-overlay .ec-spm-suggest .member-suggestion:hover { background: var(--bg-secondary); }
/* "Invite new user" row keeps its accent tint on hover */
.modal-overlay .ec-spm-suggest .member-suggestion.ec-spm-suggest-new:hover {
  background: var(--accent-soft);
}

/* Small round avatar in suggestion rows */
.modal-overlay .ec-amm-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 600 11px/1 var(--font-sans);
  flex-shrink: 0;
}

/* Inline error panel */
.modal-overlay .ec-amm-error {
  margin-top: 12px;
  padding: 12px;
  font: 400 13px/1.5 var(--font-sans);
  color: var(--color-danger);
  background: color-mix(in srgb, var(--color-danger) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-danger) 35%, transparent);
  border-radius: var(--radius-md);
}

/* ============================================================================
   Document surface — toolbar CTA alignment + editor chrome (audit fixes)
   ============================================================================ */
/* "Create Document" carried a bespoke height:38px (via .btn-create) that out-sat
   its sibling "Recently Deleted" (.btn-action, ~32px). Size it to match the
   toolbar row. (Higher specificity than `body.editorial-calm .btn`.) */
body.editorial-calm .btn.btn-create {
  height: auto;
  padding: 7px 16px;   /* matches the ~38px height of the sibling .btn-action */
}

/* Editor area — collapse the THREE stacked boundaries into one clean card.
   DOM gotcha: the OUTER element carries BOTH class .collaborative-edit-wrapper
   AND id #collaborative-editor-container; the INNER element carries class
   .collaborative-editor-container. The card rule at ~1395 styles the outer via
   its ID selector, which out-specifies a plain class override — so stripping the
   outer requires matching that ID. After: outer wrapper + #edit-mode are
   passthroughs; the INNER .collaborative-editor-container is the single card.
   (Protected editor — only the chrome changes; toolbar/presence/Saved untouched.) */
body.editorial-calm #edit-mode {
  background: transparent;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
}
/* Outer wrapper: strip the card. ID selector matches the ~1395 rule's specificity
   (and wins by being later) so the border/shadow/radius/padding all reset. */
body.editorial-calm #collaborative-editor-container {
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
}
/* Inner container: the single card. Descendant selector out-specifies the base
   .collaborative-editor-container rule in collaborative-editor.css. */
body.editorial-calm .collaborative-edit-wrapper .collaborative-editor-container {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  background: var(--bg-elevated);
  /* overflow stays VISIBLE so toolbar dropdowns/tooltips aren't clipped; round the
     toolbar's top corners by hand so it follows the card radius instead. */
}
body.editorial-calm .collaborative-edit-wrapper .collaborative-editor-container .editor-toolbar {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--bg-secondary);
}
/* Document-like inner padding now that the outer wrapper's 32px padding is gone. */
body.editorial-calm .collaborative-edit-wrapper .collaborative-editor-container .editor-content {
  padding: 28px 36px;
}

/* ═══════════════════════════════════════════════════════════════════════
   Inbox — two-pane conversation view (list left, thread right)
   The app sidebar is untouched; only .inbox-main splits. The main region is
   pinned to the viewport height so each pane scrolls independently — a
   messaging-app feel rather than the old transcript modal overlay.
   ═══════════════════════════════════════════════════════════════════════ */
body.editorial-calm .main-content.inbox-main {
  height: 100vh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.editorial-calm .inbox-main .page-header { margin-bottom: var(--space-6); }

body.editorial-calm .inbox-split {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: var(--space-6);
}

/* Left pane: filters + scrollable list */
body.editorial-calm .inbox-list-pane {
  flex: 0 0 clamp(320px, 36%, 440px);
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
body.editorial-calm .inbox-list-pane #conversations-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
}
/* Compact conversation-list items (messaging-app style, not a wide table) */
body.editorial-calm .conv-list { display: flex; flex-direction: column; }
body.editorial-calm .conv-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--duration-fast, 0.15s) var(--easing-standard, ease);
  position: relative; /* anchor for the read/unread toggle */
}
body.editorial-calm .conv-item:last-child { border-bottom: 0; }
body.editorial-calm .conv-item:hover { background: var(--bg-secondary); }
body.editorial-calm .conv-item__row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
body.editorial-calm .conv-item__name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.editorial-calm .conv-item__time {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--fg-muted);
}
body.editorial-calm .conv-item__row2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--fg-muted);
}
body.editorial-calm .conv-item__msgs { flex-shrink: 0; }
body.editorial-calm .conv-item__preview {
  font-size: 13px;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.editorial-calm .conv-item.is-unread .conv-item__name { font-weight: 700; }
body.editorial-calm .conv-item.is-unread .conv-item__preview { color: var(--fg-body); }
/* Unread marker: a left-edge accent bar on the row (inset shadow → no content
   shift) alongside the bold name. Deliberately distinct from the green "online"
   presence dot so the two never read as the same signal. */
body.editorial-calm .conv-item.is-unread {
  box-shadow: inset 3px 0 0 var(--accent);
}
/* Per-row read/unread toggle — sits where the timestamp is and swaps in on
   hover so it never adds clutter at rest. */
body.editorial-calm .conv-item__readtoggle {
  position: absolute;
  top: 9px; right: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm, 6px);
  background: var(--bg-elevated, #fff); color: var(--fg-muted);
  cursor: pointer; opacity: 0; pointer-events: none;
  transition: opacity var(--duration-fast, 0.15s) ease, color 0.15s ease, background 0.15s ease;
}
body.editorial-calm .conv-item:hover .conv-item__readtoggle { opacity: 1; pointer-events: auto; }
body.editorial-calm .conv-item:hover .conv-item__time { opacity: 0; }
body.editorial-calm .conv-item__readtoggle:hover { color: var(--fg); background: var(--bg-secondary); }

/* Right pane: thread card */
body.editorial-calm .inbox-thread-pane {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}

/* Empty placeholder — shown until a conversation is selected */
body.editorial-calm .inbox-thread-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  text-align: center;
}
body.editorial-calm .inbox-thread-empty__inner { max-width: 320px; color: var(--fg-muted); }
body.editorial-calm .inbox-thread-empty__inner svg { color: var(--accent); opacity: 0.8; margin-bottom: 12px; }
body.editorial-calm .inbox-thread-empty__inner h3 {
  font: 400 20px/1.2 var(--font-serif);
  color: var(--fg);
  margin: 0 0 6px;
}
body.editorial-calm .inbox-thread-empty__inner p { margin: 0; font-size: 14px; }

/* Active thread — header bar + scrollable body */
body.editorial-calm .inbox-thread-active {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
/* Thread header = identity row + action toolbar as ONE block, split by a
   hairline, and separated from the messages by a hairline below. No cards. */
body.editorial-calm .inbox-thread-head {
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
body.editorial-calm .inbox-thread-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  background: transparent;                   /* the head provides the tint */
  flex-shrink: 0;
}
/* Action toolbar row — flush inside the header (same 16px gutter as the identity
   row). The divider lives on the toolbar's TOP so it disappears together with
   the toolbar on API / unresolved threads (no orphaned double line). */
body.editorial-calm .inbox-thread-toolbar {
  padding: 8px 16px;
  border-top: 1px solid var(--border);
}
body.editorial-calm .inbox-thread-toolbar:empty { display: none; }
body.editorial-calm .inbox-thread-toolbar .ec-assignment-bar {
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0;
  width: 100%;
  min-height: 30px;
  flex-wrap: nowrap;              /* keep the action row on one line */
  justify-content: flex-end;      /* actions align right, under the status pill */
}
/* Consistent, compact action buttons — label centred, and width auto to
   override the global .btn-primary { width:100% } from styles.css. */
body.editorial-calm .inbox-thread-toolbar .btn {
  width: auto;
  min-width: 84px;
  padding: 7px 14px;
  font-size: 13px;
  justify-content: center;        /* centre the label within the button */
}
body.editorial-calm .inbox-thread-title {
  font: 500 14px/1.2 var(--font-sans);
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;               /* let the name ellipsize, keep presence pill intact */
}
body.editorial-calm .inbox-thread-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Status pill (Bot / Assigned / …) pinned to the right of the identity bar,
   instead of living in its own bar below. */
body.editorial-calm .inbox-thread-status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
body.editorial-calm .inbox-thread-back { flex-shrink: 0; }
/* Toolbar meta (session id + "Manage settings") sits at the right of the
   action toolbar, muted, so the actions read as the primary content. */
body.editorial-calm .ec-assignment-meta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  min-width: 0;
}

/* Body fills + scrolls; override the legacy modal max-height:60vh */
body.editorial-calm .inbox-thread-pane #transcript-modal-body {
  flex: 1;
  min-height: 0;
  max-height: none;
  /* The MESSAGES thread scrolls, not the whole pane — so the status/action bar
     stays pinned at the top and the composer at the bottom no matter how long
     the conversation gets. */
  overflow: hidden;
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
}
/* Everything except the thread is fixed: header + status/actions pin to the top,
   composer + notes pin to the bottom. */
body.editorial-calm .inbox-thread-pane #transcript-modal-body > * {
  flex: 0 0 auto;
}
/* Only the messages thread takes the spare height and scrolls. */
body.editorial-calm .inbox-thread-pane #transcript-modal-body .ec-transcript-thread {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin-top: 0;
}

/* Empty vs active toggle, driven by .has-thread on the split */
body.editorial-calm .inbox-split:not(.has-thread) .inbox-thread-active { display: none; }
body.editorial-calm .inbox-split.has-thread .inbox-thread-empty { display: none; }

/* Active item highlight in the list */
body.editorial-calm #conversations-container .conv-item.is-active,
body.editorial-calm #conversations-container .conv-item.is-active:hover {
  /* Active = filled background tint only. The left-edge accent bar is reserved
     exclusively for UNREAD, so opening an unread row visibly changes the bar
     into a background tint (previously both used the same bar → looked stuck). */
  background: var(--accent-soft);
}

/* Desktop: the back arrow is a no-op (clicking another row switches threads),
   so hide it; it returns on mobile where it slides back to the list. */
@media (min-width: 861px) {
  body.editorial-calm .inbox-thread-back { display: none; }
}

/* Mobile: stack. List full-width; opening a chat slides the thread over it. */
@media (max-width: 860px) {
  body.editorial-calm .main-content.inbox-main { height: auto; overflow: visible; }
  body.editorial-calm .inbox-list-pane { flex-basis: auto; }
  body.editorial-calm .inbox-list-pane #conversations-container { max-height: 60vh; }
  body.editorial-calm .inbox-thread-pane {
    position: fixed;
    inset: 0;
    z-index: 60;
    border: 0;
    border-radius: 0;
    transform: translateX(100%);
    transition: transform var(--duration-fast, 0.2s) var(--easing-standard, ease);
  }
  body.editorial-calm .inbox-split.has-thread .inbox-thread-pane { transform: translateX(0); }
  body.editorial-calm .inbox-split:not(.has-thread) .inbox-thread-pane { pointer-events: none; }
}

/* ═══════════════════════════════════════════════════════════════════════
   Inbox refinements — compact filters + clearer thread hierarchy
   (reply = primary/brand, internal note = secondary/muted, meta = compact)
   ═══════════════════════════════════════════════════════════════════════ */

/* Filter bar: tidy 2×2 grid of self-describing selects. Labels go sr-only —
   the option text ("Widgets", "Open (default)", "Anyone") already names each
   filter, so the inline "Source:/Status:" labels just ate space. */
body.editorial-calm .inbox-list-pane .filter-bar.ec-filter-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
body.editorial-calm .inbox-list-pane .ec-filter-group { gap: 4px; min-width: 0; }
body.editorial-calm .inbox-list-pane .ec-filter-label {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
body.editorial-calm .inbox-list-pane .ec-filter-group .form-control {
  width: 100%;
  min-width: 0;
}
/* Source is the primary view switcher (incl. "All sources") — give it the full
   width on its own row, with Status + Assignee sharing the row below. */
body.editorial-calm .inbox-list-pane .ec-filter-group--source { grid-column: 1 / -1; }

/* Editorial-Calm select styling — replace the bland native control with a
   token-aligned field: own chevron, accent hover/focus, proper radius. */
body.editorial-calm .inbox-list-pane select.form-control {
  appearance: none;
  -webkit-appearance: none;
  padding: 9px 34px 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--bg-elevated);
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 15px;
  font: 500 13px/1.2 var(--font-sans);
  color: var(--fg);
  cursor: pointer;
  transition: border-color var(--duration-fast, 0.15s) var(--easing-standard, ease),
              box-shadow var(--duration-fast, 0.15s) var(--easing-standard, ease);
}
body.editorial-calm .inbox-list-pane select.form-control:hover { border-color: var(--accent); }
body.editorial-calm .inbox-list-pane select.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

/* Per-row source icon in the conversation list */
body.editorial-calm .conv-item__source {
  display: inline-flex;
  align-items: center;
  color: var(--fg-muted);
  flex-shrink: 0;
}
body.editorial-calm .conv-item__source svg { width: 13px; height: 13px; }

/* Keep the meta panels (assignment + tags) compact so the conversation —
   not the controls — is the focal area of the pane. */
/* (Assignment bar now lives flush in .inbox-thread-toolbar — no card padding/margin.) */
body.editorial-calm .inbox-thread-pane .ec-tags-panel { margin-bottom: 10px; padding: 4px 0; }
body.editorial-calm .inbox-thread-pane .ec-transcript-thread { gap: 4px; margin: 10px 0 4px; }

/* Reply composer = PRIMARY action. A brand-accent frame + label makes it
   unmistakably "this message goes to the visitor". */
body.editorial-calm .ec-reply-zone {
  margin-top: 18px;
  padding: 12px 14px 10px;
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-1);
}
body.editorial-calm .ec-reply-zone__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 600 11px/1 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
body.editorial-calm .ec-reply-zone__label svg { color: var(--accent); }
body.editorial-calm .ec-reply-zone .ec-transcript-composer {
  margin: 0;
  padding: 0;
  border: 0;
  gap: 8px;
  align-items: center; /* center the Send button against the textarea */
}
body.editorial-calm .ec-reply-zone .ec-transcript-send {
  align-self: center;
  min-width: 104px;
  font-weight: 600;
}
/* Reply field = customer-facing → white field with a brand-accent focus, so it
   visibly pairs with the teal "Reply to visitor" frame. */
body.editorial-calm .ec-reply-zone .ec-transcript-textarea {
  background: var(--bg-elevated);
}
body.editorial-calm .ec-reply-zone .ec-transcript-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

/* Internal notes = SECONDARY / internal. Uses the universal "internal note"
   amber treatment (Intercom/Zendesk/Help Scout) so the note FIELD itself is
   unmistakably different from the white customer-reply field — no second-
   guessing which box goes to the visitor. */
body.editorial-calm .inbox-thread-pane .ec-notes-panel {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-md);
  background: #FEFCE8;
}
body.editorial-calm .inbox-thread-pane .ec-notes-panel__label { color: #92400E; }
body.editorial-calm .inbox-thread-pane .ec-notes-panel__hint { color: #B45309; }
body.editorial-calm .inbox-thread-pane .ec-notes-textarea {
  background: #FFFDF2;
  border-color: #FDE68A;
}
body.editorial-calm .inbox-thread-pane .ec-notes-textarea::placeholder { color: #B45309; opacity: 0.7; }
body.editorial-calm .inbox-thread-pane .ec-notes-textarea:focus {
  border-color: #F59E0B;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
  outline: none;
}
body.editorial-calm .inbox-thread-pane .ec-notes-add-btn { align-self: flex-start; }

/* Collapsed note composer: an "Add note" trigger is shown by default; the amber
   field + actions only appear once .is-adding is toggled on the panel. Keeps the
   notes block compact (just the list + a CTA) until the user wants to write. */
body.editorial-calm .inbox-thread-pane .ec-notes-trigger {
  align-self: flex-start;
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px dashed #FCD34D;
  color: #92400E;
}
body.editorial-calm .inbox-thread-pane .ec-notes-trigger:hover {
  background: #FEF9C3;
  border-color: #F59E0B;
  color: #92400E;
}
body.editorial-calm .inbox-thread-pane .ec-notes-add {
  display: none;
  flex-direction: column;
  gap: 8px;
}
body.editorial-calm .inbox-thread-pane .ec-notes-panel.is-adding .ec-notes-add { display: flex; }
body.editorial-calm .inbox-thread-pane .ec-notes-panel.is-adding .ec-notes-trigger { display: none; }
body.editorial-calm .inbox-thread-pane .ec-notes-add__actions { display: flex; gap: 6px; }

/* Notes disclosure — the whole panel collapses to a compact "Internal notes (N)"
   header; clicking it reveals the notes + Add note. Keeps the thread focused on
   the conversation; notes are opt-in. */
body.editorial-calm .inbox-thread-pane .ec-notes-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
}
body.editorial-calm .inbox-thread-pane .ec-notes-toggle__title {
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #92400E;
}
body.editorial-calm .inbox-thread-pane .ec-notes-toggle__hint {
  font: 400 12px/1 var(--font-sans);
  color: #B45309;
}
body.editorial-calm .inbox-thread-pane .ec-notes-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #FDE68A;
  color: #92400E;
  font: 600 11px/1 var(--font-sans);
}
body.editorial-calm .inbox-thread-pane .ec-notes-toggle__chev {
  margin-left: auto;
  display: inline-flex;
  color: #B45309;
  transition: transform var(--duration-fast, 0.15s) var(--easing-standard, ease);
}
body.editorial-calm .inbox-thread-pane .ec-notes-panel.is-open .ec-notes-toggle__chev {
  transform: rotate(180deg);
}
body.editorial-calm .inbox-thread-pane .ec-notes-body { display: none; margin-top: 12px; }
body.editorial-calm .inbox-thread-pane .ec-notes-panel.is-open .ec-notes-body { display: block; }

/* ═══════════════════════════════════════════════════════════════════════
   Deploy — surface picker cards (replace the old tab strip). One card per
   surface; the active card reveals its panel below.
   ═══════════════════════════════════════════════════════════════════════ */
/* Section heading separating the stat tiles above from the surface picker */
body.editorial-calm .deploy-surfaces-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 18px 0 10px;
}
body.editorial-calm .deploy-surfaces-head__title {
  font: 500 11px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
body.editorial-calm .deploy-surfaces-head__hint {
  font: 400 13px/1 var(--font-sans);
  color: var(--fg-muted);
}

body.editorial-calm .deploy-surface-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 0 0 var(--space-8);
}
/* Raised, clearly clickable cards — icon in a filled accent chip, hover lift.
   Deliberately the inverse of the flat, borderless stat tiles above. */
body.editorial-calm .deploy-surface-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 18px;
  text-align: left;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  cursor: pointer;
  transition: border-color var(--duration-fast, 0.15s) var(--easing-standard, ease),
              box-shadow var(--duration-fast, 0.15s) var(--easing-standard, ease),
              transform var(--duration-fast, 0.15s) var(--easing-standard, ease),
              background var(--duration-fast, 0.15s) var(--easing-standard, ease);
}
body.editorial-calm .deploy-surface-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  transform: translateY(-2px);
}
body.editorial-calm .deploy-surface-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
  transform: none;
}
/* caret bridging the active card to its panel below */
body.editorial-calm .deploy-surface-card.active::after {
  content: "";
  position: absolute;
  left: 26px;
  bottom: -7px;
  width: 12px;
  height: 12px;
  background: var(--accent-soft);
  border-right: 1px solid var(--accent);
  border-bottom: 1px solid var(--accent);
  transform: rotate(45deg);
}
/* prominent icon chip — the strongest visual cue these are surfaces, not stats */
body.editorial-calm .deploy-surface-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 8px;
}
body.editorial-calm .deploy-surface-card.active .deploy-surface-card__icon {
  background: var(--accent);
  color: var(--fg-inverse, #fff);
}
body.editorial-calm .deploy-surface-card__title {
  font: 600 15px/1.2 var(--font-sans);
  color: var(--fg);
}
body.editorial-calm .deploy-surface-card__desc {
  font: 400 12.5px/1.45 var(--font-sans);
  color: var(--fg-muted);
}
body.editorial-calm .deploy-surface-card__status {
  margin-top: 6px;
  font: 600 10.5px/1 var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
body.editorial-calm .deploy-surface-card__status.is-active { color: var(--accent); }
body.editorial-calm .deploy-surface-card__status.is-empty { color: var(--fg-muted); }
@media (max-width: 920px) {
  body.editorial-calm .deploy-surface-cards { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════════════════════════════════════════════════════════════════
   Scoped Settings page — Workspace + each Space, with a left scope rail.
   The Workspace pane is the existing settings markup; the Space pane is the
   lifted space-settings modal, rendered as a page card.
   ═══════════════════════════════════════════════════════════════════════ */
body.editorial-calm .settings-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
/* The panes column must take the available width, not be sized by content —
   otherwise the wide Workspace pane stretches the column (and overflows) while
   the narrower Space form gets a smaller column. minmax(0,1fr) + min-width:0
   pins both panes to the same width. */
body.editorial-calm .settings-panes { min-width: 0; }
body.editorial-calm .settings-scope {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 24px;
}
body.editorial-calm .settings-scope__heading {
  font: 500 10px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 16px 0 4px 10px;
}
body.editorial-calm .settings-scope__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--fg-body);
  font: 500 13.5px/1.2 var(--font-sans);
  text-align: left;
  cursor: pointer;
  transition: background var(--duration-fast, 0.15s) var(--easing-standard, ease);
}
body.editorial-calm .settings-scope__item:hover { background: var(--bg-secondary); }
body.editorial-calm .settings-scope__item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
body.editorial-calm .settings-scope__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--border-strong, #cbd5e1);
  flex-shrink: 0;
}
body.editorial-calm .settings-scope__item.is-active .settings-scope__dot { background: var(--accent); }
body.editorial-calm .settings-scope__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.editorial-calm .settings-scope__empty { color: var(--fg-muted); font-size: 13px; padding: 8px 10px; }

body.editorial-calm .settings-pane:not(.is-active) { display: none; }

/* Neutralize the modal overlay so the lifted space-settings markup renders as a
   normal page card (and inherits all the .modal-overlay .ec-spm styles). */
body.editorial-calm .settings-pane .settings-spm-host.modal-overlay {
  position: static;
  inset: auto;
  width: auto;
  height: auto;
  background: transparent;
  display: block;
  z-index: auto;
  padding: 0;
  overflow: visible;
}
body.editorial-calm .settings-pane .settings-spm-host .modal-content {
  width: 100%;
  max-width: none;        /* fill the panes column like the Workspace pane */
  max-height: none;
  box-shadow: var(--shadow-1);
}

@media (max-width: 760px) {
  body.editorial-calm .settings-layout { grid-template-columns: 1fr; }
  body.editorial-calm .settings-scope { position: static; flex-direction: row; flex-wrap: wrap; }
}

/* ═══════════════════════════════════════════════════════════════════════
   Settings page polish — fixes inherited from legacy styles.css that read
   as unfinished on the Workspace settings cards (Billing, Smart Chat, etc.).
   Scoped to .settings-pane so other pages' cards/buttons are untouched.
   ═══════════════════════════════════════════════════════════════════════ */

/* styles.css sets `.btn-primary { width: 100% }` globally. Full-width is right
   for CTAs/modal submits (which use plain `.btn-primary`), but small primary
   buttons are inline actions (Save, Add) and were ballooning to full width.
   The `btn-sm` variant is never a full-width CTA, so scope the reset to it. */
body.editorial-calm .settings-pane .btn-primary.btn-sm { width: auto; }
body.editorial-calm .settings-pane .btn.btn-sm { white-space: nowrap; }

/* styles.css `.card h3` adds a 3px var(--light) underline + padding that the
   editorial layer never reset — it renders as a faint stray line sitting above
   the real 1px card-header divider. Remove it; spacing comes from the heading
   margin already set above. Other pages (analytics chart cards, etc.) keep
   their heading treatment — scope to the settings panes only. */
body.editorial-calm .settings-pane .card h2,
body.editorial-calm .settings-pane .card h3 {
  border-bottom: none;
  padding-bottom: 0;
}

/* Right-aligned action row at the foot of a settings card. */
body.editorial-calm .ec-form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* Credit-pack tier icons are now Lucide SVGs (was emoji) — tint with the brand
   accent and center them in the card. */
body.editorial-calm .credit-pack-icon {
  color: var(--accent);
  display: flex;
  justify-content: center;
  align-items: center;
  line-height: 1;
}

/* Space settings — Members section parity polish.
   A count chip beside the "Members" label (mirrors the workspace roster's
   member count) and a bare roster (drops the grey tint box) so the bordered
   member cards read cleanly on the card background, like the workspace roster. */
.modal-overlay .ec-spm-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  margin-left: 8px;
  border-radius: 999px;
  background: var(--bg-secondary);
  color: var(--fg-muted);
  font: 600 11px/1 var(--font-sans);
}
.modal-overlay .ec-spm-panel--bare {
  background: transparent;
  border: 0;
  padding: 0;
}

/* ═══════════════════════════════════════════════════════════════════════
   Dashboard polish — classes that replace JS inline-style assignments
   (progress-bar colors, admin team-name, type-row bar width) + a stats
   loading skeleton. See dashboard.js.
   ═══════════════════════════════════════════════════════════════════════ */

/* Usage progress-bar state colors (was set via element.style.backgroundColor). */
body.editorial-calm .ec-progress--success .progress-bar-fill { background: var(--color-success); }
body.editorial-calm .ec-progress--warning .progress-bar-fill { background: var(--color-warning); }
body.editorial-calm .ec-progress--danger  .progress-bar-fill { background: var(--color-danger); }

/* Static files-by-type bar width via a custom property (was inline style="width:N%"). */
body.editorial-calm .ec-type-row__bar .progress-bar-fill { width: var(--bar-w, 0%); }

/* Sidebar workspace name when a platform admin is viewing another workspace
   (was three inline styles using the undefined --primary token). */
body.editorial-calm .team-name--admin-view {
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
}

/* Stats loading skeleton — shimmer placeholders shown while dashboard stats
   are in flight, swapped for the real grid on load. */
body.editorial-calm .ec-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
body.editorial-calm .ec-skeleton {
  height: 96px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(100deg, var(--bg-elevated) 30%, var(--bg-secondary) 50%, var(--bg-elevated) 70%);
  background-size: 200% 100%;
  animation: ec-skeleton-shimmer 1.3s ease-in-out infinite;
}
@keyframes ec-skeleton-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  body.editorial-calm .ec-skeleton { animation: none; }
}

/* Dashboard Communication cards are links — keep the .ec-card look, drop the
   anchor underline, add a hover lift like the clickable stat cards. */
body.editorial-calm a.ec-card--link {
  text-decoration: none;
  color: inherit;
  transition: border-color var(--duration-fast) var(--easing-standard),
              box-shadow var(--duration-fast) var(--easing-standard);
}
body.editorial-calm a.ec-card--link:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-1);
}

/* Dashboard Sources card — per-channel surfaces + conversation activity. */
body.editorial-calm .ec-sources-list { display: flex; flex-direction: column; margin-top: 6px; }
body.editorial-calm .ec-source-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-top: 1px solid var(--border);
}
body.editorial-calm .ec-source-row:first-child { border-top: none; }
body.editorial-calm .ec-source-name { font: 600 12.5px/1.4 var(--font-sans); color: var(--fg); }
body.editorial-calm .ec-source-detail {
  font: 500 11.5px/1.4 var(--font-mono);
  letter-spacing: 0.02em;
  color: var(--fg-muted);
  text-align: right;
}
body.editorial-calm .ec-source-row--empty { color: var(--fg-muted); justify-content: flex-start; font-size: 12.5px; }

/* "Where things stand": middle column stacks Usage + Chat so the section stays
   a clean 3-column row. The two compact cards flex to fill the column height,
   keeping the stack level with the standard cards on either side. */
body.editorial-calm .ec-overview-split {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
body.editorial-calm .ec-overview-split > .ec-card {
  flex: 1;
  margin: 0;
  padding: 16px 22px;
}
