/* Tenant presentation layer. Load after ui-refinement.css, before inbox overrides. */
body.workspace-redesign {
  --green: #5147c8;
  --green-dark: #4036ad;
  --ink: #252733;
  --muted: #626571;
  --line: #e4e5eb;
  --bg: #ffffff;
  --white: #ffffff;
  --panel: #ffffff;
  --panel-radius: 6px;
  --ops-soft: #eeedf9;
  --ops-soft-ink: #443aab;
  --ops-hover: #f0f0f5;
  --ops-focus: #5147c8;
  --wr-rail: #f6f6f9;
  --wr-subtle: #fafafb;
  --wr-control: #c9cbd5;
  --wr-space: 24px;
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--ink);
}

body.workspace-redesign ::selection { background: #dedbf6; color: #302779; }
body.workspace-redesign :is(input, textarea) { caret-color: var(--green); }
body.workspace-redesign :is(input, textarea)::placeholder { color: #6a6d79; opacity: 1; }
body.workspace-redesign :is(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--ops-focus);
  outline-offset: 3px;
}
body.workspace-redesign :is(input, textarea, select):focus { border-color: var(--green); box-shadow: none; }
body.workspace-redesign :is(button, input, textarea, select) { font: inherit; }
body.workspace-redesign button {
  min-height: 32px;
  border-radius: 5px;
  padding: 6px 11px;
  font-weight: 600;
  line-height: 1.45;
  transition: background-color 150ms ease, border-color 150ms ease;
}
body.workspace-redesign button:disabled { opacity: .52; cursor: not-allowed; }
body.workspace-redesign :is(input, select, textarea) {
  min-width: 0;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--wr-control);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  line-height: 1.45;
}
body.workspace-redesign textarea { resize: vertical; line-height: 1.7; }
body.workspace-redesign :is(input, select, textarea):disabled { background: #f3f3f6; color: var(--muted); cursor: not-allowed; }
body.workspace-redesign input[readonly] { background: var(--wr-subtle); color: var(--muted); }
body.workspace-redesign :is(input[type="checkbox"], input[type="radio"]) {
  width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  flex: 0 0 16px;
  accent-color: var(--green);
}
body.workspace-redesign label { gap: 5px; font-size: 12px; font-weight: 500; color: #444753; min-width: 0; }
body.workspace-redesign .secondary { background: #fff; border: 1px solid var(--wr-control); color: #444753; }
body.workspace-redesign .secondary:hover:not(:disabled) { background: #f3f3f7; border-color: #b8bbc9; color: var(--ink); }
body.workspace-redesign .secondary:active:not(:disabled) { background: #eaeaf2; }
body.workspace-redesign .danger { background: #fff1f0; color: #a12e2b; border: 1px solid #efcecc; }
body.workspace-redesign .danger:hover:not(:disabled) { background: #fbe3e1; color: #8e2421; }
body.workspace-redesign :is(a, .file-button) { text-underline-offset: 3px; }
body.workspace-redesign .muted { color: var(--muted); font-size: 12px; line-height: 1.7; }
body.workspace-redesign :is(h1, h2, h3, h4) { color: var(--ink); font-weight: 600; letter-spacing: 0; }
body.workspace-redesign :is(h2, h3, h4, p, label) { overflow-wrap: anywhere; }
body.workspace-redesign .pill { background: #f0f0f5; color: #555866; font-size: 11px; font-weight: 500; padding: 3px 7px; border-radius: 4px; }
body.workspace-redesign :is(.pill, .status, th, td, time, .ops-stat b, .wf-overview strong) { font-variant-numeric: tabular-nums; }
body.workspace-redesign :is(.error, .log-error) { color: #a12e2b; }
body.workspace-redesign [aria-busy="true"] { cursor: progress; }
body.workspace-redesign :is(.table-wrap, .page, #appNavigation nav, .wf-workflow-list, .wr-drawer) {
  scrollbar-width: thin;
  scrollbar-color: #b8bac7 transparent;
}

/* A fixed-height application frame; the active route owns its scroll position. */
body.workspace-redesign #app {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
body.workspace-redesign #app > main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 0;
  overflow: hidden;
  background: #fff;
}
body.workspace-redesign #app > main > header {
  flex: 0 0 auto;
  min-height: 68px;
  height: auto;
  padding: 12px var(--wr-space);
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
body.workspace-redesign #app > main > header h1 { font-size: 17px; line-height: 1.4; font-weight: 650; letter-spacing: -.015em; }
body.workspace-redesign #pageDescription { margin: 3px 0 0; font-size: 12px; line-height: 1.5; max-width: 70ch; }
body.workspace-redesign .page-refresh-controls { flex: 0 1 auto; gap: 6px 10px; max-width: 440px; }
body.workspace-redesign #refreshCurrentPage { min-height: 30px; padding: 5px 9px; font-size: 12px; }
body.workspace-redesign #clock { width: auto; font-size: 11px; color: var(--muted); }
body.workspace-redesign #liveConnectionStatus { font-size: 11px; max-width: 185px; }
body.workspace-redesign #app > main > .page {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  max-width: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scroll-padding-block: 16px;
}
body.workspace-redesign #app > main > :where(.page.active:not(.hidden):not([hidden])) { display: block; }

/* Navigation retains its labels, permission gates and existing mobile behavior. */
body.workspace-redesign #appNavigation {
  background: var(--wr-rail);
  color: var(--ink);
  border-right: 1px solid var(--line);
  padding: 18px 12px 12px;
  height: 100%;
  min-height: 0;
}
body.workspace-redesign #appNavigation .logo { padding: 0 8px 20px; gap: 9px; font-size: 14px; }
body.workspace-redesign #appNavigation .logo small { color: var(--muted); font-size: 10px; letter-spacing: .02em; }
body.workspace-redesign #appNavigation .tenant-logo-mark,
body.workspace-redesign #appNavigation .tenant-logo-mark :is(img, span) { width: 30px; height: 30px; border-radius: 7px; }
body.workspace-redesign #appNavigation .tenant-switcher { color: var(--muted); font-size: 11px; gap: 5px; margin: 0 4px 15px; }
body.workspace-redesign #appNavigation .tenant-switcher select { background: #fff; color: var(--ink); border-color: var(--line); min-height: 34px; padding: 7px 9px; font-size: 12px; }
body.workspace-redesign #appNavigation nav { display: flex; flex-direction: column; gap: 2px; padding: 0 2px 12px; scrollbar-color: #b8bac7 transparent; }
body.workspace-redesign #appNavigation nav::-webkit-scrollbar-thumb { background: #b8bac7; }
body.workspace-redesign #appNavigation :is(.nav, .nav-group-toggle) {
  min-height: 33px;
  margin: 0;
  padding: 7px 10px;
  background: transparent;
  color: #575b69;
  border-radius: 5px;
  border: 0;
  font-size: 12px;
  letter-spacing: 0;
  line-height: 1.5;
  box-shadow: none;
}
body.workspace-redesign #appNavigation .nav { font-weight: 500; text-align: left; }
body.workspace-redesign #appNavigation .nav-sub { padding-left: 21px; }
body.workspace-redesign #appNavigation .nav-group { margin: 4px 0 0; gap: 1px; }
body.workspace-redesign #appNavigation .nav-group-toggle { font-size: 11px; font-weight: 600; }
body.workspace-redesign #appNavigation .nav-chevron {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; flex: 0 0 16px; font-size: 0;
}
body.workspace-redesign #appNavigation .nav-chevron::before {
  content: ''; width: 6px; height: 6px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
body.workspace-redesign #appNavigation .nav-group-items { padding: 1px 0 3px; gap: 1px; }
body.workspace-redesign #appNavigation :is(.nav, .nav-group-toggle):hover { background: #eaeaf0; color: var(--ink); }
body.workspace-redesign #appNavigation .nav:is(.active, [aria-current="page"]) { background: #e8e6f7; color: #4339a5; box-shadow: none; font-weight: 600; }
body.workspace-redesign #appNavigation .nav[data-page="overview"] {
  min-height: 40px; margin-bottom: 8px; padding: 9px 12px;
  background: transparent; border: 1px solid #d6d7e2; color: var(--ink); font-weight: 600;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
  --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M3 3h7v7H3zM14 3h7v7h-7zM3 14h7v7H3zM14 14h7v7h-7z'/%3E%3C/svg%3E");
}
body.workspace-redesign #appNavigation .nav[data-page="overview"]:hover { background: #eeecfb; border-color: #aca5e5; color: #4339a5; }
body.workspace-redesign #appNavigation .nav[data-page="overview"]:is(.active, [aria-current="page"]) { background: #5147c8; border-color: #5147c8; color: #fff; }
body.workspace-redesign #appNavigation :is(button, select):focus-visible { outline-color: var(--green); }
body.workspace-redesign #appNavigation .shell-action-rail { grid-template-columns: repeat(3, minmax(0, 1fr)); border-color: var(--line); padding-top: 10px; }
body.workspace-redesign #appNavigation .shell-action { height: 34px; color: var(--muted); text-decoration: none; }
body.workspace-redesign #appNavigation .shell-action img { width: 17px; height: 17px; filter: none; opacity: .7; }
body.workspace-redesign #appNavigation .shell-action:hover { background: #eaeaf0; }
body.workspace-redesign #appNavigation .shell-action:hover img { filter: none; opacity: 1; }

/* Continuous work surfaces: rules separate areas, not rounded card stacks. */
body.workspace-redesign .page:where(:not(#inbox):not(#emailInbox)) .card {
  padding: 18px var(--wr-space);
  margin: 0;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  background: #fff;
}
body.workspace-redesign .page:where(:not(#inbox):not(#emailInbox)) .card .card { padding: 14px 0; }
body.workspace-redesign .page:where(:not(#inbox):not(#emailInbox)) > .card + .card,
body.workspace-redesign .page:where(:not(#inbox):not(#emailInbox)) .ops-workspace > .card + .card { margin-top: 0; }
body.workspace-redesign .page:where(:not(#inbox):not(#emailInbox)) .card-head { gap: 10px 16px; margin: 0 0 14px; align-items: center; }
body.workspace-redesign .page:where(:not(#inbox):not(#emailInbox)) .card h2 { margin: 0; font-size: 14px; line-height: 1.55; }
body.workspace-redesign .page:where(:not(#inbox):not(#emailInbox)) h3 { font-size: 14px; }
body.workspace-redesign .page:where(:not(#inbox):not(#emailInbox)) .card > h2 { margin-bottom: 12px; }
body.workspace-redesign .page:where(:not(#inbox):not(#emailInbox)) .card > p { max-width: 75ch; }
body.workspace-redesign .page:where(:not(#inbox):not(#emailInbox)) .card-head > .muted { margin-right: auto; }
body.workspace-redesign .page:where(:not(#inbox):not(#emailInbox)) :is(.stack, .grid, .two-col) { gap: 0; }
body.workspace-redesign .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
body.workspace-redesign .account-actions { flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
body.workspace-redesign .check { gap: 8px; }
body.workspace-redesign .ops-section-links { min-height: 42px; padding: 8px var(--wr-space); margin: 0; border-bottom: 1px solid var(--line); background: var(--wr-subtle); }
body.workspace-redesign .ops-section-links button { min-height: 26px; padding: 3px 7px; background: transparent; border-color: transparent; color: var(--muted); font-size: 11px; }
body.workspace-redesign :is(.ops-scope, .notice) { border-left: 0; }
body.workspace-redesign .ops-warning { border-radius: 4px; background: #fff5df; color: #79500e; }

/* Tables keep all columns and scroll horizontally rather than disguising rows as cards. */
body.workspace-redesign .page:where(:not(#inbox):not(#emailInbox)) :is(.table-wrap, .admin-table) { max-width: 100%; max-height: 64dvh; overflow: auto; border: 0; border-radius: 0; }
body.workspace-redesign .page:where(:not(#inbox):not(#emailInbox)) table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
body.workspace-redesign .page:where(:not(#inbox):not(#emailInbox)) th { position: sticky; top: 0; z-index: 2; padding: 9px 12px; background: #f8f8fb; color: #5c5f6e; font-size: 11px; font-weight: 500; border-bottom: 1px solid var(--line); white-space: nowrap; }
body.workspace-redesign .page:where(:not(#inbox):not(#emailInbox)) td { padding: 10px 12px; border-bottom: 1px solid #ededf2; line-height: 1.6; }
body.workspace-redesign .page:where(:not(#inbox):not(#emailInbox)) tbody tr:hover > td { background: #fafafd; }
body.workspace-redesign .page:where(:not(#inbox):not(#emailInbox)) tbody tr:has(input[type="checkbox"]:checked) > td { background: #f3f1fc; }
body.workspace-redesign .page:where(:not(#inbox):not(#emailInbox)) td button { min-height: 28px; padding: 4px 8px; font-size: 11px; white-space: nowrap; }
body.workspace-redesign #mediaLibrary table {min-width:620px;table-layout:fixed}
body.workspace-redesign #mediaLibrary :is(th,td):first-child {width:45%;white-space:normal;overflow-wrap:anywhere;word-break:break-word}
body.workspace-redesign .page:where(:not(#inbox):not(#emailInbox)) td .muted { font-size: 11px; }
body.workspace-redesign .page:where(:not(#inbox):not(#emailInbox)) td[colspan] { padding: 32px 16px; color: var(--muted); text-align: center; }
body.workspace-redesign .list-pager { padding: 12px 0 0; font-size: 12px; }
body.workspace-redesign .ops-status { border-radius: 4px; font-size: 11px; padding: 3px 7px; }
body.workspace-redesign .ops-status.active { color: #443aab; background: #eeedf9; }
body.workspace-redesign .social-account-table { min-width: 1160px; }
body.workspace-redesign .social-account-table :is(th, td):nth-child(2) { left: 0; }
body.workspace-redesign .social-account-table td:nth-child(2) { background: #fff; }
body.workspace-redesign .social-account-table th:nth-child(2) { background: #f8f8fb; z-index: 3; }
body.workspace-redesign .social-account-table td:last-child { min-width: 180px; max-width: 230px; }
@media(min-width:901px){
  body.workspace-redesign .social-account-table :is(th,td):last-child {position:sticky;right:0;background:#fff;z-index:3;border-left:1px solid var(--line)}
  body.workspace-redesign .social-account-table th:last-child {background:#f8f8fb;z-index:4}
}
body.workspace-redesign #socialOps .card-head :is(button, select) { min-height: 32px; padding: 6px 9px; font-size: 12px; }
body.workspace-redesign #socialOps .card-head label { min-width: 112px; }
body.workspace-redesign #socialAccountDisclosure { padding: 13px var(--wr-space); margin: 0; background: var(--wr-subtle); }
body.workspace-redesign #socialAccountDisclosure > summary { font-size: 13px; min-height: 24px; color: var(--green-dark); }
body.workspace-redesign #socialAccountDisclosure[open] > summary { margin-bottom: 16px; }
body.workspace-redesign #socialAccountDisclosure .ops-summary-hint { color: var(--muted); font-size: 11px; }
body.workspace-redesign .social-ops-panel .form-grid .check { background: transparent; border: 0; border-radius: 0; padding: 5px 0; min-height: 32px; }

/* Workbench: a single operational canvas with a quiet metric band. */
body.workspace-redesign .ops-updated { margin: 0; padding: 10px var(--wr-space); font-size: 11px; border-bottom: 1px solid var(--line); background: var(--wr-subtle); }
body.workspace-redesign .ops-columns { grid-template-columns: minmax(0, 1.4fr) minmax(240px, 1fr); gap: 0; margin: 0; }
body.workspace-redesign .ops-columns > .card + .card { border-left: 1px solid var(--line); }
body.workspace-redesign .ops-shortcuts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
body.workspace-redesign .workbench-guide { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin: 18px var(--wr-space); padding: 16px 18px; border: 1px solid #dedbf4; border-radius: 8px; background: #f5f3ff; }
body.workspace-redesign .workbench-guide strong { color: var(--ink); font-size: 14px; }
body.workspace-redesign .workbench-guide p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
body.workspace-redesign .workbench-guide a { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; padding: 10px 14px; border: 1px solid var(--green); border-radius: 5px; background: var(--green); color: #fff; font-size: 13px; font-weight: 600; text-decoration: none; }
body.workspace-redesign .workbench-guide a:hover { background: var(--green-dark); border-color: var(--green-dark); }
body.workspace-redesign .workbench-guide a:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
body.workspace-redesign .workbench-guide img { width: 18px; height: 18px; filter: brightness(0) invert(1); }
body.workspace-redesign #feedbackLauncher { position: fixed; right: 16px; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 80; display: flex; align-items: center; gap: 8px; padding: 11px 15px; border: 1px solid #dedbf4; border-radius: 24px; color: var(--green-dark); background: #fff; box-shadow: 0 4px 18px #22204020; }
body.workspace-redesign #feedbackLauncher:hover { background: #f5f3ff; border-color: var(--green); }
@media (max-width: 900px) {
  body.workspace-redesign .mobile-app-bar #feedbackLauncher { position: static; inset: auto; z-index: auto; flex: 0 0 44px; width: 44px; height: 44px; min-height: 44px; justify-content: center; padding: 10px; border-radius: 10px; box-shadow: none; }
  body.workspace-redesign .mobile-app-bar #feedbackLauncher span { display: none; }
  body.workspace-redesign .mobile-app-bar .mobile-tenant-name { max-width: 25%; }
}
body.workspace-redesign #feedbackDialog { width: min(580px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 24px; border: 1px solid var(--line); border-radius: 12px; overflow-y: auto; box-sizing: border-box; }
#feedbackDialog::backdrop { background: #1d203a70; }
.feedback-heading { display: flex; align-items: flex-start; gap: 16px; justify-content: space-between; }
.feedback-heading h2 { margin: 0 0 8px; font-size: 18px; }
.feedback-heading p, .feedback-note, .feedback-upload small { color: var(--muted); font-size: 12px; line-height: 1.6; }
.feedback-heading button { flex-shrink: 0; }
#feedbackFields { display: grid; gap: 14px; margin: 10px 0; padding: 0; border: 0; min-width: 0; }
#feedbackFields label { display: grid; }
#feedbackPreviews { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
#feedbackPreviews > div { min-width: 0; display: grid; gap: 6px; }
#feedbackPreviews img { width: 100%; height: 84px; object-fit: contain; background: #f3f3f7; border: 1px solid var(--line); border-radius: 5px; }
#feedbackPreviews span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.feedback-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
#feedbackStatus { white-space: pre-line; overflow-wrap: anywhere; font-size: 13px; }
body.workspace-redesign .ops-shortcuts .ops-link { padding: 8px 10px; min-height: 34px; font-size: 12px; }
body.workspace-redesign .ops-todos li { padding: 10px 0; font-size: 12px; }
body.workspace-redesign .ops-link { min-height: 28px; padding: 5px 8px; font-size: 11px; }
body.workspace-redesign .ops-metrics { margin: 0; padding: 0 var(--wr-space); }
body.workspace-redesign .ops-stats { border-top: 0; grid-template-columns: repeat(4, minmax(0, 1fr)); }
body.workspace-redesign .ops-stat { padding: 14px 16px; gap: 4px 12px; }
body.workspace-redesign .ops-stat b { font-size: 21px; color: var(--ink); }
body.workspace-redesign .ops-stat small { font-size: 11px; }
body.workspace-redesign .ops-platforms { gap: 0; grid-template-columns: repeat(4, minmax(0, 1fr)); }
body.workspace-redesign .ops-platforms article { padding: 14px 18px; border: 0; border-right: 1px solid var(--line); border-radius: 0; background: transparent; }
body.workspace-redesign .ops-platforms article:last-child { border-right: 0; }
body.workspace-redesign .ops-platforms h3 { font-size: 14px; }
body.workspace-redesign .ops-platforms :is(p, small) { font-size: 12px; }
body.workspace-redesign .ops-grants .ops-platforms article { padding: 10px 16px; border-left: 0; }
body.workspace-redesign #activityRecords > :is(.ops-filters, .ops-record-tabs, .ops-record-meta, .table-wrap, .ops-pagination, .ops-warning),
body.workspace-redesign #activityRecords > .ops-scope { margin-left: var(--wr-space); margin-right: var(--wr-space); }
body.workspace-redesign .ops-record-tabs { padding: 10px 0 0; margin-bottom: 16px; gap: 16px; }
body.workspace-redesign .ops-record-tabs button { min-height: 36px; padding: 7px 0 10px; border-bottom: 2px solid transparent; border-radius: 0; font-size: 12px; }
body.workspace-redesign .ops-record-tabs button[aria-pressed="true"] { background: transparent; color: var(--green-dark); border-bottom-color: var(--green); }
body.workspace-redesign .ops-filter-grid { grid-template-columns: repeat(4, minmax(110px, 1fr)) minmax(150px, 1.3fr); gap: 12px; }
body.workspace-redesign .ops-filters :is(input, select, button) { min-height: 32px; padding: 6px 9px; font-size: 12px; }

/* Original account / template objects become rows. QR and auth state remain intact. */
body.workspace-redesign #accountList { display: block; }
body.workspace-redesign #accountList > .account-card { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(220px, 2fr); column-gap: 24px; align-items: start; }
body.workspace-redesign #accountList > .account-card > :is(.account-actions, .qr) { grid-column: 1 / -1; }
body.workspace-redesign #accountList .qr { margin: 12px 0; }
body.workspace-redesign #templates > .two-col { display: block; }
body.workspace-redesign #templateList { display: block; }
body.workspace-redesign #templateList .template-card { display: grid; grid-template-columns: minmax(160px, .65fr) minmax(0, 1.8fr); gap: 10px 28px; }
body.workspace-redesign #templateList .template-card > pre { grid-column: 2; grid-row: 1 / span 3; margin: 0; max-height: 200px; overflow: auto; background: var(--wr-subtle); padding: 12px 14px; border-radius: 4px; font-size: 12px; color: #4b4e5b; }
body.workspace-redesign #templateList .template-card .account-actions { grid-column: 1 / -1; margin-top: 0; }
body.workspace-redesign #emailAccounts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; overflow: visible; }
body.workspace-redesign #emailAccounts > .inbox-account { width: auto; min-width: 0; padding: 16px; background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
body.workspace-redesign #emailAccounts > .inbox-account:nth-child(odd) { border-right: 1px solid var(--line); }
body.workspace-redesign #emailAccounts > .inbox-account.active { background: #f5f4fc; box-shadow: none; }

/* CRM, campaigns and acquisition: filter bands above the objects they scope. */
body.workspace-redesign #contacts > .form-card:first-of-type,
body.workspace-redesign #campaigns > .form-card:first-of-type { background: var(--wr-subtle); }
body.workspace-redesign #contacts .form-grid,
body.workspace-redesign #contactFilters { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px 12px; }
body.workspace-redesign #contacts > .form-card:has(#openCrmContactModal) { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding-top: 12px; padding-bottom: 12px; }
body.workspace-redesign #contacts > .form-card:has(#openCrmContactModal) .card-head { flex: 1 1 340px; margin: 0; }
body.workspace-redesign #contacts > .form-card:has(#openCrmContactModal) .account-actions { margin: 0; }
body.workspace-redesign #campaigns .settings-tabs { margin: 0; padding: 8px var(--wr-space) 0; border-bottom: 1px solid var(--line); gap: 20px; }
body.workspace-redesign :is(.campaign-tab, .campaign-activity-tab) { border-radius: 0; background: transparent; color: var(--muted); border-bottom: 2px solid transparent; padding: 8px 0 11px; }
body.workspace-redesign :is(.campaign-tab, .campaign-activity-tab).active { background: transparent; color: var(--green-dark); border-bottom-color: var(--green); }
body.workspace-redesign .account-allocation { padding: 10px 0; background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
body.workspace-redesign .account-allocation-list { gap: 0; }
body.workspace-redesign .acq-tabs { margin: 0; padding: 12px var(--wr-space); gap: 8px; border-bottom: 1px solid var(--line); }
body.workspace-redesign .acq-tabs button { border-color: transparent; background: transparent; color: var(--muted); font-size: 12px; }
body.workspace-redesign .acq-tabs button[aria-selected="true"] { background: var(--ops-soft); border-color: transparent; color: var(--ops-soft-ink); }
body.workspace-redesign .acq-panel { border: 0; border-radius: 0; padding: 20px var(--wr-space); }
body.workspace-redesign .acq-panel :is(button, a) { color: var(--green-dark); }
body.workspace-redesign .acq-panel button { background: #f4f3fb; border-color: #dbd7ee; }
body.workspace-redesign .acq-card { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; margin: 0; padding: 14px 0; }
body.workspace-redesign .lead-picker { border-radius: 5px; }
body.workspace-redesign .lead-job-card { padding: 14px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
body.workspace-redesign .lead-progress-grid { gap: 0; }
body.workspace-redesign .lead-progress-grid > div { padding: 10px 12px; border: 0; border-right: 1px solid var(--line); background: var(--wr-subtle); border-radius: 0; }
body.workspace-redesign .lead-progress-grid b { font-size: 18px; }
body.workspace-redesign .switch { position: relative; }
body.workspace-redesign .switch input { display: block; position: absolute; width: 46px; height: 25px; opacity: 0; margin: 0; }
body.workspace-redesign .switch input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 3px; }

/* Knowledge has a library rail alongside its selected collection. */
body.workspace-redesign #knowledge.active:not(.hidden):not([hidden]) { display: grid; grid-template-columns: minmax(250px, 29%) minmax(0, 1fr); align-content: start; }
body.workspace-redesign #knowledge > .card:first-child { border-right: 1px solid var(--line); min-height: 100%; background: var(--wr-subtle); }
body.workspace-redesign #knowledgeBaseList { margin-top: 16px; }
body.workspace-redesign #knowledgeBaseList > * { border-radius: 0; box-shadow: none; }
body.workspace-redesign #knowledge .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.workspace-redesign #knowledgeFileForm { margin: 22px 0 8px; padding-top: 18px; border-top: 1px solid var(--line); }
body.workspace-redesign #knowledge :is(h3, #knowledgeUploadStatus) { margin-top: 20px; }
body.workspace-redesign #knowledgeDocumentList > *,
body.workspace-redesign #knowledgeUploadJobList > * { border-radius: 0; box-shadow: none; }

/* Settings navigation and long form sections share one continuous settings surface. */
body.workspace-redesign #integrations.active:not(.hidden):not([hidden]) { display: grid; grid-template-columns: 180px minmax(0, 1fr); align-content: start; align-items: start; }
body.workspace-redesign #integrations > .settings-primary-tabs { position: sticky; top: 0; display: flex; flex-direction: column; flex-wrap: nowrap; gap: 3px; margin: 0; padding: 20px 12px; border-right: 1px solid var(--line); background: var(--wr-subtle); }
body.workspace-redesign #integrations > .settings-primary-tabs .settings-tab { width: 100%; min-height: 35px; padding: 8px 12px; border: 0; background: transparent; color: #595c6a; text-align: left; font-size: 12px; }
body.workspace-redesign #integrations > .settings-primary-tabs .settings-tab.active { background: var(--ops-soft); color: var(--ops-soft-ink); }
body.workspace-redesign #integrations > .settings-panel { grid-column: 2; grid-row: 1; min-width: 0; padding-bottom: 24px; }
body.workspace-redesign #integrations .settings-panel > :is(.model-settings-section, .serp-key-manager, #tenantVideoSettings) { padding: 20px var(--wr-space); margin: 0; }
body.workspace-redesign .model-settings-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
body.workspace-redesign .model-connection-card { padding: 20px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
body.workspace-redesign .model-connection-card h3 { font-size: 14px; }
body.workspace-redesign .model-connection-card .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.workspace-redesign :is(.model-advanced, .av-service, .av-generation-group) { border: 0; border-top: 1px solid var(--line); background: transparent; border-radius: 0; padding: 18px 0; margin-top: 12px; }
body.workspace-redesign .model-notice { border-radius: 4px; background: var(--ops-soft); color: var(--ops-soft-ink); font-size: 12px; }
body.workspace-redesign #modelSettingsRoot .secondary,
body.workspace-redesign #tenantVideoSettings .secondary { background: #fff; color: #444753; }
body.workspace-redesign #modelSettingsRoot :is(input, select):focus,
body.workspace-redesign #tenantVideoSettings :is(input, select):focus { box-shadow: none; }
body.workspace-redesign .settings-compact-card > summary { font-size: 13px; font-weight: 600; }
body.workspace-redesign .settings-summary { gap: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.workspace-redesign .settings-summary > div { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 14px 0; background: transparent; }
body.workspace-redesign .settings-summary b { font-size: 13px; }
body.workspace-redesign .branding-settings-layout { grid-template-columns: 90px minmax(0, 1fr); gap: 24px; align-items: start; }
body.workspace-redesign .branding-preview,
body.workspace-redesign .branding-preview :is(img, span) { width: 80px; height: 80px; }
body.workspace-redesign .branding-controls,
body.workspace-redesign .branding-controls form { flex-wrap: wrap; }
body.workspace-redesign .serp-key-toolbar h2 { font-size: 14px; }
body.workspace-redesign .serp-key-row { padding: 14px 0; }
body.workspace-redesign .serp-key-action { min-width: 32px; min-height: 32px; width: 32px; height: 32px; }

/* Profile and security read as settings rows; hidden enrollment states stay owned by app.js. */
body.workspace-redesign .account-management-grid { display: block; max-width: 1080px; margin: 0 auto; }
body.workspace-redesign #accountManagement .account-management-grid > .card { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 12px 32px; padding: 26px var(--wr-space); }
body.workspace-redesign #accountManagement .account-management-grid > .card > .card-head { grid-column: 1; margin: 0; align-self: start; align-items: start; }
body.workspace-redesign #accountManagement .account-management-grid > .card > :is(form, .security-state) { grid-column: 2; }
body.workspace-redesign #accountManagement .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.workspace-redesign #accountManagement .form-grid > :is(p, .auth-code-actions, button) { grid-column: 1 / -1; }
body.workspace-redesign #accountManagement .form-grid > button { justify-self: start; }
body.workspace-redesign .security-form { max-width: 560px; }
body.workspace-redesign .account-session-zone { margin: 0 var(--wr-space); padding: 24px 0; border-top: 0; }
body.workspace-redesign .account-session-zone h2 { font-size: 14px; }
body.workspace-redesign :is(#tenantMembers, #tenantAudit).page { padding: 20px var(--wr-space); }
body.workspace-redesign #tenantMembers table {min-width:660px}
body.workspace-redesign #tenantMembers :is(th,td):not(:first-child) {white-space:nowrap}
body.workspace-redesign #tenantMembers :is(th,td):first-child {min-width:200px;overflow-wrap:anywhere}
body.workspace-redesign .admin-toolbar { padding-bottom: 16px; }
body.workspace-redesign .admin-toolbar h2 { font-size: 15px; }
body.workspace-redesign .admin-form { background: var(--wr-subtle); padding: 16px; margin: 0 0 14px; border-bottom: 1px solid var(--line); border-radius: 0; }
body.workspace-redesign .one-time-secret { border-radius: 5px; }

/* Workflow configuration remains inside its renderer's original parent. */
body.workspace-redesign #workflowCenterRoot { padding: 0; }
body.workspace-redesign .wf-page-head { padding: 16px var(--wr-space); border-bottom: 1px solid var(--line); }
body.workspace-redesign .wf-page-head h2 { margin: 0 0 4px; font-size: 16px; letter-spacing: 0; }
body.workspace-redesign .wf-eyebrow { display: none; }
body.workspace-redesign .wf-feedback { margin: 0 var(--wr-space); }
body.workspace-redesign .wf-overview { gap: 0; margin: 0; border-bottom: 1px solid var(--line); background: var(--wr-subtle); }
body.workspace-redesign .wf-overview > div { padding: 11px var(--wr-space); border: 0; border-right: 1px solid var(--line); border-radius: 0; background: transparent; }
body.workspace-redesign .wf-overview > div:last-child { border-right: 0; }
body.workspace-redesign .wf-overview strong { font-size: 18px; color: var(--ink); }
body.workspace-redesign .wf-layout { grid-template-columns: 232px minmax(0, 1fr); gap: 0; align-items: stretch; }
body.workspace-redesign #workflowCenter .wf-sidebar { padding: 18px 12px; background: var(--wr-subtle); border-right: 1px solid var(--line); height: auto; position: static; }
body.workspace-redesign .wf-sidebar h3 { padding: 0 8px; font-size: 12px; }
body.workspace-redesign .wf-workflow-list { gap: 3px; max-height: 70dvh; }
body.workspace-redesign .wf-workflow-item { padding: 10px; background: transparent; border-color: transparent; border-radius: 5px; gap: 3px; }
body.workspace-redesign .wf-workflow-item.selected { border-color: transparent; background: var(--ops-soft); color: var(--ops-soft-ink); box-shadow: none; }
body.workspace-redesign .wf-workflow-item strong { font-size: 12px; }
body.workspace-redesign .wf-workflow-item :is(span, small) { font-size: 11px; }
body.workspace-redesign #workflowCenter .wf-config { border-bottom: 0; padding: 20px var(--wr-space); }
body.workspace-redesign .wf-config > .card-head { padding-bottom: 14px; }
body.workspace-redesign .wf-config > .card-head h3 { margin: 0; }
body.workspace-redesign .wf-config > fieldset > .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.workspace-redesign .wf-section-title { padding-top: 22px; font-size: 13px; scroll-margin-top: 60px; }
body.workspace-redesign .wf-section-title span { background: #eeedf8; color: #4b428b; width: 22px; height: 22px; border-radius: 4px; }
body.workspace-redesign .wf-account-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
body.workspace-redesign .wf-account-option { min-width: 0; border: 0; border-bottom: 1px solid var(--line); padding: 10px 8px; background: transparent; border-radius: 0; }
body.workspace-redesign .wf-account-option:has(input:checked) { background: var(--ops-soft); border-color: var(--line); }
body.workspace-redesign .wf-account-option input,
body.workspace-redesign .wf-execution-picker input[type="checkbox"] { accent-color: var(--green); }
body.workspace-redesign .wf-schedule { padding: 18px 0; border: 0; border-top: 1px solid var(--line); background: transparent; border-radius: 0; }
body.workspace-redesign .wf-save-bar { position: sticky; bottom: -20px; z-index: 3; padding: 14px 0; margin-top: 20px; border-top: 1px solid var(--line); background: #fff; }
body.workspace-redesign .wf-asset-source { background: var(--wr-subtle); border: 1px dashed var(--wr-control); border-radius: 5px; }
body.workspace-redesign .wf-run-detail { background: var(--wr-subtle); }
body.workspace-redesign #workflowCenter .wf-runs { border-top: 1px solid var(--line); }
body.workspace-redesign .wr-section-nav {
  display: flex;
  flex: 0 0 auto;
  gap: 16px;
  align-items: center;
  overflow: auto;
  margin: 0 0 18px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
body.workspace-redesign .wr-section-nav button { background: transparent; color: var(--muted); border: 0; padding: 4px 0; min-height: 28px; white-space: nowrap; font-size: 12px; }
body.workspace-redesign .wr-section-nav button:hover { color: var(--green-dark); }
body.workspace-redesign .wr-section-nav button[aria-current="location"] { color: var(--green-dark); text-decoration: underline; text-underline-offset: 8px; }
body.workspace-redesign #accountManagement > .wr-section-nav { padding: 12px var(--wr-space); margin: 0; }

/* Static form drawers keep the original forms, IDs and permission ancestors. */
body.workspace-redesign .wr-form-launch { display: flex; align-items: center; gap: 10px; margin: 4px 0; }
body.workspace-redesign .wr-form-launch button { min-height: 32px; }
body.workspace-redesign .wr-form-launch .muted { font-size: 11px; }
body.workspace-redesign dialog.wr-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(580px, 100vw);
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  max-width: 100vw;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  box-shadow: -12px 0 48px rgb(25 25 44 / 14%);
  overflow: auto;
  overscroll-behavior: contain;
}
body.workspace-redesign dialog.wr-drawer[open] { display: flex; flex-direction: column; animation: wr-drawer-enter 180ms cubic-bezier(.16, 1, .3, 1); }
body.workspace-redesign dialog.wr-drawer::backdrop { background: rgb(24 25 40 / 28%); backdrop-filter: none; }
body.workspace-redesign .wr-drawer-head { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 4; height: auto; min-height: 64px; padding: 16px 24px; gap: 16px; border-bottom: 1px solid var(--line); background: #fff; }
body.workspace-redesign .wr-drawer-head h2 { font-size: 16px; margin: 0; }
body.workspace-redesign .wr-drawer-status { flex: 0 0 auto; margin: 16px 24px 0; padding: 10px 12px; border-radius: 4px; background: #fff1f0; overflow-wrap: anywhere; }
body.workspace-redesign .wr-drawer > form { display: block; flex: 1 0 auto; width: 100%; padding: 24px; margin: 0; }
body.workspace-redesign .wr-drawer > form.form-grid { display: grid; align-content: start; }
body.workspace-redesign .wr-drawer > form.inline-form { display: grid; align-content: start; }
body.workspace-redesign .wr-drawer :is(.form-grid, form.form-grid) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
body.workspace-redesign .wr-drawer form > label { margin-bottom: 16px; }
body.workspace-redesign .wr-drawer form > .account-actions { position: sticky; bottom: -1px; padding: 16px 0 8px; border-top: 1px solid var(--line); background: #fff; z-index: 2; }
body.workspace-redesign .wr-drawer .wr-field-heading { grid-column: 1 / -1; margin: 12px 0 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; }
body.workspace-redesign .wr-drawer form > button { justify-self: start; }

/* Row menus use native popovers, so table overflow never clips their actions. */
body.workspace-redesign .wr-row-primary { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; }
body.workspace-redesign .wr-row-menu-button { min-width: 32px; display: inline-grid; place-items: center; padding: 5px; }
body.workspace-redesign .wr-row-menu-button svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; }
body.workspace-redesign .wr-row-menu[popover] { position: fixed; inset: auto; min-width: 172px; max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); overflow: auto; margin: 0; padding: 5px; border: 1px solid var(--wr-control); border-radius: 6px; background: #fff; color: var(--ink); }
body.workspace-redesign .wr-row-menu:popover-open { display: grid; gap: 2px; }
body.workspace-redesign .wr-row-menu button { width: 100%; text-align: left; min-height: 32px; font-size: 12px; padding: 7px 10px; background: transparent; border-color: transparent; }
body.workspace-redesign .wr-row-menu .danger { color: #a12e2b; }
body.workspace-redesign .wr-row-menu button:hover { background: #f2f1f9; }

/* Existing dialogs keep their own lifecycle and business-specific close handlers. */
body.workspace-redesign .modal-backdrop { background: rgb(24 25 40 / 32%); backdrop-filter: none; }
body.workspace-redesign .modal .modal-card {
  border: 0;
  border-radius: 10px;
  padding: 24px;
  background: #fff;
  box-shadow: 0 18px 64px rgb(25 25 44 / 20%);
  max-height: calc(100dvh - 40px);
}
body.workspace-redesign .modal .modal-card h2 { font-size: 16px; }
body.workspace-redesign #socialAccountEditModal { padding: 0; justify-items: end; align-items: stretch; }
body.workspace-redesign #socialAccountEditModal .modal-card { width: min(600px, 100vw); height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; box-shadow: -12px 0 48px rgb(25 25 44 / 14%); }
body.workspace-redesign #socialAccountEditModal .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.workspace-redesign :is(.wf-execution-picker, .wf-ai-dialog, #agentVideoDialog) { border: 0; border-radius: 10px; background: #fff; color: var(--ink); box-shadow: 0 18px 64px rgb(25 25 44 / 20%); }
body.workspace-redesign :is(.wf-execution-picker, .wf-ai-dialog, #agentVideoDialog)::backdrop { background: rgb(24 25 40 / 32%); backdrop-filter: none; }
body.workspace-redesign #toast { background: #30313d; border-radius: 6px; z-index: 200; }
body.workspace-redesign #toast.bad { background: #9d302b; }
body.workspace-redesign .login-wrap { min-height: 100dvh; background: var(--wr-rail); padding: 24px 0; }
body.workspace-redesign .auth-shell { width: min(420px, calc(100vw - 32px)); padding: 32px; border: 1px solid var(--line); border-radius: 10px; box-shadow: none; }
body.workspace-redesign .auth-panel { gap: 18px; border-radius: 0; }
body.workspace-redesign .auth-panel :is(h1, h2) { font-size: 21px; font-weight: 650; line-height: 1.4; }
body.workspace-redesign .auth-panel .brand-mark { width: 40px; height: 40px; font-size: 20px; border-radius: 8px; background: var(--green); }
body.workspace-redesign .auth-panel :is(button, input) { min-height: 40px; }
body.workspace-redesign .auth-panel input[readonly] { background: var(--wr-subtle); color: var(--muted); }
body.workspace-redesign .auth-back { color: var(--muted); }
body.workspace-redesign .auth-step { color: var(--muted); font-size: 12px; letter-spacing: 0; }

@keyframes wr-drawer-enter { from { transform: translateX(20px); } to { transform: translateX(0); } }

@media (max-width: 1200px) {
  body.workspace-redesign { --wr-space: 20px; }
  body.workspace-redesign #clock { display: none; }
  body.workspace-redesign .ops-platforms { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.workspace-redesign .ops-platforms article { border-bottom: 1px solid var(--line); }
  body.workspace-redesign .ops-filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.workspace-redesign .wf-layout { grid-template-columns: 200px minmax(0, 1fr); }
  body.workspace-redesign .wf-account-picker { grid-template-columns: minmax(0, 1fr); }
  body.workspace-redesign #integrations.active:not(.hidden):not([hidden]) { grid-template-columns: 160px minmax(0, 1fr); }
  body.workspace-redesign #integrations .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  body.workspace-redesign { --wr-space: 16px; }
  body.workspace-redesign #app,
  body.workspace-redesign #app.mobile-nav-ready { display: flex; flex-direction: column; }
  body.workspace-redesign #app > main { flex: 1 1 auto; height: auto; }
  body.workspace-redesign #app.mobile-nav-ready .mobile-app-bar { flex: 0 0 auto; position: relative; min-height: 64px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--wr-rail); border-color: var(--line); color: var(--ink); }
  body.workspace-redesign .mobile-page-context > span { color: var(--muted); letter-spacing: 0; }
  body.workspace-redesign .mobile-page-context > strong { font-size: 14px; }
  body.workspace-redesign .mobile-tenant-name { background: #fff; border-color: var(--line); color: var(--muted); }
  body.workspace-redesign .mobile-nav-icon { border-color: var(--line); background: transparent; color: var(--ink); border-radius: 5px; }
  body.workspace-redesign #app.mobile-nav-ready > #appNavigation { width: min(280px, calc(100vw - 44px)); background: var(--wr-rail); border-right-color: var(--line); }
  body.workspace-redesign #appNavigation .logo { padding-right: 34px; }
  body.workspace-redesign #appNavigation :is(.nav, .nav-group-toggle) { min-height: 40px; }
  body.workspace-redesign #appNavigation .shell-action { height: 50px; }
  body.workspace-redesign #appNavigation .mobile-action-label { font-size: 11px; }
  body.workspace-redesign #app.mobile-nav-ready > main > header { min-height: 64px; padding: 10px var(--wr-space); flex-wrap: nowrap; gap: 12px; }
  body.workspace-redesign #app > main > header h1 { font-size: 16px; }
  body.workspace-redesign #pageDescription { font-size: 11px; }
  body.workspace-redesign #liveConnectionStatus { max-width: 160px; }
  body.workspace-redesign .ops-columns { grid-template-columns: minmax(0, 1fr); }
  body.workspace-redesign .ops-columns > .card + .card { border-left: 0; }
  body.workspace-redesign .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.workspace-redesign .ops-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.workspace-redesign .ops-stat:nth-child(2n) { border-right: 0; }
  body.workspace-redesign #knowledge.active:not(.hidden):not([hidden]) { grid-template-columns: minmax(220px, 32%) minmax(0, 1fr); }
  body.workspace-redesign #knowledge .form-grid { grid-template-columns: minmax(0, 1fr); }
  body.workspace-redesign #accountManagement .account-management-grid > .card { grid-template-columns: 140px minmax(0, 1fr); gap: 16px; }
}

@media (max-width: 680px) {
  body.workspace-redesign #app.mobile-nav-ready > main > header {display:flex;align-items:center;min-height:64px;gap:12px}
  body.workspace-redesign #app.mobile-nav-ready > main > header h1 {display:none}
  body.workspace-redesign #app.mobile-nav-ready > main > header .page-refresh-controls {display:flex;flex-direction:column;align-items:flex-end;gap:4px;margin:0;width:auto;max-width:130px}
  body.workspace-redesign #app.mobile-nav-ready > main > header #pageDescription {margin:0;font-size:11px}
  body.workspace-redesign #app > main > header { align-items: flex-start; }
  body.workspace-redesign .page-refresh-controls { flex: 0 0 auto; max-width: 140px; }
  body.workspace-redesign #liveConnectionStatus { max-width: 140px; font-size: 10px; }
  body.workspace-redesign #refreshCurrentPage { font-size: 11px; min-height: 32px; }
  body.workspace-redesign :is(input, select, textarea) { font-size: 16px; min-height: 40px; }
  body.workspace-redesign button { min-height: 38px; }
  body.workspace-redesign label { font-size: 12px; }
  body.workspace-redesign :is(.form-grid, .ops-filter-grid, .ops-filter-more .ops-filter-grid, .wf-config > fieldset > .form-grid),
  body.workspace-redesign #integrations .form-grid { grid-template-columns: minmax(0, 1fr); }
  body.workspace-redesign #contacts .form-grid,
  body.workspace-redesign #contactFilters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.workspace-redesign .page:where(:not(#inbox):not(#emailInbox)) .table-wrap { max-height: 62dvh; }
  body.workspace-redesign .page:where(:not(#inbox):not(#emailInbox)) :is(th, td) { padding: 10px; }
  body.workspace-redesign #knowledge.active:not(.hidden):not([hidden]),
  body.workspace-redesign #integrations.active:not(.hidden):not([hidden]) { display: block; }
  body.workspace-redesign #knowledge > .card:first-child { border-right: 0; min-height: 0; }
  body.workspace-redesign #integrations > .settings-primary-tabs { flex-direction: row; overflow-x: auto; gap: 4px; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); position: static; }
  body.workspace-redesign #integrations > .settings-primary-tabs .settings-tab { flex: 0 0 auto; width: auto; white-space: nowrap; }
  body.workspace-redesign .branding-settings-layout { grid-template-columns: minmax(0, 1fr); }
  body.workspace-redesign .branding-controls label { min-width: 0; }
  body.workspace-redesign #accountManagement .account-management-grid > .card { display: block; padding: 22px var(--wr-space); }
  body.workspace-redesign #accountManagement .account-management-grid > .card > .card-head { margin-bottom: 16px; }
  body.workspace-redesign #accountManagement .form-grid { grid-template-columns: minmax(0, 1fr); }
  body.workspace-redesign .account-session-zone { align-items: flex-start; flex-direction: column; }
  body.workspace-redesign #templateList .template-card,
  body.workspace-redesign #accountList > .account-card { display: block; }
  body.workspace-redesign #templateList .template-card > pre { margin: 12px 0; }
  body.workspace-redesign #templateList .template-card .account-actions { margin-top: 12px; }
  body.workspace-redesign #emailAccounts { grid-template-columns: minmax(0, 1fr); }
  body.workspace-redesign #emailAccounts > .inbox-account:nth-child(odd) { border-right: 0; }
  body.workspace-redesign .wf-layout { grid-template-columns: minmax(0, 1fr); }
  body.workspace-redesign #workflowCenter .wf-sidebar { border-right: 0; }
  body.workspace-redesign .wf-workflow-list { display: flex; gap: 6px; overflow-x: auto; max-height: none; }
  body.workspace-redesign .wf-workflow-item { flex: 0 0 200px; }
  body.workspace-redesign .wf-overview > div { display: grid; gap: 4px; padding: 10px 12px; }
  body.workspace-redesign .wf-overview strong { font-size: 18px; }
  body.workspace-redesign .wf-save-bar { position:static; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  body.workspace-redesign .wf-runs .account-actions label { min-width: 0; }
  body.workspace-redesign .wr-drawer :is(.form-grid, form.form-grid),
  body.workspace-redesign #socialAccountEditModal .form-grid { grid-template-columns: minmax(0, 1fr); }
  body.workspace-redesign .wr-drawer-head,
  body.workspace-redesign .wr-drawer > form { padding-left: 20px; padding-right: 20px; }
  body.workspace-redesign .wr-drawer > form { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  body.workspace-redesign .wr-form-launch { flex-wrap: wrap; }
  body.workspace-redesign .modal .modal-card { padding: 20px; }
  body.workspace-redesign .admin-form { grid-template-columns: minmax(0, 1fr); }
  body.workspace-redesign .ops-platforms { grid-template-columns: minmax(0, 1fr); }
  body.workspace-redesign .ops-platforms article { border-right: 0; }
  body.workspace-redesign .ops-shortcuts { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  body.workspace-redesign *, body.workspace-redesign *::before, body.workspace-redesign *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* Visibility is application-owned, including permission and renderer-owned panels. */
body.workspace-redesign .hidden,
body.workspace-redesign [hidden],
body.workspace-redesign #app .hidden,
body.workspace-redesign #app [hidden] { display: none !important; }
body.workspace-redesign dialog:not([open]) { display: none; }

/* Unified pickers. Native select values and form validation remain intact. */
body.workspace-redesign.workspace-selects-ready select:not([multiple]):is(:not([size]), [size="0"], [size="1"]),
body.workspace-redesign.workspace-selects-ready #appNavigation select:not([multiple]) {
  appearance: none; padding-right: 34px !important; cursor: pointer; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23626571' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  transition: border-color .15s ease, box-shadow .15s ease;
}
body.workspace-redesign.workspace-selects-ready select:not([multiple]):hover:not(:disabled) { border-color: #aaa4d8; }
body.workspace-redesign.workspace-selects-ready select[aria-expanded="true"] { border-color: #5147c8; box-shadow: 0 0 0 3px #5147c81a; }
body.workspace-redesign.workspace-selects-ready select:disabled { cursor: not-allowed; }
body.workspace-redesign .ws-select-popup {
  position: fixed; inset: auto; margin: 0; padding: 6px; overflow: hidden;
  border: 1px solid #e0dfea; border-radius: 9px; background: #fff; color: #252733;
  box-shadow: 0 12px 32px #25213d24, 0 2px 6px #25213d0a; box-sizing: border-box;
  font: inherit; font-size: 13px;
}
body.workspace-redesign .ws-select-popup:popover-open { display: flex; flex-direction: column; gap: 4px; }
body.workspace-redesign .ws-select-popup::backdrop { background: transparent; }
body.workspace-redesign .ws-select-popup .ws-select-search {
  flex: 0 0 auto; width: 100%; min-height: 34px; margin: 0 0 3px; padding: 7px 10px;
  background: #f7f7fb; border: 1px solid #e5e4ed; border-radius: 5px; font: inherit;
}
body.workspace-redesign .ws-select-list {
  min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: #c5c3d6 transparent;
}
body.workspace-redesign .ws-select-option {
  position: relative; display: flex; align-items: center; box-sizing: border-box; min-height: 34px; padding: 7px 32px 7px 10px;
  border-radius: 5px; line-height: 1.5; cursor: pointer; overflow-wrap: anywhere;
}
body.workspace-redesign .ws-select-option:is(:hover,.is-active):not([aria-disabled="true"]) { background: #f1effb; color: #4339a5; }
body.workspace-redesign .ws-select-option[aria-selected="true"] { color: #5147c8; font-weight: 600; }
body.workspace-redesign .ws-select-option[aria-selected="true"]::after {
  content: ''; position: absolute; right: 12px; width: 5px; height: 9px;
  border-right: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor; transform: rotate(45deg) translateY(-2px);
}
body.workspace-redesign .ws-select-option[aria-disabled="true"] { color: #a1a2ad; cursor: not-allowed; }
body.workspace-redesign .ws-select-group { padding: 9px 10px 4px; color: #777684; font-size: 11px; font-weight: 600; }
body.workspace-redesign .ws-select-empty { margin: 0; padding: 20px 12px; color: #777684; text-align: center; font-size: 12px; }
@media (max-width: 600px) {
  body.workspace-redesign .ws-select-popup { font-size: 14px; }
  body.workspace-redesign .ws-select-option { min-height: 42px; }
  body.workspace-redesign .ws-select-popup .ws-select-search { font-size: 16px; min-height: 40px; }
}

/* Small inline icons keep text labels and require no extra asset requests. */
body.workspace-redesign [data-ui-icon="plus"] { --ui-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M12%205v14M5%2012h14%22%2F%3E%3C%2Fsvg%3E"); }
body.workspace-redesign [data-ui-icon="refresh"] { --ui-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M20%207v5h-5M4%2017v-5h5M6%207a7%207%200%200%201%2012-1l2%206M4%2012l2%206a7%207%200%200%200%2012-1%22%2F%3E%3C%2Fsvg%3E"); }
body.workspace-redesign [data-ui-icon="check"] { --ui-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m5%2012%204%204L19%206%22%2F%3E%3C%2Fsvg%3E"); }
body.workspace-redesign [data-ui-icon="download"] { --ui-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M12%203v12m-5-5%205%205%205-5M4%2016v5h16v-5%22%2F%3E%3C%2Fsvg%3E"); }
body.workspace-redesign [data-ui-icon="upload"] { --ui-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M12%2016V4m-5%205%205-5%205%205M4%2016v5h16v-5%22%2F%3E%3C%2Fsvg%3E"); }
body.workspace-redesign [data-nav-group="accounts"] { --ui-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M16%2021v-3a4%204%200%200%200-4-4H6a4%204%200%200%200-4%204v3M9%2010a4%204%200%201%200%200-8%204%204%200%200%200%200%208M18%208a4%204%200%200%201%200%208m0-2a4%204%200%200%201%204%204v3%22%2F%3E%3C%2Fsvg%3E"); }
body.workspace-redesign [data-nav-group="content"] { --ui-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%203h18v18H3zM3%2017l6-6%204%204%203-3%205%205M16%207h.01%22%2F%3E%3C%2Fsvg%3E"); }
body.workspace-redesign [data-nav-group="tasks"] { --ui-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M5%203h14v18H5zM8%208h8M8%2012h8M8%2016h5%22%2F%3E%3C%2Fsvg%3E"); }
body.workspace-redesign [data-nav-group="messages"] { --ui-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%203h18v14H8l-5%204zM7%208h10M7%2012h6%22%2F%3E%3C%2Fsvg%3E"); }
body.workspace-redesign [data-nav-group="customers"] { --ui-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M20%2021v-3a5%205%200%200%200-5-5H9a5%205%200%200%200-5%205v3M12%209a4%204%200%201%200%200-8%204%204%200%200%200%200%208%22%2F%3E%3C%2Fsvg%3E"); }
body.workspace-redesign [data-nav-group="records"] { --ui-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%2012a9%209%200%201%200%203-7L3%208M3%203v5h5M12%207v5l3%202%22%2F%3E%3C%2Fsvg%3E"); }
body.workspace-redesign [data-nav-group="settings"] { --ui-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M4%207h16M4%2017h16M8%204v6M16%2014v6%22%2F%3E%3C%2Fsvg%3E"); }
body.workspace-redesign [data-ui-icon]::before,
body.workspace-redesign .nav-group-toggle > span:first-child::before {
  content: ''; display: inline-block; width: 16px; height: 16px; flex: 0 0 16px;
  margin-right: 7px; vertical-align: -3px; background: currentColor;
  mask: var(--ui-icon) center / contain no-repeat;
  -webkit-mask: var(--ui-icon) center / contain no-repeat;
}
body.workspace-redesign .page-load-error {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px; padding: 12px 16px; border: 1px solid #edcf9e;
  background: #fffaf0; border-radius: 6px; color: #795218; line-height: 1.6;
}
body.workspace-redesign .page-load-error button { flex-shrink: 0; }
@media (max-width: 600px) {
  body.workspace-redesign .page-load-error { align-items: flex-start; flex-direction: column; }
}
