/* Workspace surfaces and interactive states */
.crm-delete-message-dialog { margin: auto; max-width: calc(100vw - 32px); color: var(--ink); }
.crm-delete-message-dialog::backdrop { background: rgba(12, 23, 27, .65); }
.crm-delete-message-dialog [data-confirm-delete] { background: #9d352d; border-color: #9d352d; color: white; }
:root {
  --bg: #101a20;
  --panel: #19262d;
  --panel-strong: #203038;
  --surface: #1b2931;
  --surface-soft: #23333b;
  --field: #142128;
  --ink: #edf4f3;
  --muted: #adc0c3;
  --line: #35464d;
  --shadow: 0 3px 12px rgba(0, 0, 0, .14);
  --accent-ink: #93e0cb;
}
html[data-theme="light"] {
  --bg: #f3f6f6;
  --panel: #fff;
  --panel-strong: #f4f8f7;
  --surface: #fff;
  --surface-soft: #f2f6f5;
  --field: #fff;
  --ink: #192c32;
  --muted: #51676e;
  --line: #d5e0e0;
  --shadow: 0 2px 6px rgba(23, 49, 53, .045);
  --accent-ink: #116650;
}
:root:not([data-accent]), html[data-accent="green"] {
  --accent: #08735c;
  --accent-strong: #065846;
  --accent-soft: color-mix(in srgb, #32ac87 14%, transparent);
  --button-gradient: linear-gradient(#08735c, #08735c);
  --button-gradient-hover: linear-gradient(#075c4a, #075c4a);
}
html[data-accent]:not([data-accent="green"]) {
  --accent-ink: color-mix(in srgb, var(--accent), var(--ink) 35%);
}
body:has(.page-shell, .workspace-shell, .mobile-directory-page) {
  background: var(--bg);
  color: var(--ink);
}
.workspace-main, .page-shell > :not(.app-rail), .board-card, .workspace-view > * { min-width: 0; }
.workspace-topbar, .page-shell .memory-topbar {
  align-self: start;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 8px 0 16px;
}
:is(.workspace-topbar, .page-shell .memory-topbar) h1 {
  color: var(--ink);
  font-size: clamp(1.5rem, 1.4vw + .65rem, 2.15rem);
  line-height: 1.12;
  letter-spacing: -.035em;
  font-weight: 700;
}
:is(.workspace-topbar, .page-shell .memory-topbar) .eyebrow {
  color: var(--muted);
  font-size: .72rem;
  letter-spacing: .09em;
  margin-bottom: 5px;
}
.board-card, .page-shell :is(.crm-table-board, .lead-info-card), .agent-hub-header {
  border-color: var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.board-card h2, .agent-hub h2, .settings-panel-grid h2 { letter-spacing: -.025em; }
.settings-note { color: var(--muted); line-height: 1.5; }
button, input, select, textarea { font-family: inherit; }
button:not(:disabled), a[href], summary { -webkit-tap-highlight-color: transparent; }
:where(button, a, input, select, textarea, summary):focus-visible {
  outline: 3px solid #3da38d !important;
  outline-offset: 2px;
}
:is(.refresh, .send, .rail-button, .workspace-shortcuts a, .overview-banner-actions a, .workflow-filters button) {
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.refresh, .send.compact-send { border-radius: 8px; font-weight: 650; }
.refresh:hover:not(:disabled) { border-color: var(--accent); }
/* Pair light surfaces with dark labels, including the nested icon labels. */
html[data-theme="light"] :is(.refresh,.icon-button,.crm-email-mode-button,.crm-email-mode-button.active) {
  background: var(--surface-soft);
  color: var(--ink);
  border-color: var(--line);
}
html[data-theme="light"] :is(.refresh,.icon-button,.crm-email-mode-button) :is(span,small,strong) { color: inherit; }
html[data-theme="light"] :is(.refresh,.icon-button):disabled { color: #51676e; opacity: .7; }
html[data-theme="light"] #globalAskAiButton { background: #075d4b; color: #fff; border-color: #075d4b; }
html[data-theme="light"] #globalAskAiButton span { color: #fff; }
html[data-theme="light"] #crmThreadHeader .crm-mobile-thread-actions :is(.icon-button,a) {
  background: var(--surface-soft); color: var(--ink); border-color: var(--line);
}
html[data-theme="light"] .social-queue-media.social-preview-trigger { background: var(--surface-soft); color: var(--ink); }
html[data-theme="light"] .social-queue-media.social-preview-trigger:not(:has(img,video)) span { color: var(--ink); background: transparent; }
html[data-theme="light"] .ghl-opportunity-card footer button { color: #51676e; }
html[data-theme="light"] button[aria-label="Collapse stage"] { color: #51676e; }
html[data-theme="light"] :is(.crm-side-panel-card,.crm-profile-side-card) { color: var(--ink); }
html[data-theme="light"] :is(.crm-side-panel-card,.crm-profile-side-card) :is(h3,strong,button,a) { color: var(--ink); }
html[data-theme="light"] :is(.crm-side-panel-card,.crm-profile-side-card) :is(p,small,span) { color: var(--muted); }
html[data-theme="light"] .crm-side-icon-rail button { color: var(--ink); }
html[data-theme="light"] .crm-side-icon-rail button:is(.active,:hover) { color: var(--accent-ink); }
.send:not(:disabled):hover { box-shadow: 0 2px 8px #0d594f36; }
:where(button:disabled) { cursor: not-allowed; }
@media (min-width: 1101px) {
  .workspace-shell, .page-shell.memory-shell, body.settings-rail-open .workspace-shell {
    grid-template-columns: 188px minmax(0, 1fr);
    column-gap: clamp(18px, 2vw, 32px);
    padding: 14px clamp(18px, 2vw, 32px) 22px 12px;
  }
  html[data-theme] .workspace-shell .app-rail, html[data-theme] .page-shell .app-rail {
    top: 14px;
    height: calc(100dvh - 28px);
    align-self: start;
    border: 0;
    background: #142c30;
    border-radius: 16px;
    padding: 14px 10px;
    box-shadow: none;
  }
  .app-rail .rail-account-top {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding-left: 4px;
  }
  .app-rail .account-avatar::after {
    content: "6 Figur Chat";
    color: #f1faf7;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -.035em;
    pointer-events: none;
  }
  .app-rail .account-avatar { display: flex; align-items: center; gap: 10px; width: auto; height: 40px; margin: 0; padding: 0; border: 0; box-shadow: none; background: transparent; color: #c0f6df; }
  .app-rail .account-avatar span { display: grid; place-items: center; min-width: 36px; height: 36px; border-radius: 10px; background: #214b47; border: 1px solid #467469; }
  .app-rail .rail-nav { border-color: #345054; gap: 3px; scrollbar-width: thin; scrollbar-color: #436064 transparent; }
  .app-rail .primary-rail-nav .rail-button:not(.crm-mobile-main-only) {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    padding: 7px 12px;
    min-height: 35px;
    color: #c6d5d7;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    text-align: left;
  }
  .app-rail .primary-rail-nav .rail-button.active,
  .app-rail .primary-rail-nav .rail-button:hover { background: #26464a; color: white; }
  .app-rail .primary-rail-nav .rail-button.active { border-color: #3f6265; }
  .app-rail .rail-button small { color: inherit; font-size: 13px; font-weight: 550; white-space: nowrap; }
  .app-rail .rail-button .rail-icon, .app-rail .rail-icon svg { width: 18px; height: 18px; flex: none; stroke-width: 1.7; }
  .app-rail .settings-rail-title, .app-rail .settings-tab-button { color: #eff7f5; }
  .app-rail .settings-tab-button.active, .app-rail .settings-tab-button:hover { background: #26464a; }
  .app-rail .account-menu { z-index: 130; }
  .workspace-topbar { grid-template-columns: minmax(150px, 1fr) minmax(220px, 440px) auto; }
}

/* The same overview, metrics and destinations are available on both layouts. */
#homeView.active { gap: clamp(14px, 1.45vw, 24px); }
.overview-banner {
  display: flex;
  align-items: center;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 202px;
  padding: clamp(22px, 2.5vw, 40px);
  border-radius: 18px;
  background: #102d2b;
  color: #fff;
}
.overview-banner::before {
  content: "";
  z-index: -1;
  position: absolute;
  inset: 0 0 0 30%;
  background: linear-gradient(90deg, #102d2b, transparent 28%), url("/images/workspace-glass.webp") right 50% / cover no-repeat;
}
.overview-banner h2 { margin: 0; font-size: clamp(1.75rem, 2.4vw, 2.7rem); line-height: 1.1; letter-spacing: -.047em; color: #fff; }
.overview-banner p { max-width: 41ch; margin: 10px 0 20px; color: #d1e2dc; line-height: 1.5; }
.overview-banner-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.overview-banner-actions a { display: inline-flex; align-items: center; gap: 14px; min-height: 40px; padding: 8px 15px; border-radius: 8px; font-size: .88rem; font-weight: 650; background: #c6f2da; color: #12392e; }
.overview-banner-actions a + a { background: #173c39; color: #f0f8f5; border: 1px solid #557770; }
.overview-banner-actions a:hover { box-shadow: 0 0 0 2px #e0ffef; }
#homeView .overview-metrics { gap: 12px; }
#homeView .overview-metrics article {
  position: relative;
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 98px;
  padding: 16px 48px 16px 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
#homeView .overview-metrics article > span { color: var(--muted); font-size: .82rem; font-weight: 600; }
#homeView .overview-metrics article > strong { margin: 0; color: var(--ink); font-size: 1.68rem; letter-spacing: -.04em; overflow-wrap: anywhere; }
#homeView .overview-metrics article > small { font-size: .75rem; color: var(--muted); line-height: 1.35; }
#homeActivity { display: grid; gap: 12px; align-content: start; }
#homeActivity [hidden] { display: none; }
.activity-heading, .activity-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.activity-heading select, .activity-footer button { min-height: 36px; width: auto; max-width: 100%; padding: 5px 10px; color: var(--ink); border: 1px solid var(--line); background: var(--panel); border-radius: 8px; font: inherit; font-size: .8rem; }
.activity-heading p, .activity-empty { margin: 4px 0 0; color: var(--muted); font-size: .8rem; }
.activity-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; align-items: end; list-style: none; margin: 2px 0; padding: 0; }
.activity-days li { display: grid; justify-items: center; gap: 5px; min-width: 0; }
.activity-days strong, .activity-days time { font-size: .72rem; line-height: 1.25; font-variant-numeric: tabular-nums; color: var(--ink); text-align: center; overflow-wrap: anywhere; }
.activity-days time { color: var(--muted); }
.activity-track { display: flex; align-items: end; justify-content: center; width: 100%; height: 67px; border-bottom: 1px solid var(--line); }
.activity-track i { display: block; width: min(46%, 26px); border-radius: 4px 4px 0 0; background: var(--accent-ink); }
.activity-footer { padding-top: 7px; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.activity-footer button { cursor: pointer; }
.overview-metric-icon, .workspace-shortcuts i {
  display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: 9px; background: var(--accent-soft); color: var(--accent-ink);
}
.overview-metric-icon { position: absolute; top: 14px; right: 12px; }
[data-workspace-icon] svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; fill: none; }
#homeView .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
#homeView .home-grid > article { grid-column: auto; padding: clamp(16px, 1.6vw, 24px); }
#homeView .home-grid h2 { font-size: 1.17rem; margin: 0; }
.workspace-shortcuts a { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.workspace-shortcuts a:last-child { border: 0; }
.workspace-shortcuts a::after { content: "›"; margin-left: auto; padding: 4px; color: var(--muted); font-size: 22px; }
.workspace-shortcuts a:hover { background: var(--surface-soft); }
.workspace-shortcuts a strong, .workspace-shortcuts a small { display: block; }
.workspace-shortcuts a small { margin-top: 2px; color: var(--muted); line-height: 1.4; }
#homeView .mobile-home-panel { display: none; }
@media (max-width: 900px) {
  #homeView .home-grid { grid-template-columns: minmax(0,1fr); }
  #homeView .overview-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 720px) {
  .home-page.mobile-shell-ready .workspace-shell,
  .home-page.mobile-shell-ready .workspace-main,
  body.mobile-shell-ready { background: var(--bg); }
  .home-page.mobile-shell-ready .mobile-home-dashboard { min-height: 0; padding: 16px 0; background: transparent; }
  .mobile-home-dashboard .mobile-app-header { margin: 0; }
  .home-page.mobile-shell-ready #homeView.active { display: grid !important; }
  #homeView .mobile-home-panel { display: block; background: var(--panel); border-color: var(--line); margin: 0; }
  .mobile-section-title h2, .mobile-home-panel .mobile-app-grid small { color: var(--ink); }
  .mobile-section-title a { color: var(--accent-ink); }
  .overview-banner { min-height: 184px; padding: 20px; }
  .overview-banner::before { inset-inline-start: 18%; opacity: .45; }
  .overview-banner p { max-width: 28ch; }
  #homeView .overview-metrics article { min-height: 98px; padding: 40px 12px 12px; gap: 3px; }
  #homeView .overview-metrics article strong { font-size: 1.4rem; }
  .overview-metric-icon { top: 9px; left: 12px; height: 25px; width: 25px; }
  .overview-metric-icon svg { width: 15px; height: 15px; }
  .mobile-brand-lockup, .mobile-header-actions a { color: var(--ink); }
  .mobile-bottom-nav { background: #142c30; min-height: 64px; padding-inline: 5px; }
  .mobile-bottom-nav .mobile-bottom-nav-item { color: #d1dedc; }
  .page-shell .memory-topbar { gap: 10px; }
  .page-shell .memory-actions { flex-wrap: wrap; }
}
/* Workflow library, canvas and editor */
.automations-page-shell .automation-app { min-width: 0; align-content: start; }
.automations-page-shell .automation-list-page { padding: clamp(16px, 2vw, 30px); gap: 18px; }
.automation-list-header { gap: 22px; margin: 0; }
.automation-list-title { flex-wrap: wrap; gap: 14px; }
.automation-workflow-summary { gap: 10px; }
.automation-summary-card { min-width: 0; padding: 14px; border-radius: 12px; background: var(--surface-soft); align-content: start; }
.automation-summary-card strong { color: var(--ink); font-size: 1.45rem; letter-spacing: -.035em; }
.automation-summary-card:last-child strong { font-size: .95rem; line-height: 1.4; }
.workflow-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.workflow-filters { display: inline-flex; padding: 3px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; }
.workflow-filters button { background: transparent; color: var(--muted); border: 1px solid transparent; border-radius: 7px; min-height: 35px; padding: 5px 12px; font-size: .85rem; font-weight: 600; cursor: pointer; }
.workflow-filters button[aria-pressed="true"] { background: var(--panel); color: var(--ink); border-color: var(--line); box-shadow: var(--shadow); }
.workflow-toolbar .automation-search { display: block; flex: 0 1 280px; }
.automation-workflow-card { border-radius: 12px; padding: 16px; align-items: center; }
.automation-workflow-card.active, .automation-workflow-card:hover { border-color: color-mix(in srgb, var(--accent) 48%, var(--line)); background: var(--surface); }
.automation-workflow-card-top strong { font-size: 1.03rem; line-height: 1.4; }
.automation-workflow-card-stats { border-top: 1px solid var(--line); padding-top: 8px; }
.automation-workflow-card-stats span { border: 0; padding: 0; background: transparent; }
.automation-workflow-card-actions { padding: 2px; }
.automation-workflow-list { overflow: visible; }
.workflow-empty { padding: 28px 18px; border: 1px dashed var(--line); background: var(--surface-soft); text-align: center; }
.workflow-empty strong { color: var(--ink); font-size: 1.05rem; }
.workflow-empty p { max-width: 48ch; margin: 7px auto 0; line-height: 1.55; }
.automation-builder-header { padding-block-end: 12px; }
.automation-builder-mode, .automation-publish-switch { flex-shrink: 0; }
.automation-canvas, .flow-canvas-stage {
  background-color: var(--surface-soft);
  background-image: radial-gradient(circle, color-mix(in srgb, var(--muted) 35%, transparent) 1px, transparent 1px);
  background-size: 18px 18px;
}
.automation-node-card, .automation-flow-node, .flow-standard-node-card {
  background: var(--panel); border-color: var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.automation-node-card.trigger, .automation-flow-node.trigger { border-inline-start: 4px solid #519e7d; }
.automation-node-card.action, .automation-flow-node.action { border-inline-start: 4px solid #7396c6; }
.automation-node-card.active, .automation-flow-node.active { outline: 2px solid var(--accent); }
.automation-node-drawer, .automation-inspector, .node-palette {
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 14px;
}
.automation-workspace .automation-node-drawer { width: min(365px, calc(100% - 24px)); }
.automation-drawer-ai, .flow-canvas-ai-builder { gap: 12px; }
.automation-prompt-label { display: block; font-size: .82rem; color: var(--muted); font-weight: 650; }
:is(.automation-drawer-ai, .flow-canvas-ai-builder) textarea { width: 100%; min-height: 100px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--field); color: var(--ink); font: inherit; line-height: 1.5; }
.automation-drawer-ai .automation-template-row { display: flex; flex-wrap: wrap; gap: 5px; }
.automation-drawer-ai .automation-template-row button { width: auto; min-height: 32px; border-radius: 20px; padding: 4px 10px; background: var(--surface-soft); color: var(--ink); }
@media (max-width: 1000px) {
  .automation-workflow-card { grid-template-columns: minmax(0,1fr); }
  .automation-workflow-card-actions { justify-content: flex-start; }
  .automation-execution-table .automation-execution-table-row { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 720px) {
  .automations-page-shell .automation-list-page { padding: 14px; }
  .automation-workflow-summary { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .automation-summary-card { padding: 10px; }
  .automation-summary-card:last-child { grid-column: 1/-1; display: flex; justify-content: space-between; align-items: center; }
  .workflow-toolbar .automation-search { flex: 1 1 100%; }
  .workflow-filters button { padding-inline: 10px; min-height: 40px; }
  .automation-workflow-card-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .automation-list-actions { justify-content: flex-start; }
  .automation-builder-header, .automation-builder-actions { flex-wrap: wrap; }
  .automation-title-edit input { width: 100%; }
  .automation-builder-page, .automation-main, .automation-workspace, .automation-canvas { min-width: 0; }
  .automation-node-drawer, .automation-inspector { overscroll-behavior: contain; }
  .automation-workspace .automation-node-drawer, .automation-builder-page .automation-inspector {
    position: fixed; top: auto; left: 8px; right: 8px; bottom: calc(78px + env(safe-area-inset-bottom));
    width: auto; max-height: 67dvh; margin: 0; z-index: 1210; overflow-y: auto; box-shadow: 0 4px 45px #12282e44;
  }
}
/* Directory routes also work as desktop destinations. */
.mobile-directory-page { width: min(100%, 900px); margin: auto; padding: clamp(18px,4vw,44px) 20px 100px; background: var(--bg); color: var(--ink); }
.mobile-directory-page :is(.mobile-app-header,.mobile-page-titlebar), .mobile-app-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.mobile-directory-page :is(.mobile-app-header,.mobile-page-titlebar) { margin-bottom: 20px; }
.mobile-page-titlebar h1 { flex: 1; margin: 0; color: var(--ink); font-size: 1.65rem; }
.mobile-directory-page svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mobile-directory-page :is(.mobile-back-link,.mobile-icon-action), .mobile-app-header .mobile-icon-action { display: inline-grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); }
.mobile-directory-page .mobile-header-actions { display: flex; gap: 8px; }
.mobile-directory-page .mobile-search-box { display: flex; align-items: center; gap: 10px; padding: 0 12px; border: 1px solid var(--line); background: var(--field); color: var(--muted); border-radius: 10px; min-height: 44px; }
.mobile-directory-page .mobile-search-box input { border: 0; background: transparent; color: var(--ink); flex: 1; min-width: 0; font-size: 1rem; }
.mobile-directory-page .mobile-app-directory { display: grid; gap: 14px; margin-top: 16px; }
.mobile-directory-page .mobile-app-directory-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.mobile-directory-page .mobile-app-directory-card h2 { margin: 0 0 14px; font-size: 1.05rem; color: var(--ink); }
.mobile-directory-page .mobile-app-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(110px,100%),1fr)); gap: 8px; }
.mobile-directory-page .mobile-app-grid a { border: 1px solid var(--line); border-radius: 9px; padding: 10px 6px; color: var(--ink); text-align: center; }
.mobile-directory-page .mobile-app-grid small { font-size: .85rem; color: inherit; }
.mobile-directory-page .mobile-app-grid a:hover, .mobile-directory-page .mobile-search-result:hover { background: var(--accent-soft); border-color: var(--accent); }
.mobile-directory-page .mobile-search-results { display: grid; gap: 8px; margin-top: 16px; }
.mobile-directory-page .mobile-search-result { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); padding: 12px; color: var(--ink); }
.mobile-directory-page .mobile-search-result small { margin-left: auto; color: var(--muted); }
.mobile-directory-page .mobile-notification-list article { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.mobile-directory-page .mobile-notification-list :is(small,time) { color: var(--muted); }
.mobile-directory-page .mobile-notification-list p { color: var(--ink); }
.workspace-control .workspace-copy strong { color: var(--ink); }
.workspace-control .workspace-copy small { display: block; color: var(--muted); }
@media (min-width:721px) {
  .mobile-directory-page .mobile-search-result > span:empty { display: none; }
  .mobile-directory-page .workspace-control .mobile-brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; color: #eafff2; background: #215449; }
}
@media (max-width:720px) {
  .mobile-directory-page .mobile-app-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .mobile-directory-page .mobile-app-grid a { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .workspace-shortcuts a, .overview-banner-actions a, .workflow-filters button, .rail-button, .refresh, .send { transition: none; }
}
.workspace-status { position: relative; color: var(--muted); font-size: .85rem; }
.workspace-status summary { cursor: pointer; padding: 8px; }
.workspace-status .status { position: absolute; z-index: 30; right: 0; top: 100%; margin-top: 6px; width: min(310px,70vw); border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: var(--shadow); padding: 14px; line-height: 1.5; color: var(--ink); white-space: normal; }
#homeView .metric-bar-track > span { min-width: 0; }
.notification-destinations { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.notification-destinations a { padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--accent-ink); font-weight: 600; }
#calendarNotifications, #playbook-notifications { padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.mobile-directory-page .mobile-notification-list { display: block; color: var(--ink); }
.mobile-directory-page .mobile-notification-list h2 { font-size: 1.05rem; margin: 20px 0 10px; }
#calendarNotifications article { display: block; padding: 10px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.directory-empty { color: var(--muted); padding: 14px; }
body.auth-page {
  color: #eef7f4;
  background: radial-gradient(ellipse at 74% 12%,#204842,transparent 46%), #10252a;
}
.auth-shell .auth-card { background: #f8fbfa; color: #172e32; border-color: #d6e2df; box-shadow: 0 15px 55px #091d2250; }
.auth-shell .auth-card p, .auth-shell .auth-form span { color: #475f60; }
.auth-shell .auth-form input { background: #fff; border: 1px solid #b9cac9; color: #172e32; border-radius: 9px; }
.auth-shell .auth-badge, .auth-shell .auth-button { background: #096852; color: white; border-radius: 10px; }
@media (max-width:720px) {
  .marketing-product-page.mobile-shell-ready .marketing-app-topbar,
  .marketing-product-page.mobile-shell-ready .marketing-product-tabs { position: static; }
  .mobile-shell-ready .crm-topbar .memory-actions { min-width: 0; max-width: 100%; }
  .crm-page-shell .crm-tabs, .agent-hub-tabs, .agent-subtabs { overscroll-behavior-inline: contain; }
}
.content-agent-panels { display: none; }
.content-agent-builder { border-radius: 14px; }
@media (max-width: 900px) {
  .content-agent-builder { min-height: 0; }
  .content-agent-panels { display: flex; gap: 8px; padding: 9px 12px; background: #162927; }
  .content-agent-panels button { min-height: 38px; padding: 6px 12px; background: #213a36; color: #ebf7f1; border: 1px solid #536c63; border-radius: 8px; }
  .content-agent-panels button[aria-expanded="true"] { background: #c6f2da; color: #12392e; }
  .content-agent-builder .content-agent-workspace { display: flex; flex-direction: column; min-height: 0; }
  .content-agent-builder :is(.content-agent-palette,.content-agent-inspector) { display: none; flex: none; width: 100%; max-height: 45dvh; overflow-y: auto; }
  .content-agent-builder .panel-open { display: block; order: -1; }
  .content-agent-builder .content-agent-canvas-shell { min-width: 0; width: 100%; min-height: 380px; }
  .content-agent-builder .content-agent-topbar { flex-wrap: wrap; }
  .content-agent-builder .content-agent-actions { display: flex; flex-wrap: wrap; gap: 6px; }
  .content-agent-builder .content-agent-actions button { width: auto; min-width: 54px; }
}
@media (max-width: 720px) {
  body.settings-rail-open .settings-tabs {
    display: flex; position: static; gap: 5px; max-width: 100%; overflow-x: auto;
    scrollbar-width: thin; border: 0; background: transparent; padding: 3px 1px 8px;
  }
  .settings-tabs .settings-tab-button { display: flex; gap: 6px; align-items: center; flex: none; width: auto; min-height: 40px; padding: 5px 10px; border: 1px solid var(--line); background: var(--panel); }
  .settings-tabs .settings-tab-button span { display: none; }
  .settings-tabs .settings-tab-button.active { background: var(--accent-soft); border-color: var(--accent); }
  .automations-page-shell .automations-topbar { padding: 12px; }
  .automations-page-shell .automation-builder-top-actions { display: flex; flex-wrap: wrap; gap: 5px; width: 100%; align-items: center; }
  .automations-page-shell .automation-builder-top-actions > button,
  #flowBuilderModal .flow-builder-header-actions > button { min-width: 0; width: auto; min-height: 36px; padding: 5px 10px; font-size: .8rem; }
  .automation-builder-top-actions > [data-automation-view] { flex: 1; }
  .automation-builder-top-actions .automation-publish-switch { margin-right: auto; }
  .automation-builder-header { display: grid; gap: 8px; }
  .automation-builder-header > div:first-child { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
  .automation-builder-header .eyebrow { margin: 0; }
  .automation-builder-header .automation-title-edit { display: flex; align-items: center; flex: 1 0 100%; min-width: 0; }
  .automation-title-edit input { flex: 1; min-width: 0; }
  .automation-title-edit .refresh { width: auto; white-space: nowrap; }
  .automation-builder-header .automation-builder-actions,
  #flowBuilderModal .flow-builder-canvas-actions { display: flex; flex-wrap: wrap; width: 100%; gap: 5px; justify-content: flex-start; align-items: center; }
  :is(.automation-builder-header .automation-builder-actions, #flowBuilderModal .flow-builder-canvas-actions) > :is(button,div) { flex: 0 0 auto; width: auto; min-width: 0; min-height: 36px; }
  :is(.automation-builder-header .automation-builder-actions, #flowBuilderModal .flow-builder-canvas-actions) > button { padding: 5px 9px; font-size: .8rem; white-space: nowrap; }
  body:has(#flowBuilderModal:not([hidden])) .mobile-bottom-nav { display: none !important; }
  #flowBuilderModal { padding: 0; }
  #flowBuilderModal .flow-builder-modal { width: 100%; max-width: none; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; }
  #flowBuilderModal .flow-builder-title { display: grid; position: relative; gap: 8px; padding: 12px; justify-content: stretch; }
  #flowBuilderModal .flow-builder-title > div:first-child { padding-right: 44px; }
  #flowBuilderModal .flow-builder-header-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 5px; }
  #flowBuilderModal .flow-studio-tabs { display: flex; flex: 1 0 100%; gap: 4px; justify-content: flex-start; }
  #flowBuilderModal .flow-studio-tabs button { flex: 1; min-width: 0; min-height: 36px; padding: 5px 7px; font-size: .8rem; }
  #flowBuilderModal #closeFlowBuilder { position: absolute; right: 8px; top: 6px; width: 38px; }
  #flowBuilderModal .node-board-header { display: flex; flex-wrap: wrap; gap: 6px 12px; padding: 9px 12px; }
  #flowBuilderModal .node-board-header > div:first-child { flex: 1; }
  #flowBuilderModal .node-board-tools { display: flex; flex-wrap: wrap; gap: 4px; }
  #flowBuilderModal .node-board-header small { font-size: .77rem; }
  #flowBuilderModal .node-palette { width: min(345px, calc(100vw - 24px)); max-height: 65dvh; overflow-y: auto; }
}
.workflow-view-tabs { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
@media (max-width: 720px) {
  .automations-page-shell .workflow-view-tabs { flex: 1 0 100%; }
  .automations-page-shell .workflow-view-tabs button { width: auto; flex: 1; min-width: max-content; min-height: 36px; padding: 6px 8px; font-size: .8rem; }
  .automations-page-shell .automation-builder-actions, .automations-page-shell .automation-title-edit { flex-direction: row; }
  .automations-page-shell .automation-builder-actions { justify-content: flex-start; }
  .automations-page-shell .automation-builder-top-actions .automation-publish-switch { margin: 0; }
  .automations-page-shell .automations-topbar { position: relative; }
  .automations-page-shell .automations-topbar .global-ask-ai-button { position: absolute; inset: 8px 8px auto auto; }
  #flowBuilderModal.build-mode .flow-builder-title { grid-template-columns: minmax(0,1fr); }
  #flowBuilderModal.build-mode .flow-builder-header-actions { grid-column: 1; justify-content: flex-start; }
  #flowBuilderModal.build-mode .flow-studio-tabs-inline { width: 100%; }
  #flowBuilderModal.build-mode #closeFlowBuilder { position: absolute; }
  #flowBuilderModal.build-mode .node-board-header { display: flex; flex-flow: row wrap; }
  #flowBuilderModal.build-mode .flow-builder-canvas-actions { flex-flow: row wrap; justify-content: flex-start; }
  #flowBuilderModal.build-mode .node-board-tools { width: auto; margin-left: auto; }
  #flowBuilderModal.build-mode .flow-canvas-minimap { max-width: 82px; max-height: 65px; }
}
.page-shell .memory-topbar .memory-actions { min-width: 0; max-width: 100%; flex-wrap: wrap; }
.analytics-main, .analytics-table-card { min-width: 0; }
.analytics-table-card { overflow-x: auto; }
@media (min-width:721px) and (max-width:1150px) {
  .native-calendar-board .native-month-grid { grid-template-columns: repeat(7,minmax(0,1fr)); }
  .native-month-day { min-width: 0; overflow-wrap: anywhere; }
}
.content-agent-canvas-shell { display: flex; flex-direction: column; }
.content-agent-canvas-shell .content-agent-canvas-toolbar { position: static; flex-wrap: wrap; flex: none; width: 100%; margin: 0; border-radius: 0; }
.content-agent-viewport { position: relative; flex: 1; min-width: 0; min-height: 410px; max-height: 74dvh; overflow: auto; overscroll-behavior: contain; }
.content-agent-viewport .content-agent-canvas { min-width: 100%; min-height: 100%; }
.content-agent-viewport.panning { cursor: grab; touch-action: none; }
.content-agent-viewport.panning :is(.content-agent-node-layer,.content-agent-edges) { pointer-events: none; }
.content-agent-viewport.panning * { cursor: grab; }
@media (max-width: 900px) {
  .content-agent-viewport { min-height: 54dvh; }
  .content-agent-builder .content-agent-minimap { display: none; }
}
@media (max-width:720px) {
  .crm-mobile-contact-row { min-height: 76px; border-color: var(--line); }
  .crm-mobile-contact-row strong, .crm-mobile-detail-row strong { color: var(--ink); }
  .crm-mobile-detail-row span { color: var(--muted); }
  [data-crm-page="contact"] .crm-mobile-contact-actions svg,
  .crm-mobile-contact-pills button { background: var(--accent-soft); color: var(--accent-ink); stroke: currentColor; }
  [data-crm-page="contact"] .global-ask-ai-button { top: auto; right: 12px; bottom: calc(82px + env(safe-area-inset-bottom)); }
  .crm-mobile-detail-accordions details, .crm-mobile-contact-actions { border-color: var(--line); }
  #flowBuilderModal.build-mode .node-palette:not([hidden]) {
    position: fixed; inset: auto 8px calc(8px + env(safe-area-inset-bottom));
    width: auto; max-width: none; height: min(63dvh,540px); max-height: none; min-height: 0;
    overflow-y: auto; overscroll-behavior: contain; padding: 15px; border: 1px solid var(--line);
    border-radius: 16px; background: var(--panel); box-shadow: 0 4px 44px #12282e44; z-index: 20;
  }
  #flowBuilderModal.build-mode .flow-minimap { width: 83px; height: 62px; opacity: .85; }
  .automation-canvas-back { display: none; }
}
@media (prefers-reduced-motion:reduce) {
  .metric-bar-track span, .node-palette { transition: none; animation: none; }
}
.sites-github-card summary { cursor: pointer; color: var(--ink); font-size: .94rem; font-weight: 650; }
.sites-github-card[open] summary { margin-bottom: 10px; }

/* A sticky rail is its own stacking context. Raise the rail only while its menu is open. */
.app-rail:has(#accountMenu:not([hidden])) { z-index: 1500; overflow: visible; }
.app-rail #accountMenu:not([hidden]) { max-height: calc(100dvh - 48px); overflow-y: auto; overscroll-behavior: contain; }
