* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top right, rgba(79, 172, 255, 0.11), transparent 28%),
    radial-gradient(circle at bottom left, rgba(213, 164, 60, 0.08), transparent 26%),
    linear-gradient(160deg, #f8fbfe 0%, #eef4fa 48%, #f9f6ef 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: -1;
  border-radius: 999px;
  filter: blur(22px);
  opacity: 0.5;
}

body::before {
  top: -8vh;
  right: -4vw;
  width: 34vw;
  height: 34vw;
  background: radial-gradient(circle, rgba(77, 178, 255, 0.18) 0%, rgba(77, 178, 255, 0.03) 60%, transparent 72%);
}

body::after {
  left: -6vw;
  bottom: -10vh;
  width: 28vw;
  height: 28vw;
  background: radial-gradient(circle, rgba(213, 164, 60, 0.13) 0%, rgba(213, 164, 60, 0.03) 58%, transparent 72%);
}

body[data-theme="dark"]::before {
  background: radial-gradient(circle, rgba(94, 168, 255, 0.18) 0%, rgba(94, 168, 255, 0.04) 60%, transparent 72%);
}

body[data-theme="dark"]::after {
  background: radial-gradient(circle, rgba(28, 184, 163, 0.12) 0%, rgba(28, 184, 163, 0.03) 58%, transparent 72%);
}

@media (hover: hover) and (pointer: fine) {
  .mail-row.swipe-open > :not(.mail-swipe-actions),
  .mail-row.swiping > :not(.mail-swipe-actions) {
    transform: none !important;
  }

  .mail-swipe-actions {
    display: none !important;
  }
}

body.auth-required .eyebrow {
  margin: 0 0 5px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 16px;
}

h3 {
  margin-bottom: 6px;
  font-size: 13px;
}

p {
  color: var(--muted);
  line-height: 1.45;
}

a {
  color: var(--accent-dark);
  font-weight: 800;
  overflow-wrap: anywhere;
}


.top-actions {
  justify-content: flex-end;
}

.top-status-button {
  position: relative;
  min-height: 38px;
  border: 1px solid rgba(190, 205, 226, 0.92);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.86);
  color: #102039;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  font-weight: 850;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.top-status-button:hover {
  border-color: rgba(47, 111, 214, 0.36);
  background: #ffffff;
  box-shadow: 0 9px 22px rgba(27, 54, 96, 0.12);
  transform: translateY(-1px);
}

.top-status-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}

.top-status-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.top-status-count {
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  background: rgba(44, 98, 186, 0.1);
  color: #24539c;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.top-status-count[hidden] {
  display: none !important;
}

.approval-top-button.has-pending,
.notification-top-button.has-unread {
  border-color: rgba(47, 111, 214, 0.36);
  background: linear-gradient(180deg, #f7fbff, #edf5ff);
  color: #174990;
}

.approval-top-button.has-pending .top-status-count,
.notification-top-button.has-unread .top-status-count {
  background: #2f6fd6;
  color: #fff;
  box-shadow: 0 5px 12px rgba(47, 111, 214, 0.26);
}

.notification-top-button[aria-expanded="true"] {
  border-color: rgba(47, 111, 214, 0.48);
  background: #eef6ff;
  color: #174990;
}


.openai-status-alert {
  min-height: 34px;
  border-color: rgba(188, 122, 26, 0.34);
  background: #fff7e6;
  color: #7a4b10;
  padding: 0 12px;
  font-weight: 850;
}

.openai-status-alert:hover {
  border-color: rgba(188, 122, 26, 0.52);
  background: #fff2d3;
  box-shadow: 0 8px 18px rgba(122, 75, 16, 0.12);
}

.diagnostics-top-button.has-errors {
  border-color: rgba(185, 28, 28, 0.28);
  background: linear-gradient(135deg, #fff7ed, #fff1f2);
  color: #9f1239;
}

.inline-actions {
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.contact-review-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: start;
}

.contact-review-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  padding: 8px;
  border: 1px solid rgba(134, 154, 184, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
}

.contact-review-action-group small {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
}

.contact-review-action-group.primary-flow {
  border-color: rgba(39, 110, 241, 0.25);
  background: rgba(39, 110, 241, 0.06);
}

.primary-button,
.ghost-button,
.mini-button,
.text-button,
.icon-button,
.command-row button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  min-height: 34px;
  padding: 0 11px;
  font-weight: 750;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
}

.primary-button,
.command-row button {
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  border-color: rgba(7, 79, 166, 0.78);
  color: #fff;
  box-shadow: 0 8px 18px rgba(39, 110, 241, 0.18);
}

.primary-link-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 0 14px;
  text-decoration: none;
}

.primary-button:hover,
.command-row button:hover,
.primary-link-button:hover {
  background: linear-gradient(180deg, var(--accent-dark), #094591);
  border-color: var(--accent-dark);
  transform: translateY(-1px);
}

.ghost-button,
.mini-button {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 249, 253, 0.92));
  border-color: rgba(192, 206, 223, 0.9);
  color: var(--ink);
}

.ghost-button:hover,
.mini-button:hover,
.icon-button:hover {
  border-color: rgba(94, 168, 255, 0.34);
  color: var(--accent-dark);
  box-shadow: 0 6px 16px rgba(20, 32, 51, 0.08);
}

.danger-button {
  min-height: 34px;
  border: 1px solid #efc2bd;
  border-radius: 10px;
  padding: 0 14px;
  background: #fff;
  border-color: #efc2bd;
  color: #8f342b;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.danger-button:hover {
  background: #fff7f6;
  border-color: #d98b83;
  color: #7e2d25;
}

.text-button {
  min-height: 30px;
  border-color: rgba(94, 168, 255, 0.16);
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent-dark);
  padding: 0 11px;
}

.text-button:hover {
  background: #fff;
  border-color: rgba(94, 168, 255, 0.34);
  box-shadow: 0 6px 16px rgba(20, 32, 51, 0.07);
}

.icon-button {
  min-width: 30px;
  padding: 0;
  border-color: rgba(192, 206, 223, 0.9);
  background: rgba(255, 255, 255, 0.92);
  font-size: 20px;
  line-height: 1;
}

.theme-toggle {
  gap: 0;
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  justify-content: center;
}

.theme-toggle-icon {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(94, 168, 255, 0.16), rgba(28, 184, 163, 0.12));
  color: var(--accent-dark);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(94, 168, 255, 0.12);
}

.command-panel {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(248, 251, 255, 0.88)),
    linear-gradient(90deg, rgba(94, 168, 255, 0.06), rgba(28, 184, 163, 0.04));
  border: 1px solid rgba(214, 223, 235, 0.92);
  box-shadow: var(--shadow);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 12px;
}

body[data-theme="dark"] .workspace {
  background: transparent;
}

body[data-theme="dark"] .topbar {
  color: var(--ink);
}

body[data-theme="dark"] .command-panel {
  background: linear-gradient(180deg, rgba(18, 29, 45, 0.96), rgba(13, 23, 37, 0.95));
  border-color: rgba(226, 236, 249, 0.18);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.36);
}

body[data-theme="dark"] .command-panel label {
  color: #b8c5d8;
}

body[data-theme="dark"] .command-row input {
  background: rgba(8, 18, 32, 0.88);
  border-color: rgba(226, 236, 249, 0.2);
  color: var(--ink);
}

body[data-theme="dark"] .ghost-button,
body[data-theme="dark"] .mini-button,
body[data-theme="dark"] .text-button,
body[data-theme="dark"] .icon-button {
  background: rgba(17, 30, 48, 0.92);
  border-color: rgba(226, 236, 249, 0.2);
  color: #e9f1ff;
}

body[data-theme="dark"] .ghost-button:hover,
body[data-theme="dark"] .mini-button:hover,
body[data-theme="dark"] .text-button:hover,
body[data-theme="dark"] .icon-button:hover {
  background: rgba(27, 45, 70, 0.96);
  border-color: rgba(91, 149, 255, 0.45);
  color: #cfe2ff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.26);
}

body[data-theme="dark"] .theme-toggle-icon {
  background: rgba(255, 216, 107, 0.16);
  color: #ffd86b;
  box-shadow: inset 0 0 0 1px rgba(255, 216, 107, 0.2);
}

.command-panel label {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.command-row input {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.quick-prompts button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--accent-dark);
  padding: 0 12px;
  font-size: 13px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}


body[data-view="assistant"] .content-grid {
  grid-template-columns: minmax(0, 1fr);
}


/* Tasks need more breathing room on native shell widths, so collapse the
   approval rail and detail pane before the mobile breakpoint. */
@media (max-width: 1100px) {
  body[data-view="tasks"] .todo-page {
    grid-template-columns: minmax(240px, 270px) minmax(0, 1fr);
  }

  body[data-view="tasks"] .todo-detail {
    position: fixed;
    z-index: 92;
    top: 88px;
    right: 20px;
    bottom: 20px;
    width: min(410px, calc(100vw - 40px));
    max-height: none;
    visibility: hidden;
    pointer-events: none;
    opacity: 0;
    transform: translateX(calc(100% + 32px));
    box-shadow: 0 22px 64px rgba(15, 35, 64, 0.24);
    transition: opacity 160ms ease, transform 180ms ease, visibility 0s linear 180ms;
  }

  body[data-view="tasks"] .todo-page.detail-open .todo-detail {
    visibility: visible;
    pointer-events: auto;
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0s;
  }
}

@media (max-width: 1360px) {
  body[data-view="tasks"] .content-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-view="tasks"] .approval-panel {
    position: static;
  }

  .docs-source-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .docs-category-grid,
  .docs-files-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .docs-file-browser {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  }
}

@media (max-width: 1280px) {
  body[data-view="tasks"] .todo-page {
    grid-template-columns: minmax(220px, 250px) minmax(0, 1fr);
  }

  body[data-view="tasks"] .todo-sidebar {
    grid-row: 1;
  }

  .docs-source-grid {
    grid-template-columns: 1fr;
  }

  .docs-category-grid,
  .docs-files-overview {
    grid-template-columns: 1fr;
  }

  .docs-file-browser {
    grid-template-columns: 1fr;
  }

  .docs-browser-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .docs-browser-row {
    grid-template-columns: 28px 38px minmax(180px, 1fr) 92px;
  }

  .docs-browser-row > span:nth-child(5),
  .docs-browser-row > span:nth-child(6) {
    display: none;
  }
}

@media (max-width: 1100px) {
  body[data-view="tasks"] .todo-commandbar {
    grid-template-columns: minmax(0, 1fr);
  }
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

.status-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.status-band[hidden] {
  display: none !important;
}


.status-band div {
  padding: 16px;
}

.dashboard-widgets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

body[data-view="today"]:not(.native-shell) .dashboard-widgets {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body[data-view="today"]:not(.native-shell) .dashboard-card-approvals {
  display: none;
}

.dashboard-card {
  min-width: 0;
  min-height: 284px;
  background: var(--panel);
  border: 1px solid rgba(216, 226, 239, 0.92);
  border-radius: 6px;
  color: var(--ink);
  padding: 16px;
  box-shadow: 0 12px 28px rgba(20, 32, 51, 0.1);
}

.dashboard-card:nth-child(2) {
  background: #fffaf2;
}

.dashboard-card:nth-child(3) {
  background: #f2fbf8;
}

.dashboard-card:nth-child(4) {
  background: #f7f9ff;
}

.dashboard-card-heading {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.dashboard-card-heading strong {
  display: block;
  font-size: 18px;
  line-height: 1.15;
}

.dashboard-card-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.dashboard-icon {
  width: 42px;
  height: 42px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 900;
}

.dashboard-list,
.dashboard-folder-list {
  display: grid;
  gap: 8px;
}

.dashboard-row,
.dashboard-folder {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(216, 226, 239, 0.72);
  border-radius: 6px;
  background: rgba(241, 245, 249, 0.72);
  color: inherit;
  text-align: left;
  padding: 9px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.dashboard-mail-row {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  min-height: 72px;
  padding: 12px 10px;
}

.dashboard-folder {
  grid-template-columns: auto minmax(0, 1fr);
  min-height: 42px;
}

.dashboard-row:hover,
.dashboard-folder:hover {
  background: #fff;
  border-color: rgba(39, 110, 241, 0.32);
}

.dashboard-row strong,
.dashboard-folder strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.dashboard-mail-copy {
  min-width: 0;
}

.dashboard-mail-row strong {
  font-size: 14.5px;
  line-height: 1.18;
}

.dashboard-row em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.mini-avatar,
.task-check,
.event-dot {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(47, 127, 112, 0.1);
  color: #2f7f70;
  font-size: 12px;
  font-weight: 900;
}


.task-check {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(100, 116, 139, 0.58);
  background: transparent;
}

.event-dot {
  width: 14px;
  height: 14px;
  background: #6aa8ff;
}

.event-dot.personal,
.event-dot.work {
  background: #3f83f8;
}

.event-dot.send-later,
.event-dot.scheduled {
  background: #b07df5;
}

.event-dot.content {
  background: #d97706;
}

.dashboard-empty {
  color: var(--muted);
  border: 1px dashed rgba(100, 116, 139, 0.3);
  border-radius: 6px;
  padding: 12px;
}

body[data-theme="dark"] .dashboard-card {
  background: rgba(18, 27, 37, 0.9);
  border-color: rgba(219, 228, 238, 0.24);
  color: #eef6ff;
  box-shadow: none;
}

body[data-theme="dark"] .dashboard-card:nth-child(2) {
  background: rgba(18, 24, 31, 0.92);
}

body[data-theme="dark"] .dashboard-card:nth-child(3) {
  background: rgba(18, 35, 41, 0.88);
}

body[data-theme="dark"] .dashboard-card:nth-child(4) {
  background: rgba(15, 24, 39, 0.92);
}

body[data-theme="dark"] .dashboard-card-heading p,
body[data-theme="dark"] .dashboard-row em {
  color: rgba(238, 246, 255, 0.68);
}

body[data-theme="dark"] .dashboard-icon {
  background: rgba(255, 255, 255, 0.1);
  color: #9bd4ff;
}

body[data-theme="dark"] .dashboard-row,
body[data-theme="dark"] .dashboard-folder {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.055);
}

body[data-theme="dark"] .dashboard-row:hover,
body[data-theme="dark"] .dashboard-folder:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: transparent;
}

body[data-theme="dark"] .dashboard-row small,
body[data-theme="dark"] .dashboard-empty {
  color: rgba(238, 246, 255, 0.64);
}

body[data-theme="dark"] .mini-avatar {
  background: hsl(var(--avatar-hue, 164) 46% 22%);
  color: hsl(var(--avatar-hue, 164) 62% 78%);
}


body[data-theme="dark"] .status-button {
  background: rgba(28, 49, 80, 0.98);
  border-color: rgba(132, 174, 255, 0.35);
  color: #dbe9ff;
}

body[data-theme="dark"] .status-button:hover {
  background: rgba(43, 72, 113, 0.98);
  border-color: rgba(151, 190, 255, 0.56);
  color: #ffffff;
}

body[data-theme="dark"] .danger-button {
  background: rgba(77, 31, 31, 0.9);
  border-color: rgba(255, 161, 151, 0.36);
  color: #ffc6be;
}

body[data-theme="dark"] .danger-button:hover {
  background: rgba(103, 39, 38, 0.95);
  border-color: rgba(255, 178, 168, 0.56);
  color: #ffffff;
}

body[data-theme="dark"] .config-row strong.ready,
body[data-theme="dark"] .settings-status strong.ready {
  background: rgba(62, 185, 128, 0.18);
  border: 1px solid rgba(62, 185, 128, 0.34);
  color: #b4f7d8;
}

body[data-theme="dark"] .config-row strong.pending,
body[data-theme="dark"] .settings-status strong.pending {
  background: rgba(243, 196, 76, 0.18);
  border: 1px solid rgba(243, 196, 76, 0.34);
  color: #f5d88e;
}


body[data-theme="dark"] .repcloud-desk-card.wide,
body[data-theme="dark"] .settings-hero-card {
  background: linear-gradient(135deg, rgba(18, 33, 56, 0.99), rgba(10, 20, 36, 0.99));
}

body[data-theme="dark"] .settings-table {
  border-color: rgba(188, 205, 230, 0.22);
}

body[data-theme="dark"] .settings-table th {
  background: rgba(27, 47, 77, 0.98);
  color: #aebdd2;
}

body[data-theme="dark"] .settings-table td {
  border-bottom-color: rgba(188, 205, 230, 0.18);
}

body[data-theme="dark"] .settings-instructions p {
  background: rgba(14, 26, 45, 0.98);
  border-color: rgba(188, 205, 230, 0.22);
  color: #f6f9ff;
}

body[data-theme="dark"] .mini-row:hover,
body[data-theme="dark"] .rule-template-button:hover {
  background: rgba(27, 47, 77, 0.98);
  border-color: rgba(112, 161, 255, 0.5);
}

body[data-theme="dark"] .repcloud-desk-card h3,
body[data-theme="dark"] .repcloud-desk-card strong,
body[data-theme="dark"] .repcloud-health-grid b,
body[data-theme="dark"] .mini-row b,
body[data-theme="dark"] .rule-card-header strong,
body[data-theme="dark"] .rule-recipe-grid b,
body[data-theme="dark"] .rule-starter-summary strong,
body[data-theme="dark"] .rule-template-button strong,
body[data-theme="dark"] .settings-hero-card h3,
body[data-theme="dark"] .settings-card-header h3,
body[data-theme="dark"] .settings-status,
body[data-theme="dark"] .settings-status strong {
  color: #f8fbff;
}

body[data-theme="dark"] .maintenance-check-list li {
  color: #edf4ff;
}

body[data-theme="dark"] .maintenance-check {
  background: rgba(84, 55, 18, 0.52);
  border-color: rgba(214, 146, 36, 0.38);
}

body[data-theme="dark"] .maintenance-check.done {
  background: rgba(31, 116, 86, 0.3);
  border-color: rgba(91, 191, 145, 0.38);
}


body[data-theme="dark"] .settings-tab-nav button,
body[data-theme="dark"] .source-pill,
body[data-theme="dark"] .quick-prompts button {
  background: rgba(18, 33, 56, 0.98);
  border-color: rgba(188, 205, 230, 0.25);
  color: #d8e7ff;
}

body[data-theme="dark"] .settings-tab-nav button.active,
body[data-theme="dark"] .source-pill.active,
body[data-theme="dark"] .quick-prompts button:hover {
  background: rgba(91, 149, 255, 0.22);
  border-color: rgba(126, 176, 255, 0.54);
  color: #ffffff;
}

body[data-theme="dark"] .settings-tab-nav button.settings-tab-admin {
  background: rgba(96, 61, 14, 0.44);
  border-color: rgba(245, 184, 77, 0.38);
  color: #f6d391;
}

body[data-theme="dark"] .settings-tab-nav button.settings-tab-admin::before {
  background: #f0aa36;
  box-shadow: 0 0 0 3px rgba(240, 170, 54, 0.18);
}

body[data-theme="dark"] .settings-tab-nav button.settings-tab-admin.active {
  background: rgba(138, 84, 12, 0.52);
  border-color: rgba(245, 184, 77, 0.56);
  color: #fff2c7;
}

body[data-theme="dark"] .settings-grid select,
body[data-theme="dark"] .settings-page select,
body[data-theme="dark"] .settings-page input,
body[data-theme="dark"] .settings-page textarea {
  background: rgba(7, 15, 28, 0.98);
  border-color: rgba(188, 205, 230, 0.28);
  color: #f8fbff;
}

body[data-theme="dark"] .settings-page input[type="checkbox"] {
  accent-color: #6d9eff;
}

body[data-theme="dark"] .settings-page label,
body[data-theme="dark"] .settings-signature-label,
body[data-theme="dark"] .check-row {
  color: #dce8fb;
}

body[data-theme="dark"] .rule-status {
  background: rgba(18, 33, 56, 0.98);
  border-color: rgba(188, 205, 230, 0.24);
  color: #c8d8ef;
}


/* Final dark modal pass: keep dialogs readable over blurred dark pages. */
body[data-theme="dark"] .modal::backdrop {
  background: rgba(2, 8, 18, 0.62);
  backdrop-filter: blur(7px);
}

body[data-theme="dark"] .modal-card {
  background: linear-gradient(180deg, rgba(16, 29, 49, 0.99), rgba(10, 20, 36, 0.99));
  border-color: rgba(188, 205, 230, 0.28);
  color: #f8fbff;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.5);
}

body[data-theme="dark"] .modal-header,
body[data-theme="dark"] .modal-actions {
  background: transparent;
}

body[data-theme="dark"] .modal-actions {
  border-top-color: rgba(188, 205, 230, 0.18);
}

body[data-theme="dark"] .modal-card h2,
body[data-theme="dark"] .modal-card h3,
body[data-theme="dark"] .modal-card strong,
body[data-theme="dark"] .modal-card label,
body[data-theme="dark"] .modal-card .field-label {
  color: #f8fbff;
}

body[data-theme="dark"] .modal-card .eyebrow,
body[data-theme="dark"] .modal-note,
body[data-theme="dark"] .modal-card p,
body[data-theme="dark"] .modal-card small {
  color: #b9c7db;
}

body[data-theme="dark"] .modal-card .modal-note {
  color: #aebdd2;
}

body[data-theme="dark"] .modal-input,
body[data-theme="dark"] .modal-body textarea,
body[data-theme="dark"] .modal-body select,
body[data-theme="dark"] .rich-editable {
  background: rgba(7, 15, 28, 0.98);
  border-color: rgba(188, 205, 230, 0.3);
  color: #f8fbff;
}

body[data-theme="dark"] .modal-input::placeholder,
body[data-theme="dark"] .modal-body textarea::placeholder,
body[data-theme="dark"] .rich-editable:empty::before {
  color: #8090a6;
}

body[data-theme="dark"] .modal-separator {
  border-top-color: rgba(188, 205, 230, 0.18);
}

body[data-theme="dark"] .modal-inline-actions button,
body[data-theme="dark"] .rich-toolbar button {
  background: rgba(18, 33, 56, 0.98);
  border-color: rgba(188, 205, 230, 0.26);
  color: #dbe9ff;
}

body[data-theme="dark"] .modal-inline-actions button:hover,
body[data-theme="dark"] .rich-toolbar button:hover {
  background: rgba(35, 62, 106, 0.96);
  border-color: rgba(126, 176, 255, 0.54);
  color: #ffffff;
}


/* Final dark modal pass: keep dialogs readable over blurred dark pages. */
body[data-theme="dark"] .modal::backdrop {
  background: rgba(2, 8, 18, 0.62);
  backdrop-filter: blur(7px);
}

body[data-theme="dark"] .modal-card {
  background: linear-gradient(180deg, rgba(16, 29, 49, 0.99), rgba(10, 20, 36, 0.99));
  border-color: rgba(188, 205, 230, 0.28);
  color: #f8fbff;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.5);
}

body[data-theme="dark"] .modal-header,
body[data-theme="dark"] .modal-actions {
  background: transparent;
}

body[data-theme="dark"] .modal-actions {
  border-top-color: rgba(188, 205, 230, 0.18);
}

body[data-theme="dark"] .modal-card h2,
body[data-theme="dark"] .modal-card h3,
body[data-theme="dark"] .modal-card strong,
body[data-theme="dark"] .modal-card label,
body[data-theme="dark"] .modal-card .field-label {
  color: #f8fbff;
}

body[data-theme="dark"] .modal-card .eyebrow,
body[data-theme="dark"] .modal-note,
body[data-theme="dark"] .modal-card p,
body[data-theme="dark"] .modal-card small {
  color: #b9c7db;
}

body[data-theme="dark"] .modal-card .modal-note {
  color: #aebdd2;
}

body[data-theme="dark"] .modal-input,
body[data-theme="dark"] .modal-body textarea,
body[data-theme="dark"] .modal-body select,
body[data-theme="dark"] .rich-editable {
  background: rgba(7, 15, 28, 0.98);
  border-color: rgba(188, 205, 230, 0.3);
  color: #f8fbff;
}

body[data-theme="dark"] .modal-input::placeholder,
body[data-theme="dark"] .modal-body textarea::placeholder,
body[data-theme="dark"] .rich-editable:empty::before {
  color: #8090a6;
}

body[data-theme="dark"] .modal-separator {
  border-top-color: rgba(188, 205, 230, 0.18);
}

body[data-theme="dark"] .modal-inline-actions button,
body[data-theme="dark"] .rich-toolbar button {
  background: rgba(18, 33, 56, 0.98);
  border-color: rgba(188, 205, 230, 0.26);
  color: #dbe9ff;
}

body[data-theme="dark"] .modal-inline-actions button:hover,
body[data-theme="dark"] .rich-toolbar button:hover {
  background: rgba(35, 62, 106, 0.96);
  border-color: rgba(126, 176, 255, 0.54);
  color: #ffffff;
}

body[data-theme="dark"] .attachment-picker-overlay::backdrop {
  background: rgba(2, 6, 14, 0.68);
}

body[data-theme="dark"] .attachment-picker-sheet {
  background: #0b1526;
  border-color: rgba(188, 205, 230, 0.22);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.52);
}

body[data-theme="dark"] .attachment-picker-header h3 {
  color: #f6f9ff;
}

body[data-theme="dark"] .attachment-picker-header .eyebrow {
  color: #86b7ff;
}

body[data-theme="dark"] .attachment-picker-header .icon-button {
  border-color: rgba(188, 205, 230, 0.24);
  background: rgba(17, 31, 53, 0.96);
  color: #e9f1ff;
}

body[data-theme="dark"] .attachment-picker-header .icon-button:hover {
  border-color: rgba(126, 176, 255, 0.54);
  background: rgba(35, 62, 106, 0.96);
}


body[data-theme="dark"] .attachment-source-row .modal-input,
body[data-theme="dark"] .attachment-picker-search .modal-input,
body[data-theme="dark"] .attachment-source-row .mini-button,
body[data-theme="dark"] .attachment-quick-list .mini-button {
  background: rgba(17, 31, 53, 0.96);
  border-color: rgba(188, 205, 230, 0.22);
  color: #f6f9ff;
}

body[data-theme="dark"] .attachment-picker-status {
  border-color: rgba(96, 165, 250, 0.24);
  background: rgba(22, 45, 80, 0.92);
  color: #bfdbfe;
}

body[data-theme="dark"] .attachment-picker-status[data-tone="warning"] {
  border-color: rgba(250, 204, 21, 0.24);
  background: rgba(71, 51, 12, 0.88);
  color: #fde68a;
}

body[data-theme="dark"] .attachment-picker-status[data-tone="error"] {
  border-color: rgba(248, 113, 113, 0.25);
  background: rgba(77, 21, 26, 0.88);
  color: #fecaca;
}

body[data-theme="dark"] .attachment-source-row .mini-button:hover,
body[data-theme="dark"] .attachment-quick-list .mini-button:hover,
body[data-theme="dark"] .attachment-picker-row:hover,
body[data-theme="dark"] .attachment-choice:hover {
  background: rgba(35, 62, 106, 0.96);
  border-color: rgba(126, 176, 255, 0.54);
}


/* Dark modal pass: keep dialogs readable over blurred dark pages. */
body[data-theme="dark"] .modal::backdrop {
  background: rgba(2, 8, 18, 0.62);
  backdrop-filter: blur(7px);
}

body[data-theme="dark"] .modal-card {
  background: linear-gradient(180deg, rgba(16, 29, 49, 0.99), rgba(10, 20, 36, 0.99));
  border-color: rgba(188, 205, 230, 0.28);
  color: #f8fbff;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.5);
}

body[data-theme="dark"] .modal-header,
body[data-theme="dark"] .modal-actions {
  background: transparent;
}

body[data-theme="dark"] .modal-actions {
  border-top-color: rgba(188, 205, 230, 0.18);
}

body[data-theme="dark"] .modal-card h2,
body[data-theme="dark"] .modal-card h3,
body[data-theme="dark"] .modal-card strong,
body[data-theme="dark"] .modal-card label,
body[data-theme="dark"] .modal-card .field-label {
  color: #f8fbff;
}

body[data-theme="dark"] .modal-card .eyebrow,
body[data-theme="dark"] .modal-note,
body[data-theme="dark"] .modal-card p,
body[data-theme="dark"] .modal-card small {
  color: #b9c7db;
}

body[data-theme="dark"] .modal-card .modal-note {
  color: #aebdd2;
}

body[data-theme="dark"] .modal-input,
body[data-theme="dark"] .modal-body textarea,
body[data-theme="dark"] .modal-body select,
body[data-theme="dark"] .rich-editable {
  background: rgba(7, 15, 28, 0.98);
  border-color: rgba(188, 205, 230, 0.3);
  color: #f8fbff;
}

body[data-theme="dark"] .modal-input::placeholder,
body[data-theme="dark"] .modal-body textarea::placeholder,
body[data-theme="dark"] .rich-editable:empty::before {
  color: #8090a6;
}

body[data-theme="dark"] .modal-separator {
  border-top-color: rgba(188, 205, 230, 0.18);
}

body[data-theme="dark"] .modal-inline-actions button,
body[data-theme="dark"] .rich-toolbar button {
  background: rgba(18, 33, 56, 0.98);
  border-color: rgba(188, 205, 230, 0.26);
  color: #dbe9ff;
}

body[data-theme="dark"] .modal-inline-actions button:hover,
body[data-theme="dark"] .rich-toolbar button:hover {
  background: rgba(35, 62, 106, 0.96);
  border-color: rgba(126, 176, 255, 0.54);
  color: #ffffff;
}


body[data-theme="dark"] .status-button {
  background: rgba(28, 49, 80, 0.98);
  border-color: rgba(132, 174, 255, 0.35);
  color: #dbe9ff;
}

body[data-theme="dark"] .status-button:hover {
  background: rgba(43, 72, 113, 0.98);
  border-color: rgba(151, 190, 255, 0.56);
  color: #ffffff;
}

body[data-theme="dark"] .danger-button {
  background: rgba(77, 31, 31, 0.9);
  border-color: rgba(255, 161, 151, 0.36);
  color: #ffc6be;
}

body[data-theme="dark"] .danger-button:hover {
  background: rgba(103, 39, 38, 0.95);
  border-color: rgba(255, 178, 168, 0.56);
  color: #ffffff;
}

body[data-theme="dark"] .config-row strong.ready,
body[data-theme="dark"] .settings-status strong.ready {
  background: rgba(62, 185, 128, 0.18);
  border: 1px solid rgba(62, 185, 128, 0.34);
  color: #b4f7d8;
}

body[data-theme="dark"] .config-row strong.pending,
body[data-theme="dark"] .settings-status strong.pending {
  background: rgba(243, 196, 76, 0.18);
  border: 1px solid rgba(243, 196, 76, 0.34);
  color: #f5d88e;
}


body[data-theme="dark"] .status-button {
  background: rgba(28, 49, 80, 0.98);
  border-color: rgba(132, 174, 255, 0.35);
  color: #dbe9ff;
}

body[data-theme="dark"] .status-button:hover {
  background: rgba(43, 72, 113, 0.98);
  border-color: rgba(151, 190, 255, 0.56);
  color: #ffffff;
}

body[data-theme="dark"] .danger-button {
  background: rgba(77, 31, 31, 0.9);
  border-color: rgba(255, 161, 151, 0.36);
  color: #ffc6be;
}

body[data-theme="dark"] .danger-button:hover {
  background: rgba(103, 39, 38, 0.95);
  border-color: rgba(255, 178, 168, 0.56);
  color: #ffffff;
}

body[data-theme="dark"] .config-row strong.ready,
body[data-theme="dark"] .settings-status strong.ready {
  background: rgba(62, 185, 128, 0.18);
  border: 1px solid rgba(62, 185, 128, 0.34);
  color: #b4f7d8;
}

body[data-theme="dark"] .config-row strong.pending,
body[data-theme="dark"] .settings-status strong.pending {
  background: rgba(243, 196, 76, 0.18);
  border: 1px solid rgba(243, 196, 76, 0.34);
  color: #f5d88e;
}


body[data-theme="dark"] .command-panel {
  background: rgba(12, 23, 40, 0.96);
  border-color: rgba(188, 205, 230, 0.22);
  box-shadow: none;
}

body[data-theme="dark"] .quick-prompts button,
body[data-theme="dark"] .source-pill,
body[data-theme="dark"] .calendar-status span,
body[data-theme="dark"] .calendar-legend button,
body[data-theme="dark"] .segmented-control button {
  background: rgba(18, 33, 56, 0.96);
  border-color: rgba(188, 205, 230, 0.24);
  color: #cfe2ff;
}

body[data-theme="dark"] .quick-prompts button:hover,
body[data-theme="dark"] .source-pill:hover,
body[data-theme="dark"] .calendar-legend button:hover,
body[data-theme="dark"] .segmented-control button:hover {
  background: rgba(34, 58, 94, 0.98);
  border-color: rgba(109, 158, 255, 0.5);
}

body[data-theme="dark"] .source-pill.active,
body[data-theme="dark"] .source-pill.repcloud.active,
body[data-theme="dark"] .source-pill.customer.active,
body[data-theme="dark"] .source-pill.vendor.active,
body[data-theme="dark"] .source-pill.mine.active,
body[data-theme="dark"] .source-pill.unassigned.active,
body[data-theme="dark"] .source-pill.lead.active,
body[data-theme="dark"] .source-pill.apple.active,
body[data-theme="dark"] .source-pill.local.active,
body[data-theme="dark"] .source-pill.recent.active,
body[data-theme="dark"] .segmented-control button.active {
  background: #5b95ff;
  border-color: #7fb0ff;
  color: #ffffff;
}

body[data-theme="dark"] .contact-manager-summary > div,
body[data-theme="dark"] .address-row,
body[data-theme="dark"] .address-detail,
body[data-theme="dark"] .contact-health-card,
body[data-theme="dark"] .company-profile-panel,
body[data-theme="dark"] .company-profile-metrics > div,
body[data-theme="dark"] .company-person-row,
body[data-theme="dark"] .company-mail-event,
body[data-theme="dark"] .company-file-row,
body[data-theme="dark"] .contact-info-grid > div,
body[data-theme="dark"] .contact-mail-row,
body[data-theme="dark"] .contact-duplicate-list,
body[data-theme="dark"] .contact-mail-list {
  background: rgba(16, 29, 49, 0.96);
  border-color: rgba(188, 205, 230, 0.18);
  color: #edf4ff;
  box-shadow: none;
}

body[data-theme="dark"] .address-row:hover {
  background: rgba(24, 43, 70, 0.98);
  border-color: rgba(109, 158, 255, 0.45);
}

body[data-theme="dark"] .address-row.selected {
  background: linear-gradient(135deg, rgba(45, 83, 145, 0.98), rgba(18, 35, 62, 0.98));
  border-color: rgba(123, 172, 255, 0.76);
  box-shadow: inset 4px 0 0 #78a7ff;
}

body[data-theme="dark"] .contact-manager-summary span,
body[data-theme="dark"] .address-row p,
body[data-theme="dark"] .address-row small,
body[data-theme="dark"] .address-detail-card p,
body[data-theme="dark"] .contact-health-card p,
body[data-theme="dark"] .company-profile-head p,
body[data-theme="dark"] .company-profile-metrics span,
body[data-theme="dark"] .company-person-row small,
body[data-theme="dark"] .company-mail-event small,
body[data-theme="dark"] .company-mail-event span,
body[data-theme="dark"] .company-file-row span,
body[data-theme="dark"] .contact-info-grid span,
body[data-theme="dark"] .contact-mail-row span,
body[data-theme="dark"] .contact-mail-row p {
  color: #aebdd2;
}

body[data-theme="dark"] .company-profile-panel {
  background:
    linear-gradient(135deg, rgba(62, 109, 223, 0.16), rgba(55, 140, 116, 0.12)),
    rgba(16, 29, 49, 0.96);
}

body[data-theme="dark"] .company-person-row:hover,
body[data-theme="dark"] .company-mail-event:hover,
body[data-theme="dark"] .company-file-row:hover {
  background: rgba(24, 43, 70, 0.98);
}

body[data-theme="dark"] .company-person-row.selected {
  border-color: rgba(123, 172, 255, 0.76);
  box-shadow: inset 3px 0 0 #78a7ff;
}

body[data-theme="dark"] .contact-alert-pills span {
  background: rgba(91, 149, 255, 0.13);
  border-color: rgba(91, 149, 255, 0.25);
  color: #bcd6ff;
}

/* Contact formatting cleanup. */
body[data-view="contacts"] .address-detail {
  padding: 14px;
  border-radius: 11px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

body[data-view="contacts"] .address-detail-card {
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

body[data-view="contacts"] .address-detail-head {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: start;
  gap: 12px 14px;
}

body[data-view="contacts"] .address-detail-meta {
  min-width: 0;
}

body[data-view="contacts"] .address-detail-meta > .eyebrow,
body[data-view="contacts"] .address-detail-meta > h2,
body[data-view="contacts"] .address-detail-meta > p {
  min-width: 0;
  overflow-wrap: normal;
  word-break: normal;
  white-space: normal;
}

body[data-view="contacts"] .address-detail-meta > .eyebrow {
  white-space: nowrap;
}

body[data-view="contacts"] .address-detail-card h2 {
  margin-bottom: 2px;
  font-size: 21px;
  letter-spacing: -0.015em;
}

body[data-view="contacts"] .address-detail-card p {
  line-height: 1.4;
}

body[data-view="contacts"] .address-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
  padding-top: 2px;
}

body[data-view="contacts"] .address-actions .primary-button,
body[data-view="contacts"] .address-actions .ghost-button,
body[data-view="contacts"] .company-profile-head .ghost-button,
body[data-view="contacts"] .company-profile-head .primary-button {
  min-height: 32px;
  padding: 0 11px;
  border-radius: 7px;
  box-shadow: none;
  font-size: 13px;
}

body[data-view="contacts"] .contact-health-card,
body[data-view="contacts"] .company-profile-panel,
body[data-view="contacts"] .company-profile-metrics > div,
body[data-view="contacts"] .company-person-row,
body[data-view="contacts"] .company-mail-event,
body[data-view="contacts"] .company-file-row,
body[data-view="contacts"] .contact-info-grid > div,
body[data-view="contacts"] .contact-mail-row,
body[data-view="contacts"] .enrichment-row {
  border-radius: 9px;
  background: #fff;
  border-color: #dfe7ef;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

body[data-view="contacts"] .contact-health-card {
  background: #f8fbfe;
}

body[data-view="contacts"] .contact-health-ring {
  background: #eef4fb;
  color: #264f88;
}

body[data-view="contacts"] .contact-alert-pills span {
  border-color: #d9e2ec;
  background: #fff;
  color: #52637a;
  font-weight: 800;
}

body[data-view="contacts"] .company-profile-panel {
  background: #fff;
}

body[data-view="contacts"] .company-profile-head {
  align-items: flex-start;
}

body[data-view="contacts"] .company-profile-head h3 {
  margin-top: 0;
  font-size: 19px;
}

body[data-view="contacts"] .company-profile-metrics strong {
  font-size: 16px;
  letter-spacing: -0.01em;
}

body[data-view="contacts"] .company-profile-metrics span,
body[data-view="contacts"] .contact-info-grid span {
  letter-spacing: 0.06em;
}

body[data-view="contacts"] .company-person-row.selected {
  border-color: #bfd1ee;
  box-shadow: inset 3px 0 0 var(--accent);
}

body[data-view="contacts"] .company-person-row:hover,
body[data-view="contacts"] .company-mail-event:hover,
body[data-view="contacts"] .company-file-row:hover {
  background: #f8fbff;
}

body[data-view="contacts"] .contact-mail-row span,
body[data-view="contacts"] .company-mail-event span,
body[data-view="contacts"] .company-file-row span {
  color: #607086;
}

body[data-view="contacts"] .repcloud-contact-list,
body[data-view="contacts"] .repcloud-order-list {
  border-radius: 9px;
  border-color: #dfe7ef;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

body[data-theme="dark"][data-view="contacts"] .address-detail,
body[data-theme="dark"][data-view="contacts"] .contact-health-card,
body[data-theme="dark"][data-view="contacts"] .company-profile-panel,
body[data-theme="dark"][data-view="contacts"] .company-profile-metrics > div,
body[data-theme="dark"][data-view="contacts"] .company-person-row,
body[data-theme="dark"][data-view="contacts"] .company-mail-event,
body[data-theme="dark"][data-view="contacts"] .company-file-row,
body[data-theme="dark"][data-view="contacts"] .contact-info-grid > div,
body[data-theme="dark"][data-view="contacts"] .contact-mail-row,
body[data-theme="dark"][data-view="contacts"] .enrichment-row,
body[data-theme="dark"][data-view="contacts"] .repcloud-contact-list,
body[data-theme="dark"][data-view="contacts"] .repcloud-order-list {
  background: rgba(16, 29, 49, 0.96);
  border-color: rgba(188, 205, 230, 0.18);
  color: #edf4ff;
  box-shadow: none;
}

body[data-theme="dark"][data-view="contacts"] .contact-health-card {
  background: linear-gradient(135deg, rgba(34, 77, 152, 0.18), rgba(21, 48, 91, 0.96));
}

body[data-theme="dark"][data-view="contacts"] .company-profile-panel {
  background:
    linear-gradient(135deg, rgba(62, 109, 223, 0.16), rgba(55, 140, 116, 0.12)),
    rgba(16, 29, 49, 0.96);
}

body[data-theme="dark"][data-view="contacts"] .contact-health-ring {
  background: rgba(10, 21, 37, 0.96);
  color: #cfe0ff;
}

body[data-theme="dark"][data-view="contacts"] .contact-alert-pills span,
body[data-theme="dark"][data-view="contacts"] .marketing-list-badge {
  background: rgba(91, 149, 255, 0.13);
  border-color: rgba(91, 149, 255, 0.25);
  color: #d9e7ff;
}

body[data-theme="dark"][data-view="contacts"] .marketing-list-badge.muted {
  background: rgba(28, 39, 55, 0.94);
  border-color: rgba(188, 205, 230, 0.16);
}

body[data-theme="dark"][data-view="contacts"] .repcloud-list-options,
body[data-theme="dark"] .repcloud-list-options {
  background: rgba(10, 21, 37, 0.88);
  border-color: rgba(188, 205, 230, 0.16);
}

body[data-theme="dark"][data-view="contacts"] .repcloud-list-option,
body[data-theme="dark"] .repcloud-list-option {
  background: rgba(16, 29, 49, 0.94);
  border-color: rgba(91, 149, 255, 0.24);
}

body[data-theme="dark"][data-view="contacts"] .repcloud-list-option strong,
body[data-theme="dark"] .repcloud-list-option strong {
  color: #edf4ff;
}

body[data-theme="dark"][data-view="contacts"] .repcloud-list-heading small,
body[data-theme="dark"][data-view="contacts"] .repcloud-list-option small,
body[data-theme="dark"] .repcloud-list-heading small,
body[data-theme="dark"] .repcloud-list-option small {
  color: #aebdd2;
}

body[data-theme="dark"][data-view="contacts"] .address-detail-card h2,
body[data-theme="dark"][data-view="contacts"] .contact-health-card strong,
body[data-theme="dark"][data-view="contacts"] .company-profile-head h3,
body[data-theme="dark"][data-view="contacts"] .company-profile-metrics strong,
body[data-theme="dark"][data-view="contacts"] .contact-info-grid strong,
body[data-theme="dark"][data-view="contacts"] .company-person-row strong,
body[data-theme="dark"][data-view="contacts"] .company-mail-event strong,
body[data-theme="dark"][data-view="contacts"] .company-file-row strong,
body[data-theme="dark"][data-view="contacts"] .contact-mail-row strong {
  color: #edf4ff;
}

body[data-theme="dark"][data-view="contacts"] .address-detail-card p,
body[data-theme="dark"][data-view="contacts"] .contact-health-card p,
body[data-theme="dark"][data-view="contacts"] .company-profile-head p,
body[data-theme="dark"][data-view="contacts"] .company-profile-metrics span,
body[data-theme="dark"][data-view="contacts"] .company-person-row small,
body[data-theme="dark"][data-view="contacts"] .company-mail-event small,
body[data-theme="dark"][data-view="contacts"] .company-mail-event span,
body[data-theme="dark"][data-view="contacts"] .company-file-row span,
body[data-theme="dark"][data-view="contacts"] .contact-info-grid span,
body[data-theme="dark"][data-view="contacts"] .contact-mail-row span,
body[data-theme="dark"][data-view="contacts"] .contact-mail-row p,
body[data-theme="dark"][data-view="contacts"] .marketing-list-badge small,
body[data-theme="dark"][data-view="contacts"] .modal-note {
  color: #aebdd2;
}

body[data-theme="dark"][data-view="contacts"] .contact-info-grid a,
body[data-theme="dark"][data-view="contacts"] .company-file-row a,
body[data-theme="dark"][data-view="contacts"] .company-profile-panel a {
  color: #9fc0ff;
}

body[data-theme="dark"] .contact-health-dot,
body[data-theme="dark"] .contact-health-ring {
  background: rgba(10, 21, 37, 0.96);
  border-color: rgba(188, 205, 230, 0.22);
}

body[data-theme="dark"] .calendar-month {
  background: rgba(188, 205, 230, 0.16);
  border-color: rgba(188, 205, 230, 0.2);
}

body[data-theme="dark"] .calendar-month-head {
  background: rgba(11, 22, 39, 0.98);
  color: #9fb0c8;
}

body[data-theme="dark"] .calendar-month-day.today {
  box-shadow: inset 0 3px 0 #75a8ff;
}

body[data-theme="dark"] .calendar-month-day.outside {
  background: rgba(10, 20, 36, 0.88);
  color: #6f7f98;
}

body[data-theme="dark"] .calendar-event {
  background: rgba(91, 149, 255, 0.18);
  color: #e8f1ff;
}


body[data-theme="dark"] .task-check {
  border-color: rgba(238, 246, 255, 0.72);
}

body[data-theme="dark"] .dashboard-empty {
  border-color: rgba(238, 246, 255, 0.18);
}


body[data-theme="dark"] .message .avatar {
  background: rgba(84, 150, 255, 0.18);
  color: #cfe2ff;
}


body[data-view="assistant"] .command-panel {
  display: none;
}


@media (min-width: 1081px) {
  body[data-view="mail"] {
    overflow: hidden;
  }

  body[data-view="mail"] .app-shell,
  body[data-view="mail"] .workspace,
  body[data-view="mail"] .content-grid,
  body[data-view="mail"] .main-column,
  body[data-view="mail"] #view-mail {
    min-height: 0;
  }

  body[data-view="mail"] .app-shell,
  body[data-view="mail"] .workspace {
    height: 100vh;
    overflow: hidden;
  }

  body[data-view="mail"] .content-grid,
  body[data-view="mail"] .main-column,
  body[data-view="mail"] #view-mail {
    height: 100%;
    overflow: hidden;
  }

  body[data-view="mail"] #view-mail.view.active {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  body[data-view="mail"] .mail-workspace {
    min-height: 0;
    overflow: hidden;
    flex: 1 1 auto;
  }

  body[data-view="mail"] .mail-folder-rail,
  body[data-view="mail"] .mail-workspace .mail-table,
  body[data-view="mail"] .mail-reader {
    height: 100%;
    max-height: none;
    min-height: 0;
    overflow: auto;
  }
}


.metric {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 30px;
  font-weight: 800;
}

.status-band p {
  margin-bottom: 0;
  font-size: 13px;
}

.assistant-feed {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.capability-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.capability-grid article {
  padding: 16px;
  border: 1px solid rgba(220, 226, 230, 0.92);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(26, 32, 38, 0.05);
}

.capability-grid strong {
  display: block;
  margin-bottom: 8px;
}

.capability-grid p {
  margin-bottom: 0;
  font-size: 14px;
}

.message {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
}

.message p {
  margin-bottom: 0;
}

.avatar {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e6f1ff;
  color: var(--accent-dark);
  font-weight: 800;
  font-size: 13px;
}

.message.user .avatar {
  background: #f0dfc5;
  color: #795118;
}

.task-lane {
  padding: 16px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}


.section-heading.compact {
  margin-bottom: 12px;
}

.section-heading.compact span {
  min-width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e9f2ef;
  color: var(--accent-dark);
  font-weight: 800;
}


.task-list {
  max-height: 560px;
  overflow: auto;
  padding-right: 4px;
}


.task-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.task-item.compact-task {
  background: #fff;
  border-style: dashed;
}


.workspace-files-command {
  grid-template-columns: minmax(0, 1fr);
}


.source-pill.google {
  color: #1a56a8;
  background: #eef5ff;
}

.source-pill.dropbox {
  color: #0b5f59;
  background: #edf8f5;
}

.source-pill.mail {
  color: #8a4d12;
  background: #fff4e5;
}


@media (max-width: 1380px) {
  .docs-browser-content {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .docs-preview-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .docs-preview-details {
    max-height: 170px;
  }
}

.workspace-canonical-drive-frame {
  display: block;
  width: 100%;
  min-height: calc(100vh - 188px);
  border: 0;
  border-radius: 18px;
  background: var(--surface);
}

body[data-view="docs"] #file-list {
  min-height: calc(100vh - 188px);
}

@media (max-width: 760px) {
  .docs-preview-modal {
    padding: 10px;
  }

  .docs-preview-viewer {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
    min-height: 0;
    border-radius: 12px;
  }

  .docs-preview-header {
    align-items: stretch;
    flex-direction: column;
  }

  .docs-preview-header-actions {
    justify-content: flex-start;
  }

  .docs-preview-body {
    padding: 10px;
  }
}

/* Top navigation owns the first app-shell row on desktop. Reset the fixed
   sidebar geometry and the Workspace's normal second-column placement so the
   navigation cannot collapse into a full-height strip at the left. */
@media (min-width: 901px) {
  html.nav-layout-topbar .app-shell,
  body.nav-layout-topbar .app-shell {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
  }

  html.nav-layout-topbar .sidebar,
  body.nav-layout-topbar .sidebar {
    position: sticky !important;
    inset: 0 auto auto !important;
    grid-column: 1 !important;
    grid-row: 1 !important;
    align-self: start !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  html.nav-layout-topbar .nav-list,
  body.nav-layout-topbar .nav-list {
    width: 100% !important;
  }

  html.nav-layout-topbar .workspace,
  body.nav-layout-topbar .workspace {
    grid-column: 1 !important;
    grid-row: 2 !important;
    width: 100% !important;
    min-width: 0 !important;
  }
}

/* Keep the desktop/tablet category filters readable when the configured
   category set grows; phone layout keeps the compact single scroll row above. */
@media (min-width: 761px), (hover: hover) and (pointer: fine) {
  body[data-view="mail"] #view-mail.view.active > .mail-category-tabs {
    flex: 0 0 auto !important;
    flex-wrap: wrap !important;
    align-content: flex-start !important;
    min-height: 38px !important;
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    row-gap: 6px !important;
    padding-bottom: 7px !important;
  }

  body[data-view="mail"] #view-mail.view.active > .mail-category-tabs button {
    flex: 0 0 auto !important;
    max-width: calc(100vw - 36px) !important;
  }

  body[data-view="mail"] #view-mail.view.active > .mail-pager-bar {
    flex: 0 0 auto !important;
    margin-top: 0 !important;
  }
}


.google-doc-icon {
  color: #1a73e8;
  background: #e8f0fe;
}


.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.pill.red {
  color: #8f342b;
  background: #f7dedb;
}

.pill.amber {
  color: #795118;
  background: #f2e1c7;
}

.pill.blue {
  color: #28587f;
  background: #dfeaf2;
}


body .content-grid {
  grid-template-columns: minmax(0, 1fr);
}


.empty-card {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
}

.empty-card p {
  margin: 0;
}


.mini-button.approve {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.audit-status.is-muted {
  background: rgba(100, 116, 139, 0.12);
  color: #64748b;
}

.rich-editor.readonly .rich-editable {
  background: var(--panel-strong);
  color: var(--muted);
  cursor: default;
}


.activity-log {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.activity-log h2 {
  margin-bottom: 10px;
}

.activity-log ol {
  max-height: 170px;
  overflow: auto;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}


.calendar-strip,
.tool-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}


@keyframes mail-folder-pulse {
  from {
    opacity: 0.35;
  }

  to {
    opacity: 1;
  }
}


.mobile-reader-nav,
.mobile-reader-back {
  display: none;
}


.appointment-status {
  min-height: 18px;
}

.appointment-status.error {
  color: #b42318;
  font-weight: 800;
}


.reader-attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 4px 9px;
  background: #eef3f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}


.review-summary {
  margin-top: 18px;
}

.review-summary.compact {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.review-summary.compact div {
  min-width: 0;
  padding: 9px 10px;
}


.conversation-chain {
  margin-top: 12px;
  max-width: 980px;
}

.conversation-chain-list {
  display: grid;
  gap: 10px;
  justify-items: start;
}

.conversation-message {
  display: grid;
  width: min(100%, 920px);
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.conversation-message.selected {
  border-color: rgba(39, 110, 241, 0.42);
  background: #f5f9ff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.conversation-message.sent {
  background: #f7fcfa;
}

.conversation-message-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.conversation-message-head strong,
.conversation-message-head small,
.conversation-message p {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-message-head small,
.conversation-message p,
.conversation-message-head em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.conversation-message-head em {
  border-radius: 999px;
  padding: 4px 8px;
  background: #eef3f7;
}

.conversation-message.sent .conversation-message-head em {
  background: #daf5ea;
  color: #0f766e;
}

.conversation-message-preview {
  padding-left: 44px;
}


.email-html-preview {
  overflow: hidden;
  border: 1px solid #dfe4e8;
  border-radius: 8px;
  background: #fff;
}

.email-html-preview iframe {
  display: block;
  width: 100%;
  height: 260px;
  min-height: 150px;
  max-height: calc(100vh - 260px);
  border: 0;
  background: #fff;
}

.email-text-fallback {
  margin-top: 12px;
  color: #50606d;
}

.email-text-fallback summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}


.assistant-panel {
  margin-top: 14px;
  background: #fbfcfd;
}


.contacts-panel {
  display: none;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.contacts-panel.open {
  display: block;
}

.contacts-panel-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 360px);
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.contacts-panel-header h3 {
  margin: 2px 0 0;
  font-size: 20px;
}

.contacts-panel-header input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  font: inherit;
}

.contacts-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  max-height: 330px;
  overflow: auto;
  padding: 12px;
}

.address-book {
  display: grid;
  gap: 12px;
}

.address-book-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 220px;
  gap: 10px;
}

.address-book-toolbar input,
.address-book-toolbar select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.address-book-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.82fr) minmax(480px, 1.18fr);
  gap: 14px;
  align-items: start;
}

.address-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 190px);
  overflow: auto;
  padding-right: 4px;
}

.contact-manager-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 4px;
}

.contact-manager-summary > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.contact-manager-summary strong,
.contact-manager-summary span {
  display: block;
}

.contact-manager-summary strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}

.contact-manager-summary span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body[data-view="contacts"]:not(.native-shell) .contact-manager-summary {
  display: none;
}

.address-source-summary,
.address-page-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.address-page-strip {
  justify-content: space-between;
  padding: 8px 2px;
  color: var(--muted);
  font-weight: 800;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

button.source-pill {
  cursor: pointer;
}

.source-pill.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.source-pill.repcloud {
  border-color: rgba(39, 110, 241, 0.28);
  background: rgba(39, 110, 241, 0.1);
  color: var(--accent-dark);
}

.source-pill.repcloud.active,
.source-pill.customer.active,
.source-pill.vendor.active,
.source-pill.mine.active,
.source-pill.unassigned.active,
.source-pill.lead.active,
.source-pill.apple.active,
.source-pill.local.active,
.source-pill.recent.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.source-pill.lead {
  border-color: rgba(22, 163, 74, 0.28);
  background: rgba(22, 163, 74, 0.1);
  color: #15803d;
}

.source-pill.customer {
  border-color: rgba(39, 110, 241, 0.28);
  background: rgba(39, 110, 241, 0.1);
  color: var(--accent-dark);
}

.source-pill.vendor {
  border-color: rgba(245, 158, 11, 0.32);
  background: rgba(245, 158, 11, 0.12);
  color: #92400e;
}

.source-pill.mine {
  border-color: rgba(13, 148, 136, 0.3);
  background: rgba(13, 148, 136, 0.1);
  color: #0f766e;
}

.source-pill.unassigned {
  border-color: rgba(100, 116, 139, 0.28);
  background: rgba(100, 116, 139, 0.1);
  color: #475569;
}

.source-pill.apple {
  border-color: rgba(37, 99, 235, 0.22);
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
}

.source-pill.local {
  border-color: rgba(124, 58, 237, 0.22);
  background: rgba(124, 58, 237, 0.08);
  color: #6d28d9;
}

.source-pill.recent {
  border-color: rgba(14, 165, 166, 0.24);
  background: rgba(14, 165, 166, 0.1);
  color: #0f766e;
}

.address-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  cursor: pointer;
}

.address-row.review-checked {
  border-color: rgba(39, 110, 241, 0.34);
  background: rgba(39, 110, 241, 0.06);
}

.address-row.review-selectable {
  grid-template-columns: 28px 42px minmax(0, 1fr) auto;
}

.contact-review-select {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  cursor: pointer;
}

.contact-review-select input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.address-row:hover,
.address-row.selected {
  border-color: rgba(39, 110, 241, 0.45);
  background: #fff;
}

.address-row.selected {
  box-shadow: inset 4px 0 0 var(--accent), 0 10px 24px rgba(39, 110, 241, 0.1);
}

.address-row-meta {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.contact-health-dot,
.contact-health-ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-weight: 950;
  line-height: 1;
}

.contact-health-dot {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.contact-health-ring {
  width: 52px;
  height: 52px;
  font-size: 15px;
}

.contact-health-dot.good,
.contact-health-ring.good {
  border-color: rgba(34, 197, 94, 0.32);
  background: rgba(34, 197, 94, 0.1);
  color: #15803d;
}

.contact-health-dot.ok,
.contact-health-ring.ok {
  border-color: rgba(245, 158, 11, 0.32);
  background: rgba(245, 158, 11, 0.12);
  color: #a16207;
}

.contact-health-dot.warn,
.contact-health-ring.warn {
  border-color: rgba(239, 68, 68, 0.28);
  background: rgba(239, 68, 68, 0.08);
  color: #b91c1c;
}

.address-row strong,
.address-row p {
  overflow-wrap: anywhere;
}

.address-row p {
  margin: 3px 0 0;
  font-size: 13px;
}

.address-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.address-detail {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 170px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(26, 32, 38, 0.07);
}

.address-detail-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}


.address-detail-card h2 {
  margin-bottom: 4px;
  font-size: 24px;
}

.address-detail-card p {
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

.address-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.contact-health-card,
.enrichment-summary {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(39, 110, 241, 0.22);
  border-radius: 8px;
  background: rgba(39, 110, 241, 0.06);
}

.contact-review-queue-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(39, 110, 241, 0.2);
  border-radius: 8px;
  background: rgba(39, 110, 241, 0.05);
}

.contact-review-queue-card.empty {
  gap: 4px;
  background: rgba(255, 255, 255, 0.72);
}

.contact-review-queue-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.repcloud-write-preview {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(39, 110, 241, 0.2);
  border-radius: 8px;
  background: rgba(39, 110, 241, 0.06);
}

.repcloud-write-preview p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.repcloud-write-preview dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.repcloud-write-preview dl > div {
  min-height: 48px;
  padding: 8px;
  border: 1px solid rgba(39, 110, 241, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.repcloud-write-preview dt,
.repcloud-write-preview dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.repcloud-write-preview dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.repcloud-write-preview dd {
  margin-top: 3px;
  color: var(--ink);
  font-weight: 850;
}

.contact-health-card > div:first-child,
.enrichment-summary > div {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.contact-health-card strong,
.enrichment-summary strong {
  display: block;
  margin-bottom: 4px;
}

.contact-health-card p,
.enrichment-summary p {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
}

.contact-alert-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.contact-alert-pills span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border: 1px solid rgba(39, 110, 241, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
}

.company-profile-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(39, 110, 241, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(39, 110, 241, 0.08), rgba(82, 177, 138, 0.08)),
    rgba(255, 255, 255, 0.82);
}

.company-profile-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.company-profile-head h3 {
  margin: 2px 0 4px;
  font-size: 24px;
}

.company-profile-head p {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
}

.company-profile-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.company-profile-metrics > div {
  min-height: 62px;
  padding: 10px;
  border: 1px solid rgba(39, 110, 241, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.company-profile-metrics strong,
.company-profile-metrics span {
  display: block;
  overflow-wrap: anywhere;
}

.company-profile-metrics strong {
  color: var(--ink);
  font-size: 18px;
}

.company-profile-metrics span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.company-profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 12px;
}

.review-section-header.compact {
  margin-bottom: 8px;
}

.review-section-header.compact h3 {
  font-size: 15px;
}

.company-people-list,
.company-mail-timeline,
.company-file-list {
  display: grid;
  gap: 8px;
}

.company-person-row,
.company-mail-event,
.company-file-row {
  width: 100%;
  min-height: 52px;
  padding: 9px 10px;
  border: 1px solid rgba(39, 110, 241, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  text-align: left;
}

.company-person-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.company-person-row.selected {
  border-color: rgba(39, 110, 241, 0.62);
  box-shadow: inset 3px 0 0 var(--accent);
}

.company-person-row strong,
.company-person-row small,
.company-mail-event strong,
.company-mail-event small,
.company-file-row strong,
.company-file-row span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-person-row small,
.company-mail-event small,
.company-mail-event span,
.company-file-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.company-mail-event {
  display: grid;
  gap: 3px;
}

.company-mail-event:hover,
.company-person-row:hover,
.company-file-row:hover {
  border-color: rgba(39, 110, 241, 0.38);
  background: #fff;
}

.company-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  text-decoration: none;
}

.contact-info-grid,
.contact-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.contact-info-grid > div {
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.contact-info-grid span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.contact-info-grid strong {
  display: block;
  overflow-wrap: anywhere;
}

.contact-edit-grid .wide-field {
  grid-column: 1 / -1;
}

.contact-mail-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.contact-duplicate-list,
.enrichment-list {
  display: grid;
  gap: 8px;
}

.contact-mail-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  overflow: hidden;
}

.contact-mail-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-mail-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.enrichment-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.enrichment-row input {
  margin-top: 4px;
}

.enrichment-row strong,
.enrichment-row p,
.enrichment-row small {
  display: block;
}

.enrichment-row p {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
}

.enrichment-row p span {
  display: inline-flex;
  min-width: 72px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.enrichment-row small {
  margin-top: 8px;
  color: var(--muted);
  font-weight: 800;
}

.marketing-list-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.marketing-list-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(39, 110, 241, 0.24);
  border-radius: 8px;
  background: rgba(39, 110, 241, 0.08);
  color: var(--ink);
  font-weight: 850;
}

.marketing-list-badge small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.marketing-list-badge.muted {
  border-color: var(--line);
  background: rgba(242, 245, 248, 0.86);
}

.repcloud-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.repcloud-list-heading small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.repcloud-list-options {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  max-height: 180px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(248, 251, 255, 0.7);
}

.repcloud-list-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: flex-start;
  padding: 8px 10px;
  border: 1px solid rgba(39, 110, 241, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

.repcloud-list-option input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.repcloud-list-option strong,
.repcloud-list-option small {
  display: block;
}

.repcloud-list-option strong {
  color: var(--ink);
  font-weight: 900;
}

.repcloud-list-option small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.repcloud-account-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.repcloud-account-results {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  max-height: 240px;
  overflow: auto;
}

.repcloud-account-option {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.repcloud-account-option:hover,
.repcloud-account-option.selected {
  border-color: rgba(39, 110, 241, 0.42);
  background: rgba(39, 110, 241, 0.08);
}

.repcloud-account-option span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.contact-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(102, 113, 125, 0.16);
  border-radius: 8px;
  background: #fbfefd;
}

.contact-row strong,
.contact-row p {
  overflow-wrap: anywhere;
}

.contact-row p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.contact-row > span:last-child {
  align-self: start;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}


@media (hover: hover) and (pointer: fine) {
  .mail-row.swipe-open > :not(.mail-swipe-actions),
  .mail-row.swiping > :not(.mail-swipe-actions) {
    transform: none;
  }

  .mail-swipe-actions {
    display: none !important;
  }
}


.attachment-indicator {
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
}


body.native-compose-window {
  width: 100vw;
  height: 100vh;
  margin: 0;
  overflow: hidden;
  background: #f4f6f9;
}

html.native-compose-boot,
html.native-compose-boot body {
  margin: 0;
  overflow: hidden;
  background: #f4f6f9;
}

html.native-compose-boot body:not(.native-compose-window)::before {
  content: "Opening reply draft";
  position: fixed;
  inset: 0 0 auto;
  z-index: 2147483646;
  display: grid;
  place-items: center;
  height: 42px;
  background: #2f75d1;
  color: #fff;
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 0;
  -webkit-app-region: drag;
}

html.native-compose-boot body:not(.native-compose-window)::after {
  content: "Preparing the editor...";
  position: fixed;
  top: 96px;
  left: 50%;
  z-index: 2147483646;
  width: min(420px, calc(100vw - 72px));
  transform: translateX(-50%);
  padding: 72px 28px 30px;
  border: 1px solid #d9dde3;
  border-radius: 10px;
  background:
    linear-gradient(90deg, transparent 0 64px, #eef2f7 64px 100%),
    linear-gradient(#fff, #fff);
  color: #667085;
  font-size: 14px;
  font-weight: 750;
  text-align: center;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.12);
}

html.native-compose-boot body:not(.native-compose-window) .app-shell,
html.native-compose-boot body:not(.native-compose-window) .login-screen,
html.native-compose-boot body:not(.native-compose-window) .toast,
body.native-compose-window.native-compose-closing .app-shell,
body.native-compose-window.native-compose-closing .login-screen,
body.native-compose-window.native-compose-closing .toast {
  visibility: hidden;
}

body.native-compose-window .modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  border-radius: 0;
  overflow: hidden;
}

body.native-compose-window .modal::backdrop {
  background: #f4f6f9;
  backdrop-filter: none;
}

body.native-compose-window .modal-card {
  grid-template-rows: 42px auto minmax(0, 1fr);
  gap: 0;
  width: 100vw;
  height: 100vh;
  max-height: none;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

body.native-compose-window .modal-header {
  display: grid;
  grid-row: 1;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 42px;
  -webkit-app-region: drag;
  padding: 0 18px;
  background: #2f75d1;
  color: #fff;
}

body.native-compose-window .modal-header > div {
  grid-column: 2;
  min-width: 0;
  text-align: center;
}

body.native-compose-window .modal-header .eyebrow {
  display: none;
}

body.native-compose-window .modal-header h2 {
  overflow: hidden;
  margin: 0;
  color: #fff;
  font-size: 14px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.native-compose-window .modal-header .icon-button {
  display: none;
}

body.native-compose-window .modal-actions {
  grid-row: 2;
  justify-content: flex-start;
  gap: 4px;
  min-height: 54px;
  padding: 8px 18px;
  border-top: 0;
  border-bottom: 1px solid #d9dde3;
  background: #f2f3f5;
}

body.native-compose-window .modal-actions .primary-button,
body.native-compose-window .modal-actions .ghost-button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  box-shadow: none;
}

body.native-compose-window .modal-actions .primary-button {
  background: #2f75d1;
}

body.native-compose-window .modal-actions .ghost-button {
  background: transparent;
  color: #2f343a;
}

body.native-compose-window .native-compose-command {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding-inline: 12px;
  font-size: 14px;
  font-weight: 760;
}

body.native-compose-window .native-compose-command span {
  display: inline-grid;
  place-items: center;
  width: 18px;
  color: currentColor;
  font-size: 16px;
  line-height: 1;
}

body.native-compose-window .modal-body {
  grid-row: 3;
  align-content: start;
  gap: 0;
  padding: 0 24px 22px;
  overflow: auto;
  background: #fff;
}


body.native-compose-window .rich-editor {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
}

body.native-compose-window .rich-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  gap: 4px;
  min-height: 50px;
  padding: 8px 0;
  border-bottom: 0;
  background: #fff;
}

body.native-compose-window .rich-toolbar button {
  min-width: 34px;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: #fff;
  color: #525a63;
  font-size: 14px;
  box-shadow: none;
}

body.native-compose-window .rich-toolbar button:hover {
  background: #eef3fb;
  color: #172032;
}

body.native-compose-window .compose-color-control {
  min-height: 34px;
  border: 0;
  background: #fff;
  color: #525a63;
}

body.native-compose-window .compose-color-control:hover {
  background: #eef3fb;
  color: #172032;
}

.rich-toolbar-divider {
  align-self: stretch;
  width: 1px;
  margin: 5px 6px;
  background: #dfe3e8;
}

body.native-compose-window .rich-editable {
  box-sizing: border-box;
  height: calc(100vh - 320px);
  min-height: 320px;
  max-height: calc(100vh - 320px);
  overflow: auto;
  resize: none;
  padding: 26px 24px 40px;
  border-top: 1px solid #eceff3;
  font-size: 15px;
  line-height: 1.55;
}

body.native-compose-window .assistant-original-quote {
  margin-top: 26px !important;
  border-left: 0 !important;
  border-top: 1px solid #c8d5ea;
  padding: 12px 0 0 !important;
  color: #1f252b !important;
}


.category-rules-list {
  display: grid;
  gap: 8px;
}

.category-rule-row {
  display: grid;
  grid-template-columns: minmax(140px, 180px) minmax(0, 1fr);
  gap: 8px;
}


.role-control-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}

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

.role-control-check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 8px;
  align-items: start;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.78);
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.role-control-check input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 42px;
  height: 24px;
  margin: 0;
  border: 1px solid rgba(148, 163, 184, 0.72);
  border-radius: 999px;
  background: #e2e8f0;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.12);
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.role-control-check input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.28);
  transition: transform 0.16s ease;
}

.role-control-check input:checked {
  border-color: rgba(37, 99, 235, 0.82);
  background: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.role-control-check input:checked::after {
  transform: translateX(18px);
}

.role-control-check:has(input:checked) {
  border-color: rgba(37, 99, 235, 0.32);
  background: rgba(37, 99, 235, 0.07);
}

.role-control-check span {
  font-weight: 850;
  color: var(--ink);
}

.role-control-check small {
  grid-column: 2;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.25;
}

.api-access-panel {
  display: grid;
  gap: 12px;
}

.api-access-current {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid rgba(39, 110, 241, 0.18);
  border-radius: 8px;
  background: #edf5ff;
}

.api-access-current span,
.api-key-list span,
.api-profile-grid span,
.api-key-list small,
.api-profile-grid small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.api-access-current strong {
  color: var(--accent-dark);
  font-size: 18px;
}

.api-key-create-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 220px) auto;
  gap: 8px;
  align-items: center;
}

.api-key-create-row select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.api-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.api-profile-grid article,
.api-key-list article {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.api-profile-grid strong,
.api-key-list strong {
  color: var(--ink);
  font-size: 14px;
}

.api-key-list {
  display: grid;
  gap: 8px;
}

.api-key-list article {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.api-key-list article.revoked {
  opacity: 0.58;
}

.attachment-card {
  background: #fbfefd;
}

.attachment-list {
  display: grid;
  gap: 8px;
}

.attachment-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.attachment-row:hover {
  border-color: rgba(37, 99, 235, 0.32);
  background: #f4f8ff;
}

.attachment-row.calendar {
  border-color: rgba(37, 99, 235, 0.28);
  background: #f6f9ff;
}

.attachment-row.calendar .attachment-icon {
  background: #e7f1ff;
  color: #1d4ed8;
}

.attachment-row strong,
.attachment-row small {
  display: block;
  overflow-wrap: anywhere;
}

.attachment-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.attachment-row em {
  color: var(--accent-dark);
  font-style: normal;
  font-weight: 850;
}

.attachment-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e7f1ee;
  color: var(--accent-dark);
}

.attachment-preview-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.attachment-preview-frame {
  display: grid;
  place-items: center;
  min-height: min(68vh, 720px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #eef3f8;
}

.attachment-preview-frame object,
.attachment-preview-frame iframe {
  width: 100%;
  height: min(68vh, 720px);
  border: 0;
  background: #fff;
}

.attachment-preview-frame img {
  display: block;
  max-width: 100%;
  max-height: min(68vh, 720px);
  object-fit: contain;
}

.attachment-preview-csv,
.attachment-preview-raw {
  width: 100%;
  max-height: min(68vh, 720px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.attachment-preview-raw {
  margin: 0;
  padding: 18px 20px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

.attachment-preview-table-wrap {
  width: 100%;
  max-height: min(68vh, 720px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.attachment-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.attachment-preview-table th,
.attachment-preview-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.attachment-preview-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(255, 255, 255, 0.98);
  font-weight: 800;
}

body[data-theme="dark"] .attachment-preview-table th {
  background: rgba(20, 26, 39, 0.98);
}

.attachment-preview-table tbody tr:nth-child(even) td {
  background: rgba(121, 146, 182, 0.05);
}

.attachment-preview-unavailable {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 38px 22px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--panel);
  text-align: center;
}

.attachment-preview-unavailable p {
  margin: 0;
  color: var(--muted);
}

.quick-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.quick-labels .mini-button.selected {
  border-color: rgba(39, 110, 241, 0.4);
  background: #eaf2ff;
  color: var(--accent-dark);
}

.task-suggestion-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}


.skeleton-line,
.skeleton-box {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(31, 92, 174, 0.08);
}

.skeleton-line {
  height: 12px;
}

.skeleton-line.wide {
  width: 92%;
}

.skeleton-line.medium {
  width: 68%;
}

.skeleton-box {
  height: 140px;
}

.skeleton-line::after,
.skeleton-box::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-120%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  animation: skeleton-shimmer 1.2s infinite;
}

@keyframes skeleton-shimmer {
  100% {
    transform: translateX(120%);
  }
}


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


body[data-theme="dark"] .reader-attachment-pill {
  background: rgba(226, 236, 249, 0.1);
  color: #c6d2e1;
}


body[data-theme="dark"] .attachment-row:hover {
  border-color: rgba(91, 149, 255, 0.52);
  background: #14243a;
}

body[data-theme="dark"] .attachment-preview-frame {
  border-color: rgba(226, 236, 249, 0.16);
  background: #08111f;
}

body[data-theme="dark"] .conversation-message.selected {
  border-color: rgba(91, 149, 255, 0.48);
  background: #14243a;
}

body[data-theme="dark"] .conversation-message.sent {
  background: rgba(13, 42, 38, 0.72);
}

body[data-theme="dark"] .conversation-message-head em {
  background: rgba(226, 236, 249, 0.1);
  color: #c6d2e1;
}

body[data-theme="dark"] .conversation-message.sent .conversation-message-head em {
  background: rgba(45, 212, 191, 0.16);
  color: #9ff0e6;
}


body[data-theme="dark"] .skeleton-line,
body[data-theme="dark"] .skeleton-box {
  background: rgba(91, 149, 255, 0.14);
}

body[data-theme="dark"] .skeleton-line::after,
body[data-theme="dark"] .skeleton-box::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
}


body[data-theme="dark"] .email-text-fallback {
  color: #bac7d8;
}

body[data-theme="dark"] .email-html-preview,
body[data-theme="dark"] .email-html-preview iframe {
  background: #f4f6f8;
}

.repcloud-context {
  background: #fbfefd;
  border-color: rgba(123, 178, 172, 0.42);
  overflow: hidden;
}

.repcloud-context-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  padding: 16px;
  margin: -16px -16px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f5fbf9);
}

.repcloud-context-header h3 {
  margin-bottom: 3px;
  font-size: 22px;
  line-height: 1.1;
}

.repcloud-context-header p {
  margin: 0;
  max-width: 720px;
  font-size: 14px;
}

.repcloud-context-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.repcloud-context-actions a,
.repcloud-context-actions button {
  white-space: nowrap;
}

.repcloud-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  margin: 14px 0 16px;
}

.repcloud-kpis div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.repcloud-kpis span,
.repcloud-subhead span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.repcloud-kpis strong {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.repcloud-context-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: 16px;
}

.customer-workflow-panel {
  border-color: rgba(15, 118, 110, 0.24);
  background: linear-gradient(180deg, #f8fffc, #ffffff);
}

.customer-workflow-panel.compact-workflow {
  padding: 12px 14px;
}

.workflow-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
}

.playbook-picker {
  display: grid;
  grid-template-columns: minmax(180px, 240px) auto;
  gap: 8px;
  align-items: end;
  justify-content: end;
}

.playbook-picker label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.playbook-select {
  min-height: 40px;
  padding: 0 34px 0 12px;
  font-size: 14px;
  font-weight: 800;
}

.workflow-head h3 {
  margin: 2px 0 4px;
  font-size: 16px;
}

.workflow-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.workflow-action-card {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  border-color: rgba(37, 99, 235, 0.22);
  background: linear-gradient(135deg, #f8fbff, #ffffff 58%, #f6fffb);
}


.workflow-action-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.workflow-action-main .eyebrow {
  font-size: 10px;
}

.workflow-action-main strong {
  display: block;
  margin: 1px 0 1px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 950;
}

.workflow-action-main h3 {
  margin: 1px 0 2px;
  font-size: 15px;
}

.workflow-action-main p {
  max-width: 860px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.workflow-action-main .primary-button,
.workflow-action-main .ghost-button {
  min-height: 36px;
  padding: 0 14px;
  white-space: nowrap;
}

.workflow-action-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.workflow-action-grid .mini-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.workflow-recovery-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  color: var(--muted);
  font-size: 12px;
}

.workflow-recovery-actions span {
  font-weight: 850;
  color: var(--ink);
}

.workflow-recovery-actions .mini-button {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.workflow-evidence-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}


.workflow-evidence-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.workflow-evidence-chip em,
.workflow-evidence-chip strong {
  min-width: 0;
  padding: 4px 7px;
  font-style: normal;
  font-size: 11px;
  line-height: 1.1;
}

.workflow-evidence-chip em {
  border-right: 1px solid rgba(148, 163, 184, 0.22);
  color: var(--muted);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.workflow-evidence-chip strong {
  overflow: hidden;
  color: var(--ink);
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-evidence-more {
  display: inline-flex;
  align-items: center;
}

.workflow-evidence-more summary {
  min-height: 24px;
  padding: 4px 9px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
}

.workflow-evidence-more[open] {
  display: grid;
  gap: 6px;
  width: 100%;
}


.workflow-label-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 10px;
}

.workflow-details {
  margin-top: 8px;
}

.workflow-details summary {
  cursor: pointer;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}


.workflow-step-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding-left: 22px;
}

.workflow-step-list li {
  color: #40515f;
  line-height: 1.35;
}

.repcloud-subhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.repcloud-order-list,
.repcloud-contact-list {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.repcloud-order-row,
.repcloud-contact-row {
  display: grid;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
}

.repcloud-order-row:last-child,
.repcloud-contact-row:last-child {
  border-bottom: 0;
}

.repcloud-order-row {
  grid-template-columns: minmax(0, 1fr) auto 48px;
}

.repcloud-contact-row {
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr);
}

.repcloud-order-row strong,
.repcloud-contact-row strong {
  display: block;
  overflow-wrap: anywhere;
}

.repcloud-order-row span,
.repcloud-contact-row small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.repcloud-contact-row strong span {
  display: inline-block;
  margin-left: 6px;
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.repcloud-order-row em {
  color: var(--ink);
  font-style: normal;
  font-weight: 850;
}

.text-link {
  border: 0;
  border-radius: 0;
  min-height: auto;
  padding: 0;
  background: transparent;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}

.muted-line {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}


.calendar-strip {
  grid-template-columns: 1fr;
}

.calendar-control-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.calendar-control-bar > div:first-child strong {
  display: block;
  font-size: 18px;
}

.calendar-status {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.calendar-status span,
.segmented-control button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.calendar-status span {
  padding: 6px 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.segmented-control {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.segmented-control button {
  min-height: 34px;
  padding: 0 10px;
  color: var(--ink);
  font-weight: 850;
}

.segmented-control button.active {
  border-color: rgba(39, 110, 241, 0.35);
  background: var(--accent);
  color: #fff;
}

.calendar-workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.calendar-main {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.calendar-month {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  max-width: 100%;
  background: var(--line);
}

.calendar-month.week-view {
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  grid-template-rows: auto 1fr;
  overflow-x: auto;
}

.calendar-month.day-view {
  grid-template-columns: minmax(0, 1fr);
}

.calendar-month.day-view .calendar-month-day {
  min-height: 520px;
  padding: 18px;
}

.calendar-month.week-view .calendar-month-day {
  min-height: 460px;
}

.calendar-month.day-view .calendar-events {
  gap: 10px;
}

.calendar-month.day-view .calendar-event {
  display: grid;
  gap: 4px;
  padding: 12px;
  font-size: 14px;
}

.calendar-month.day-view .calendar-add-slot {
  min-height: 46px;
}

.calendar-month-head {
  min-height: 36px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  background: #f7f9f8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.calendar-month-day {
  min-height: 128px;
  border: 0;
  background: #fff;
  padding: 10px;
  color: var(--ink);
  text-align: left;
  position: relative;
}

.calendar-month-day:hover {
  background: #fbfefd;
}

.calendar-month-day.today {
  box-shadow: inset 0 3px 0 var(--accent);
}

.calendar-month-day.outside {
  background: #f8faf9;
  color: var(--muted);
}

.calendar-month-day > span {
  display: inline-flex;
  min-width: 28px;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 800;
}

.calendar-month-day.today > span {
  background: var(--accent);
  color: #fff;
}

.calendar-events {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.calendar-event {
  display: block;
  position: relative;
  z-index: 2;
  width: 100%;
  border: 0;
  border-left: 3px solid rgba(39, 110, 241, 0.42);
  border-radius: 4px;
  background: #edf5ff;
  padding: 5px 7px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.25;
  cursor: pointer;
  text-align: left;
}

.calendar-add-slot {
  width: 100%;
  border: 1px dashed transparent;
  border-radius: 4px;
  background: transparent;
  padding: 4px 6px;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  line-height: 1.25;
  cursor: pointer;
  text-align: left;
}

.calendar-add-slot:hover {
  border-color: var(--line);
  background: #f7fbfa;
  color: var(--accent-dark);
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 12px;
}

.calendar-legend button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 6px 9px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.calendar-legend button.muted {
  opacity: 0.48;
}

.calendar-legend i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

.calendar-legend .personal i {
  background: #9b7a2f;
}

.calendar-legend .meeting i {
  background: #2563eb;
}

.calendar-legend .campaign i {
  background: #b45309;
}

.calendar-legend .hold i {
  background: #7c3aed;
}

.calendar-legend .travel i {
  background: #0891b2;
}

.calendar-legend .work i {
  background: var(--accent);
}

.calendar-legend strong {
  color: var(--muted);
  font-size: 11px;
}

.calendar-event strong {
  display: block;
  margin-bottom: 2px;
  color: var(--accent-dark);
}

.calendar-event.personal {
  border-left-color: #9b7a2f;
  background: #fbf2de;
}

.calendar-event.meeting {
  border-left-color: #2563eb;
  background: #eaf1ff;
}

.calendar-event.campaign {
  border-left-color: #b45309;
  background: #fff2df;
}

.calendar-event.hold {
  border-left-color: #7c3aed;
  background: #f2edff;
}

.calendar-event.travel {
  border-left-color: #0891b2;
  background: #e6f8fb;
}

.calendar-event.scheduled {
  border-left-color: #db2777;
  background: #fdf2f8;
}

.calendar-event.work {
  border-left-color: var(--accent);
  background: #edf5ff;
}

.calendar-events small,
.calendar-events p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  letter-spacing: 0;
  text-transform: none;
}

.file-list span,
.rules-list span {
  display: inline-flex;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}


.calendar-agenda,
.calendar-sidebar {
  display: grid;
  gap: 12px;
}

.calendar-sidebar {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.calendar-agenda,
.calendar-sidebar .review-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.calendar-mail-item,
.calendar-decision-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 12px 0 0;
  margin-top: 12px;
}

.calendar-decision-card {
  grid-template-columns: 1fr;
  align-items: start;
}

.calendar-decision-card > div {
  min-width: 0;
}

.calendar-decision-card strong,
.calendar-decision-card p {
  overflow-wrap: anywhere;
}

.calendar-decision-card .inline-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.calendar-mail-item p,
.calendar-decision-card p {
  margin: 4px 0 0;
  color: var(--muted);
}

.appointment-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px 120px 130px 140px;
  gap: 12px;
}

.appointment-form label {
  display: grid;
  gap: 6px;
}

.appointment-form .wide {
  grid-column: 1 / -1;
}

.appointment-form textarea {
  min-height: 120px;
}

.appointment-video-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.appointment-invitee-picker {
  position: relative;
}

.appointment-invitee-box {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 6px 8px;
  background: #fff;
}

.appointment-invitee-box:focus-within {
  border-color: rgba(37, 99, 235, 0.72);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.appointment-invitee-chips {
  display: contents;
}

.appointment-invitee-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(360px, 100%);
  border: 1px solid #c6d9f6;
  border-radius: 999px;
  padding: 4px 6px 4px 4px;
  background: #eef5ff;
  color: var(--ink);
}

.appointment-invitee-chip.is-readonly {
  padding-right: 10px;
}


.appointment-invitee-chip-text {
  display: grid;
  min-width: 0;
  line-height: 1.1;
}

.appointment-invitee-chip-text strong,
.appointment-invitee-chip-text small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appointment-invitee-chip-text small {
  color: var(--muted);
  font-size: 11px;
}

.appointment-invitee-chip button {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.appointment-invitee-chip button:hover {
  background: rgba(59, 106, 204, 0.12);
  color: var(--ink);
}

.appointment-invitee-input {
  flex: 1 1 240px;
  min-width: 180px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
}

.appointment-invitee-suggestions {
  position: absolute;
  z-index: 45;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  display: none;
  max-height: 300px;
  overflow: auto;
  border: 1px solid rgba(59, 106, 204, 0.28);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
}

.appointment-invitee-suggestions.is-open {
  display: grid;
}

.appointment-invitee-option {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.appointment-invitee-option:last-child {
  border-bottom: 0;
}

.appointment-invitee-option:hover,
.appointment-invitee-option.active {
  background: #e8f1ff;
}

.appointment-invitee-option strong,
.appointment-invitee-option small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appointment-invitee-option small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.calendar-invitee-detail-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  margin-bottom: 0;
}

.event-detail-grid .calendar-invitee-detail-chips .appointment-invitee-chip {
  display: inline-flex;
  width: auto;
  max-width: 100%;
  min-height: 30px;
  margin: 0;
  gap: 7px;
  padding: 4px 10px 4px 4px;
  vertical-align: middle;
}

.event-detail-grid .calendar-invitee-detail-chips .compose-recipient-avatar {
  display: inline-grid;
  width: 22px;
  height: 22px;
  min-width: 22px;
  margin: 0;
  font-size: 9px;
  line-height: 1;
}

.event-detail-grid .calendar-invitee-detail-chips .appointment-invitee-chip-text {
  display: block;
  min-width: 0;
  margin: 0;
}

.event-detail-grid .calendar-invitee-detail-chips .appointment-invitee-chip-text strong {
  display: block;
  max-width: 220px;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: none;
  letter-spacing: 0;
}

.event-detail-grid .calendar-invitee-detail-chips .appointment-invitee-chip-text small {
  display: none;
}

.event-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.event-detail-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.event-detail-grid .wide {
  grid-column: 1 / -1;
}

.event-detail-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.rules-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.rules-list article.rule-card {
  gap: 16px;
  align-items: stretch;
}

.rule-starter-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
}

.rule-starter-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.rule-starter-summary div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.rule-starter-summary strong,
.rule-starter-summary span {
  display: block;
}

.rule-starter-summary strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}

.rule-starter-summary span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rule-starter-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.rule-template-button {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.rule-template-button:hover {
  border-color: rgba(39, 110, 241, 0.35);
  background: rgba(39, 110, 241, 0.06);
}

.rule-template-button strong,
.rule-template-button span {
  display: block;
}

.rule-template-button span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.rule-card-main {
  display: grid;
  gap: 14px;
}

.rule-card-header {
  display: flex;
  gap: 12px;
  align-items: start;
  justify-content: space-between;
}

.rule-card-header p {
  margin: 4px 0 0;
}

.rule-status {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.rule-status.active {
  border-color: #bfe1d5;
  background: #e8f6f0;
  color: var(--accent-dark);
}

.rule-recipe-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.rule-recipe-grid div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #f8fafb;
}

.rule-recipe-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rule-recipe-grid b {
  display: block;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.rule-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: center;
  justify-content: flex-end;
}

.rule-readonly-note,
.rule-panel-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.rule-readonly-note {
  align-self: center;
  justify-self: end;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--panel-strong);
  white-space: nowrap;
}

.rule-panel-note {
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.status-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--accent-dark);
  padding: 0 12px;
  font-weight: 800;
}

.tool-grid article {
  display: grid;
  gap: 10px;
}

.tool-grid .mini-button {
  justify-self: start;
}

.repcloud-desk-card.wide {
  grid-column: 1 / -1;
}

.repcloud-desk-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.repcloud-desk-header p {
  margin: 4px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.sales-scope-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.sales-scope-control select {
  min-width: 150px;
  max-width: 230px;
  padding: 7px 30px 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

.repcloud-health-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.repcloud-health-grid div,
.mini-row.static {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 10px;
}

.repcloud-health-grid span,
.mini-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.repcloud-health-grid b,
.mini-row b {
  display: block;
  margin-top: 3px;
  color: var(--ink);
}

.desk-tool-stack,
.mini-list {
  display: grid;
  gap: 8px;
}

.rma-vendor-candidates {
  margin-top: 8px;
}

.rma-vendor-row {
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.desk-tool-stack.horizontal {
  display: flex;
  flex-wrap: wrap;
}

.desk-tool-stack .ghost-button {
  justify-content: flex-start;
}

.repcloud-handoff-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.repcloud-handoff-results {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.handoff-result-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(0, 1.4fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 9px 10px;
}

.handoff-result-row strong,
.handoff-result-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.handoff-result-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.repcloud-health-grid.compact {
  grid-template-columns: 1fr;
  margin-top: 10px;
}

.mini-row {
  display: grid;
  width: 100%;
  min-height: 44px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 9px 10px;
}

.mini-row:hover {
  border-color: var(--accent);
}

.repcloud-desk-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 12px;
}

.repcloud-desk-layout .review-section:first-child {
  grid-column: 1 / -1;
}

.report-preview {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.report-grid div {
  padding: 14px;
  border-radius: 8px;
  background: var(--panel-strong);
}

.report-grid span {
  display: block;
  font-size: 26px;
  font-weight: 800;
}

.report-grid p {
  margin-bottom: 0;
}

.answer-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.answer-panel span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.answer-panel strong {
  display: block;
  margin-bottom: 8px;
}

.customer-lookup-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.customer-lookup-panel > span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.customer-lookup-panel section {
  display: grid;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.customer-lookup-panel section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.customer-lookup-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.customer-lookup-header strong {
  display: block;
  font-size: 18px;
}

.customer-lookup-header p {
  margin: 4px 0 0;
}

.customer-lookup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.customer-lookup-grid b {
  display: block;
  margin-bottom: 6px;
}

.customer-lookup-grid p {
  margin: 0 0 5px;
  font-size: 13px;
}

.modal {
  width: min(980px, calc(100vw - 32px));
  border: 0;
  border-radius: 10px;
  padding: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(17, 23, 28, 0.42);
  backdrop-filter: blur(4px);
}

.modal-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
  max-height: min(86vh, 920px);
  overflow: hidden;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-actions {
  padding-top: 14px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.modal-actions:empty {
  display: none;
}

.modal-body {
  display: grid;
  gap: 12px;
  overflow: auto;
  padding-right: 4px;
}

.account-modal-summary {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
}

.account-profile-card .account-avatar.large {
  width: 92px;
  height: 92px;
  font-size: 28px;
}

.account-modal-summary h3 {
  margin: 0 0 4px;
  font-size: 25px;
  font-weight: 800;
  line-height: 1.08;
}

.account-modal-summary p {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.account-modal-identity strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.account-modal-upload {
  justify-self: end;
}

.account-modal-upload .avatar-upload-button {
  margin-top: 0;
  padding: 10px 14px;
  color: var(--ink);
}

.account-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.account-facts-single {
  grid-template-columns: minmax(0, 1fr);
}

.account-facts div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: var(--surface-muted);
}

.account-facts span,
.account-authorized-apps > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.account-facts strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.settings-desktop-download-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #d8e3f3;
  border-radius: 10px;
  background: linear-gradient(135deg, #f8fbff, #eef6ff);
}

.settings-desktop-download-card strong,
.settings-desktop-download-card p {
  display: block;
  margin: 0;
}

.settings-desktop-download-card strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
}

.settings-desktop-download-card p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
}

.settings-desktop-download-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 10px;
  background: #e6f0ff;
}

.settings-desktop-download-icon img {
  width: 30px;
  height: 30px;
}

@media (max-width: 760px) {
  .account-modal-summary {
    grid-template-columns: 1fr;
  }

  .settings-desktop-download-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .settings-desktop-download-card .primary-button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .account-profile-card .account-avatar.large {
    width: 84px;
    height: 84px;
  }

  .account-modal-upload {
    justify-self: start;
  }

  .account-app-grid {
    grid-template-columns: 1fr;
  }
}

.modal-separator {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
}

.modal-body textarea,
.rich-editable {
  min-height: 220px;
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  line-height: 1.45;
  background: #fff;
}

.rich-editable:empty::before {
  content: attr(data-placeholder);
  color: #9aa3ad;
}

.rich-editor {
  display: grid;
  gap: 0;
}

.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #f7f9f8;
}

.rich-toolbar button {
  min-width: 34px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.rich-toolbar button:last-child {
  padding: 0 10px;
  color: var(--accent-dark);
}

.compose-color-control {
  --compose-selected-color: #111827;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.compose-color-control:hover {
  background: #f2f6fb;
}

.compose-color-control input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.compose-color-glyph {
  position: relative;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.compose-color-control:not(.is-highlight)::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 5px;
  height: 3px;
  border-radius: 999px;
  background: var(--compose-selected-color);
  pointer-events: none;
}

.compose-color-control.is-highlight .compose-color-glyph {
  padding: 3px 5px;
  border-radius: 3px;
  background: var(--compose-selected-color);
  color: #111827;
}

body[data-theme="dark"] .compose-color-control {
  background: #101827;
  border-color: #304056;
  color: #e5edf7;
}

body[data-theme="dark"] .compose-color-control:hover {
  background: #1b2636;
}


.related-approvals {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.related-approvals > strong {
  color: var(--muted);
  font-size: 13px;
}

.related-approvals button {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  text-align: left;
}

.related-approvals button:hover {
  border-color: rgba(39, 110, 241, 0.34);
  color: var(--accent-dark);
}

.related-approvals span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.rich-editable:focus {
  outline: 3px solid rgba(39, 110, 241, 0.18);
  border-color: rgba(39, 110, 241, 0.55);
}

.rich-editable p {
  margin: 0 0 12px;
}

.rich-editable p:last-child {
  margin-bottom: 0;
}


.assistant-original-quote {
  margin-top: 22px;
  border-left: 3px solid var(--line);
  padding-left: 14px;
  color: var(--muted);
}

.assistant-original-quote p {
  margin: 0 0 10px;
  font-weight: 800;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.rich-option {
  margin-top: 10px;
}

.config-check {
  margin: 12px 0 16px;
}

.settings-section {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.settings-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-section-header h3 {
  margin: 0;
  font-size: 15px;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}


.source-email-details {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.source-email-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.source-email-details pre {
  max-height: 220px;
  overflow: auto;
  margin: 10px 0 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
  color: #51606d;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.modal-inline-actions {
  justify-content: flex-end;
}

.modal-body select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.assistant-chat {
  position: fixed;
  right: clamp(14px, 2vw, 24px);
  bottom: clamp(14px, 2vw, 24px);
  z-index: 30;
}

/* Desktop uses the persistent corner assistant as its single assistant entry point. */
body.native-shell .command-panel {
  display: none;
}

body[data-view="assistant"] .assistant-chat {
  display: none;
}

.assistant-chat-toggle {
  width: 58px;
  min-width: 58px;
  min-height: 48px;
  border: 1px solid rgba(78, 164, 255, 0.42);
  border-radius: 999px;
  background: linear-gradient(135deg, #4ea4ff, #276ef1 60%, #174ea6);
  color: #fff;
  font-weight: 850;
  box-shadow: 0 16px 36px rgba(39, 110, 241, 0.28);
  overflow: hidden;
  padding: 0;
  position: relative;
}

.assistant-chat-toggle img {
  display: block;
  width: 36px;
  max-width: 36px;
  height: auto;
  margin: 0 auto;
  filter: brightness(0) invert(1);
  transform: none;
}

.assistant-chat.open .assistant-chat-toggle {
  display: none;
}

.assistant-chat-panel {
  display: none;
  width: min(520px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 40px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(20, 32, 51, 0.24);
}

.assistant-chat.open .assistant-chat-panel {
  display: flex;
  flex-direction: column;
}

.assistant-chat-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f7faff, #ffffff);
}

.assistant-chat-header > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.assistant-chat-header-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.assistant-chat-header-actions .icon-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.assistant-chat-header-actions .icon-button svg {
  width: 17px;
  height: 17px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.assistant-chat.listening #assistant-chat-voice {
  border-color: rgba(39, 110, 241, 0.45);
  background: var(--accent-soft);
  color: var(--accent);
}

.assistant-chat-header span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  max-height: none;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px;
  background: #f4f8fd;
}

.assistant-chat-messages article {
  display: grid;
  gap: 4px;
  width: fit-content;
  max-width: 88%;
  max-height: none;
  overflow: visible;
  padding: 10px 12px;
  border: 1px solid #e1e6ea;
  border-radius: 8px;
  background: #fff;
}

.assistant-chat-messages article.assistant {
  align-self: flex-start;
}

.assistant-chat-messages article.user {
  align-self: flex-end;
  border-color: rgba(39, 110, 241, 0.2);
  background: var(--accent-soft);
}

.assistant-chat-messages span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.assistant-chat-messages p {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.assistant-chat-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.assistant-chat-form input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
}

.assistant-chat-form button {
  flex: 0 0 auto;
  min-width: 78px;
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 850;
}

.assistant-chat-form .assistant-chat-voice-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  min-width: 40px;
  padding: 0;
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
}

.assistant-chat-form .assistant-chat-voice-button:hover,
.assistant-chat-form .assistant-chat-voice-button:focus-visible,
.assistant-chat.listening .assistant-chat-voice-button {
  border-color: var(--accent);
  background: #eef5ff;
  color: var(--accent);
}

.assistant-chat-form .assistant-chat-voice-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.assistant-page {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: calc(100vh - 260px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.assistant-page-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 360px;
  max-height: calc(100vh - 330px);
  overflow-y: auto;
  padding: 18px;
  background: #f6f7f8;
}

.assistant-page-thread article {
  display: grid;
  gap: 7px;
  max-width: min(760px, 92%);
  padding: 14px 16px;
  border: 1px solid #e1e6ea;
  border-radius: 8px;
  background: #fff;
}

.assistant-page-thread article.user {
  align-self: flex-end;
  border-color: rgba(39, 110, 241, 0.22);
  background: #eaf2ff;
}

.assistant-page-thread span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.assistant-page-thread p {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.assistant-page-form {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.assistant-page-form textarea {
  width: 100%;
  min-height: 110px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

.assistant-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.assistant-page-empty {
  max-width: 680px;
  padding: 18px;
  border: 1px dashed #cbd5dc;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
}

body[data-theme="dark"] .assistant-chat-panel,
body[data-theme="dark"] .assistant-page {
  border-color: rgba(226, 236, 249, 0.18);
  background: #0b1526;
  color: var(--ink);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.42);
}

body[data-theme="dark"] .assistant-chat-header,
body[data-theme="dark"] .assistant-chat-form,
body[data-theme="dark"] .assistant-page-form {
  border-color: rgba(226, 236, 249, 0.14);
  background: rgba(15, 28, 47, 0.96);
}

body[data-theme="dark"] .assistant-chat-messages,
body[data-theme="dark"] .assistant-page-thread {
  background: #081323;
}

body[data-theme="dark"] .assistant-chat-messages article,
body[data-theme="dark"] .assistant-page-thread article {
  border-color: rgba(226, 236, 249, 0.16);
  background: #101d31;
  color: var(--ink);
}

body[data-theme="dark"] .assistant-chat-messages article.user,
body[data-theme="dark"] .assistant-page-thread article.user {
  border-color: rgba(91, 149, 255, 0.34);
  background: rgba(91, 149, 255, 0.18);
}

body[data-theme="dark"] .assistant-chat-form input,
body[data-theme="dark"] .assistant-page-form textarea {
  border-color: rgba(226, 236, 249, 0.2);
  background: #081323;
  color: var(--ink);
}

body[data-theme="dark"] .assistant-chat-form input::placeholder,
body[data-theme="dark"] .assistant-page-form textarea::placeholder {
  color: #7f8da1;
}

body[data-theme="dark"] .assistant-chat-form .assistant-chat-voice-button {
  border-color: rgba(226, 236, 249, 0.2);
  background: #081323;
  color: #aebbd0;
}

body[data-theme="dark"] .assistant-chat-form .assistant-chat-voice-button:hover,
body[data-theme="dark"] .assistant-chat-form .assistant-chat-voice-button:focus-visible,
body[data-theme="dark"] .assistant-chat.listening .assistant-chat-voice-button {
  border-color: #78a7ff;
  background: #18345d;
  color: #dceaff;
}

body[data-theme="dark"] .assistant-page-empty {
  border-color: rgba(226, 236, 249, 0.24);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}

.modal-input {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.config-textarea {
  min-height: 96px;
  padding: 10px;
  resize: vertical;
  line-height: 1.35;
}

.config-list {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.config-row strong {
  min-width: 76px;
  min-height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 12px;
}

.config-row strong.ready {
  background: #dff0e7;
  color: #1f7655;
}

.config-row strong.pending {
  background: #f2e1c7;
  color: #795118;
}

.backup-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.backup-summary.compact {
  margin-bottom: 0;
}

.backup-coverage {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.backup-summary div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.backup-coverage article {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.backup-summary span,
.backup-coverage span,
.backup-coverage small,
.backup-row span,
.backup-row small {
  color: var(--muted);
  font-size: 12px;
}

.backup-summary strong,
.backup-coverage strong,
.backup-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.backup-coverage strong.ready {
  color: var(--success);
}

.backup-coverage strong.warn {
  color: var(--warning);
}

.backup-offsite-card.is-ready strong {
  color: var(--success);
}

.backup-offsite-card.needs-attention strong,
.backup-offsite-card.not-configured strong {
  color: var(--warning);
}

.backup-settings-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.backup-settings-panel h3 {
  margin: 0;
}

.backup-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.backup-settings-grid label {
  min-width: 0;
}

.backup-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.backup-list {
  display: grid;
  gap: 10px;
}

.backup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.backup-row div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.backup-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.backup-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.field-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.modal-note {
  margin-bottom: 0;
  font-size: 13px;
}


.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.checkbox-row label {
  align-items: center;
  background: #f7faf9;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  display: flex;
  font-size: 14px;
  font-weight: 700;
  gap: 8px;
  padding: 10px 12px;
}

.playbook-note {
  background: #eef8f5;
  border: 1px solid #b9dcd5;
  border-radius: 10px;
  color: #2f5f58;
  font-size: 14px;
  line-height: 1.5;
  margin-top: 14px;
  padding: 12px 14px;
}

.modal-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.audit-list {
  display: grid;
  gap: 10px;
  padding-left: 0;
  list-style-position: inside;
}

.audit-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
  padding: 10px 12px;
}

.audit-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.audit-row-main strong {
  font-size: 14px;
}

.audit-meta {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.audit-row code {
  display: block;
  margin-top: 8px;
  padding: 8px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.06);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
}

.audit-status {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.audit-status.is-ok {
  background: #dcfce7;
  color: #166534;
}

.audit-status.is-warning {
  background: #fee2e2;
  color: #991b1b;
}

.settings-section-header.compact {
  margin-bottom: 12px;
}

.security-session-list {
  display: grid;
  gap: 10px;
}

.security-session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 12px;
}

.security-session-row.current {
  border-color: #bfe1d5;
  background: #f1faf6;
}

.security-session-row strong,
.security-session-row span,
.security-session-row small {
  display: block;
}

.security-session-row span,
.security-session-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.security-session-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.security-event-row .audit-meta {
  font-size: 13px;
}

.ai-usage-bars {
  display: grid;
  gap: 12px;
}

.ai-usage-bars div {
  display: grid;
  gap: 7px;
}

.ai-usage-bars span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-usage-bars div::after {
  content: "";
  grid-row: 2;
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
}

.ai-usage-bars strong {
  grid-row: 2;
  z-index: 1;
  height: 8px;
  max-width: 100%;
  border-radius: 999px;
  background: var(--accent);
}

@media (max-width: 760px) {
  .approval-center-summary,
  .approval-center-card {
    grid-template-columns: 1fr;
  }

  .approval-center-actions {
    justify-content: flex-start;
  }

  .security-session-row {
    align-items: stretch;
    flex-direction: column;
  }

  .security-session-actions {
    justify-content: flex-start;
  }
}

.review-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.review-summary div,
.review-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.review-summary div {
  min-width: 0;
  padding: 12px;
}

.review-summary span,
.review-section-header span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.review-summary strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.review-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.review-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 10px;
  background: #e9f2ef;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
}

.review-chip.money {
  background: #f2e1c7;
  color: #795118;
}

.review-section {
  padding: 14px;
}

.review-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.review-section-header h3 {
  margin: 0;
  font-size: 15px;
}

.review-table-wrap {
  overflow-x: auto;
}

.review-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 14px;
}

.review-table th,
.review-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.review-table th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.review-table td:nth-child(3),
.review-table td:nth-child(4),
.review-table td:nth-child(5) {
  white-space: nowrap;
  font-weight: 800;
}


.mailbox-actions p {
  margin-bottom: 0;
}

.mailbox-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.mailbox-file-row select {
  width: 100%;
  min-width: 0;
}

.mailbox-file-row .primary-button {
  min-height: 40px;
  white-space: nowrap;
}


.rma-vendor-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.rma-vendor-search-row .modal-input {
  min-width: 0;
}

body[data-view="crm"] .content-grid,
body[data-view="crm"] .main-column,
body[data-view="crm"] #view-crm.view.active,
body[data-view="publisher"] .content-grid,
body[data-view="publisher"] .main-column,
body[data-view="publisher"] #view-publisher.view.active {
  display: block;
  width: 100%;
  max-width: none;
}

body[data-view="crm"] .workspace,
body[data-view="publisher"] .workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  height: 100vh;
  min-height: 0;
  padding: 12px 12px 0;
  overflow: hidden;
}

/* CRM remains inside the current Workspace shell. Preserve the user's chosen
   top or side navigation instead of replacing it with an embed-only rail. */
body[data-view="crm"] .workspace {
  grid-column: 1;
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  padding: 0;
  gap: 0;
}

body[data-view="crm"] .topbar {
  display: none !important;
}

body[data-view="crm"] .command-panel,
body[data-view="publisher"] .command-panel {
  display: none !important;
}

body[data-view="crm"] .content-grid,
body[data-view="crm"] .main-column,
body[data-view="crm"] #view-crm.view.active,
body[data-view="crm"] .crm-embed,
body[data-view="crm"] .crm-embed-page,
body[data-view="crm"] .crm-embed-shell,
body[data-view="publisher"] .content-grid,
body[data-view="publisher"] .main-column,
body[data-view="publisher"] #view-publisher.view.active,
body[data-view="publisher"] .publisher-embed,
body[data-view="publisher"] .publisher-embed-page,
body[data-view="publisher"] .publisher-embed-shell {
  height: 100%;
  min-height: 0;
}

body[data-view="crm"] #view-crm.view.active.hosted-app-view,
body[data-view="publisher"] #view-publisher.view.active.hosted-app-view {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.hosted-app-client-bar {
  min-width: 0;
  margin: 0;
  padding: 0 4px;
}

#react-crm-host-root,
#react-publisher-host-root,
#legacy-crm-host-root,
#legacy-publisher-host-root,
.hosted-app-view > .crm-embed {
  min-width: 0;
  min-height: 0;
  height: 100%;
}

#react-crm-host-root .rw-hosted-app,
#react-publisher-host-root .rw-hosted-app {
  height: 100%;
  min-height: 0;
}

#react-crm-host-root .rw-hosted-frame-shell,
#react-publisher-host-root .rw-hosted-frame-shell,
#react-crm-host-root .rw-hosted-frame,
#react-publisher-host-root .rw-hosted-frame {
  min-height: 0;
  height: 100%;
}

.crm-embed-page {
  display: block;
}

.crm-embed-shell {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: var(--panel);
}

.crm-embed-frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #fff;
}

.crm-embed-fallback {
  position: absolute;
  inset: 24px auto auto 24px;
  display: none;
  max-width: min(520px, calc(100% - 48px));
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-soft);
  color: var(--text);
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.crm-embed-fallback strong,
.crm-embed-fallback p {
  margin: 0;
}

.crm-embed-fallback p {
  margin-top: 4px;
  color: var(--muted);
}

.crm-embed-shell.is-waiting .crm-embed-fallback {
  display: flex;
}

.crm-embed-fallback-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
}

@media (max-width: 760px) {
  .mailbox-file-row {
    grid-template-columns: 1fr;
  }

  .mailbox-file-row .primary-button {
    width: 100%;
  }
}


.forward-compose-summary {
  display: grid;
  gap: 4px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-soft);
}

.forward-compose-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.forward-compose-summary strong {
  color: var(--text);
  font-size: 15px;
}

.forward-note-input {
  min-height: 110px;
  resize: vertical;
}


.attachment-tools {
  margin-top: 10px;
  width: 100%;
  max-width: 100%;
  position: relative;
}

.attachment-menu-button {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  width: fit-content;
  cursor: pointer;
  list-style: none;
}

.attachment-menu-button::-webkit-details-marker {
  display: none;
}

.attachment-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  border: 0;
  background: transparent;
}

.attachment-picker-overlay::backdrop {
  background: rgba(15, 23, 42, 0.30);
  backdrop-filter: blur(5px) saturate(0.92);
}

.attachment-picker-sheet {
  position: relative;
  box-sizing: border-box;
  width: min(720px, calc(100vw - 28px));
  max-height: min(680px, calc(100vh - 40px));
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: 12px;
  padding: 18px;
  background: #ffffff;
  color: #102033;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.26), 0 1px 0 rgba(255, 255, 255, 0.92) inset;
}

.attachment-picker-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 0 2px;
}

.attachment-picker-header h3 {
  margin: 3px 0 0;
  color: #0f172a;
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: 0;
}

.attachment-picker-header .eyebrow {
  margin: 0;
  color: #2563b8;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.attachment-picker-header .icon-button {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-radius: 8px;
  background: #f8fafc;
  color: #1f2937;
  font-size: 22px;
  line-height: 1;
  box-shadow: none;
}

.attachment-picker-header .icon-button:hover {
  border-color: rgba(37, 99, 184, 0.34);
  background: #eef5ff;
  color: #0f3f87;
}

.attachment-picker-sheet .attachment-menu-panel {
  width: auto;
  max-width: none;
  max-height: none;
  margin-top: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  overflow: visible;
  background: transparent;
  box-shadow: none;
}

body.native-compose-window .attachment-picker-overlay {
  z-index: 2147483647;
}

.attachment-menu-icon {
  font-size: 18px;
  line-height: 1;
}

.attachment-menu-panel {
  display: grid;
  gap: 10px;
  box-sizing: border-box;
  width: 100%;
  max-width: 360px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: color-mix(in srgb, var(--surface) 94%, white);
  box-shadow: 0 20px 36px rgba(15, 23, 42, 0.10);
  max-height: min(42vh, 360px);
  overflow: auto;
}

.attachment-picker-status {
  margin: 0;
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: 9px;
  padding: 10px 12px;
  background: #eff6ff;
  color: #1d4f91;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
  text-transform: none;
  letter-spacing: 0;
}

.attachment-picker-status[data-tone="warning"] {
  border-color: rgba(234, 179, 8, 0.34);
  background: #fffbeb;
  color: #854d0e;
}

.attachment-picker-status[data-tone="error"] {
  border-color: rgba(239, 68, 68, 0.30);
  background: #fef2f2;
  color: #991b1b;
}

.attachment-source {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d8e1ea;
  border-radius: 10px;
  background: #f8fafc;
}

.attachment-source h4 {
  margin: 0;
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.attachment-source-heading {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.attachment-source-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.attachment-picker-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.attachment-source-row .modal-input {
  min-width: 0;
  min-height: 38px;
  border-color: #d8e1ea;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) inset;
}

.attachment-picker-search .modal-input {
  min-width: 0;
  min-height: 38px;
  border-color: #d8e1ea;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) inset;
}

.attachment-choice {
  position: relative;
  display: grid;
  gap: 3px;
  border: 1px solid #d8e1ea;
  border-radius: 9px;
  padding: 12px 13px;
  background: #ffffff;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.attachment-choice strong,
.attachment-choice small {
  display: block;
}

.attachment-choice small {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.attachment-choice:hover {
  border-color: rgba(37, 99, 184, 0.44);
  background: #fafdff;
}

.attachment-file-button {
  position: relative;
  overflow: hidden;
}

.attachment-file-button input {
  position: absolute;
  inset: 0;
  cursor: pointer;
  opacity: 0;
}

.attachment-quick-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.attachment-quick-list .mini-button {
  min-height: 30px;
  border-color: #cad5e2;
  border-radius: 999px;
  background: #f8fafc;
  color: #183047;
  box-shadow: none;
}

.attachment-quick-list .mini-button:hover {
  border-color: rgba(37, 99, 184, 0.34);
  background: #eef5ff;
}

.attachment-source-row .mini-button {
  min-height: 38px;
  border-color: #cad5e2;
  border-radius: 8px;
  background: #ffffff;
  color: #122033;
}

.attachment-source-row .mini-button:hover {
  border-color: rgba(37, 99, 184, 0.34);
  background: #eef5ff;
}

.attachment-provider-picker {
  gap: 9px;
}

.attachment-picker-list {
  display: grid;
  gap: 7px;
  max-height: 210px;
  overflow: auto;
  padding-right: 2px;
}

.attachment-picker-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  border: 1px solid #d8e1ea;
  border-radius: 9px;
  padding: 8px 10px;
  background: #ffffff;
  color: #102033;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.attachment-picker-row:hover {
  border-color: rgba(37, 99, 184, 0.44);
  background: #fafdff;
}

.attachment-picker-row strong,
.attachment-picker-row small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-picker-row strong {
  font-size: 13px;
}

.attachment-picker-row small {
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}

.attachment-picker-row em {
  color: #2563b8;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.attachment-picker-file-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #eff6ff;
  color: #2563b8;
  font-size: 10px;
  font-weight: 950;
}

.attachment-picker-file-icon.folder {
  background: #eef6ff;
  color: #0f5fa8;
}

.attachment-picker-file-icon.google {
  background: #f0fdf4;
  color: #14803d;
}

.attachment-picker-breadcrumb {
  display: flex;
  gap: 7px;
  align-items: center;
  min-width: 0;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.attachment-picker-breadcrumb button {
  border: 0;
  padding: 0;
  background: transparent;
  color: #2563b8;
  font: inherit;
  cursor: pointer;
}

.attachment-picker-breadcrumb span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-paste-fallback {
  display: grid;
  gap: 8px;
}

.attachment-paste-fallback summary {
  width: max-content;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.draft-attachment-list {
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  padding: 8px;
  background: #fbfcfd;
}

.draft-attachment-list span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mailbox-action-row,
.mailbox-file-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.mailbox-file-row select {
  flex: 1;
  min-width: 260px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}


.toast {
  position: fixed;
  right: 22px;
  top: 22px;
  bottom: auto;
  z-index: 2147483647;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  min-height: 42px;
  max-width: min(560px, calc(100vw - 44px));
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #182126;
  color: #fff;
  padding: 10px 16px;
  text-align: left;
  line-height: 1.35;
  box-shadow: var(--shadow);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.action-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  place-items: initial;
  pointer-events: auto;
  padding: 10px 12px 10px 16px;
}

.toast-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.toast-actions button {
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: inherit;
  font-weight: 800;
  padding: 0 10px;
  cursor: pointer;
}

.toast-actions button:hover {
  background: rgba(255, 255, 255, 0.22);
}

body:has(.modal[open]) .toast,
.modal[open] > .toast,
body:has(.attachment-picker-overlay[open]) .toast,
.attachment-picker-overlay[open] > .toast {
  top: auto;
  right: 24px;
  bottom: 24px;
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

html.nav-layout-topbar .toast,
body.nav-layout-topbar .toast {
  top: 64px;
}

  border-bottom: 0;
}

.settings-instructions {
  display: grid;
  gap: 10px;
}

.settings-instructions h3 {
  margin: 10px 0 0;
  font-size: 14px;
}

.settings-instructions p {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfc;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.maintenance-digest-card {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.maintenance-check-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.maintenance-check-list li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.4;
}

.maintenance-check {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border: 1px solid rgba(126, 81, 22, 0.34);
  border-radius: 6px;
  background: #fff8ed;
  color: #237657;
  font-size: 12px;
  font-weight: 950;
}

.maintenance-check.done {
  border-color: rgba(35, 118, 87, 0.32);
  background: #e5f4ec;
}

.connection-status-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.connection-status-card {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 10px 12px;
}

.connection-status-card > span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--gold);
}

.connection-status-card.is-ready > span {
  background: #2fc386;
}

.connection-status-card strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-status-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

@media (max-width: 1080px) {
  body.nav-layout-sidebar .app-shell {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  body.nav-layout-sidebar .sidebar {
    width: 84px;
  }

  .brand div:last-child,
  .nav-item span:last-child {
    display: none;
  }

  body.nav-layout-sidebar .brand {
    justify-content: center;
  }

  .nav-item {
    justify-content: center;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-widgets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-card-mail,
  .dashboard-card-files,
  .dashboard-card-calendar,
  .dashboard-card-tasks {
    grid-column: auto;
  }

  .mail-workspace {
    grid-template-columns: 1fr;
  }

  .mail-reader {
    order: -1;
  }

  .mail-workspace .mail-table,
  .mail-folder-rail,
  .mail-reader {
    max-height: none;
  }

  .workflow-head,
  .workflow-action-main,
  .playbook-picker {
    grid-template-columns: 1fr;
  }

  .playbook-picker {
    justify-content: stretch;
  }

  .approval-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .mail-reader-category-line,
  .category-rule-row,
  .api-key-create-row,
  .api-profile-grid,
  .api-key-list article,
  .mail-role-control-columns,
  .review-summary.compact {
    grid-template-columns: 1fr;
  }

  .app-shell {
    display: block;
    min-height: 100vh;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    width: min(82vw, 320px);
    padding: 20px;
    flex-direction: column;
    align-items: stretch;
    overflow-y: auto;
    transform: translateX(-104%);
    box-shadow: 24px 0 60px rgba(10, 16, 20, 0.28);
    transition: transform 180ms ease;
  }

  body.mobile-nav-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-collapsed .sidebar {
    align-items: stretch;
    padding: 20px;
  }

  body.sidebar-collapsed .brand {
    display: flex;
    justify-items: initial;
  }

  body.sidebar-collapsed .brand > div:not(.brand-mark),
  body.sidebar-collapsed .mode-badge,
  body.sidebar-collapsed .nav-item span:last-child {
    display: block;
  }

  .mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 35;
    border: 0;
    background: rgba(10, 16, 20, 0.44);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  body.mobile-nav-open .mobile-nav-backdrop {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-menu-button {
    display: grid;
  }

  .sidebar-toggle {
    display: none;
  }

  .brand {
    flex: 0 0 auto;
  }

  .brand div:last-child {
    display: block;
  }

  .nav-item span:last-child,
  .mode-badge {
    display: block;
  }

  .nav-list {
    display: grid;
  }

  .nav-item {
    flex: initial;
    justify-content: flex-start;
    min-height: 46px;
    font-size: 16px;
  }

  .workspace {
    padding: 14px;
  }

  .topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
  }

  .top-actions,
  .command-row,
  .mail-safety-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    align-items: flex-end;
  }

  .mail-safety-banner strong {
    white-space: normal;
  }

  h1 {
    font-size: 29px;
  }

  .status-band,
  .dashboard-widgets,
  .mail-grid,
  .mail-insights,
  .calendar-strip,
  .calendar-workspace,
  .tool-grid,
  .capability-grid {
    grid-template-columns: 1fr;
  }

  .mail-tools {
    grid-template-columns: 1fr;
  }

  .mail-triage-head,
  .mail-triage-card,
  .mail-triage-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .mail-triage-head {
    display: grid;
  }

  .mail-triage-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mail-triage-actions {
    display: flex;
  }

  .task-item,
  .rules-list article {
    grid-template-columns: 1fr;
  }

  body[data-view="mail"] .topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    position: sticky;
    top: 0;
    z-index: 20;
    margin: 0;
    padding: 8px 14px;
    border-bottom: 1px solid #e1e5e8;
    background: rgba(248, 250, 251, 0.96);
    backdrop-filter: blur(12px);
  }

  body[data-view="mail"] .topbar .eyebrow {
    display: none;
  }

  body[data-view="mail"] .topbar h1 {
    font-size: 0;
    line-height: 1.1;
  }

  body[data-view="mail"] .topbar h1::after {
    content: "Mail";
    font-size: 22px;
  }

  body[data-view="mail"] .topbar-mail-search input {
    min-height: 40px;
    font-size: 16px;
  }

	  body[data-view="mail"] .section-heading,
	  body[data-view="mail"] .mail-profile-strip,
	  body[data-view="mail"] .mail-tools,
	  body[data-view="mail"] .mail-source,
	  body[data-view="mail"] .mail-category-tabs {
	    display: grid;
	  }

  body[data-view="mail"] .section-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    margin: 0;
    padding: 10px 14px;
    background: #fff;
    border-bottom: 1px solid #e3e8eb;
  }

  body[data-view="mail"] .section-heading h2 {
    font-size: 22px;
  }

  body[data-view="mail"] .section-heading .inline-actions {
    display: contents;
  }

  body[data-view="mail"] .section-heading .inline-actions button {
    display: none;
  }

  body[data-view="mail"] .mail-compose-button {
    display: inline-flex !important;
    grid-column: 2;
    grid-row: 1;
    min-height: 44px;
    min-width: 112px;
    border-radius: 16px;
  }

	  body[data-view="mail"] .mail-safety-banner,
	  body[data-view="mail"] .contacts-panel {
	    display: none;
	  }

	  .mail-profile-strip {
	    display: flex !important;
	    position: static;
	    z-index: 13;
	    padding: 8px 14px;
	    scrollbar-width: none;
	  }

	  .mail-profile-strip::-webkit-scrollbar {
	    display: none;
	  }

	  .mail-profile-card {
	    flex: 0 0 178px;
	    min-width: 178px;
	    grid-template-columns: 30px minmax(0, 1fr);
	    padding: 8px 10px;
	  }

	  .mail-profile-card span {
	    width: 30px;
	    height: 30px;
	    font-size: 11px;
	  }

	  .mail-profile-card strong {
	    font-size: 14px;
	  }

	  .mail-profile-card small {
	    display: none;
	  }

	  .mail-tools {
	    position: static;
    z-index: 12;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
    padding: 8px 14px;
    border-bottom: 1px solid #e3e8eb;
    background: rgba(248, 250, 251, 0.96);
    backdrop-filter: blur(12px);
  }

  .mail-tools #mail-folder {
    display: none;
  }

  .mail-tools #mail-search {
    display: none;
  }

  .mail-tools #mail-filter {
    min-height: 40px;
    max-width: 118px;
    font-size: 15px;
  }

  .mail-category-tabs {
    display: flex !important;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 14px 10px;
    border-bottom: 1px solid #e3e8eb;
    background: #fff;
    scrollbar-width: none;
  }

  .mail-category-tabs::-webkit-scrollbar {
    display: none;
  }

  .mail-category-tabs button {
    flex: 0 0 auto;
  }

  .mail-source {
    margin: 0;
    padding: 7px 14px;
    border-bottom: 1px solid #e3e8eb;
    background: #fff;
    font-size: 13px;
  }

  .mail-pager-bar {
    position: static;
    z-index: 10;
    margin-bottom: 14px;
    padding: 0 14px 14px;
    background: #fff;
    border-bottom: 1px solid #e3e8eb;
  }

  body[data-view="mail"] .mail-source {
    display: none;
  }

  body[data-view="mail"] #mail-summary {
    display: flex;
    gap: 8px;
    padding: 8px 14px 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  body[data-view="mail"] #mail-summary::-webkit-scrollbar {
    display: none;
  }

  body[data-view="mail"] #mail-summary article {
    flex: 0 0 auto;
    min-width: 112px;
  }

  .mail-pagination {
    padding: 8px 14px;
  }

  .mail-pagination .ghost-button {
    min-height: 36px;
  }

  .mail-workspace {
    display: block;
    border-top: 0;
  }

  .mail-folder-rail {
    display: none;
  }

  .mail-workspace .mail-table {
    max-height: none;
    border-right: 0;
    background: #fff;
  }

  .mail-row {
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 13px;
    min-height: 104px;
    padding: 16px 14px;
  }

  .mail-avatar {
    display: grid;
    width: 44px;
    height: 44px;
    font-size: 13px;
  }

  .mail-row .mini-button {
    display: none;
  }

  .mail-row-main p {
    margin-top: 4px;
    font-size: 17px;
    line-height: 1.3;
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .mail-row-title strong {
    font-size: 17px;
    line-height: 1.18;
  }

  .mail-row-title time {
    font-size: 14px;
  }

  .mail-row-meta {
    flex-wrap: nowrap;
    align-items: center;
    overflow-x: auto;
    padding-bottom: 1px;
    scrollbar-width: none;
  }

  .mail-row-meta::-webkit-scrollbar {
    display: none;
  }

  .mail-row-meta span {
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 25px;
    padding: 0 10px;
    font-size: 13px;
  }

  .mail-row-thread-summary {
    display: none;
  }

  .mail-row.selected {
    background: #e9f1ff;
    color: var(--ink);
    box-shadow: inset 4px 0 0 #2f73d0;
  }

  .mail-row.selected .mail-row-title time,
  .mail-row.selected .attachment-indicator,
  .mail-row.selected .mail-row-main p,
  .mail-row.selected .mail-row-main strong {
    color: var(--ink);
  }

  .mail-row.selected .mail-avatar:not(.avatar-loaded) {
    background: hsl(var(--avatar-hue, 164) 64% 91%);
    color: hsl(var(--avatar-hue, 164) 54% 28%);
  }

  .mail-row.selected .mail-label-chip,
  .mail-row.selected .mail-status-chip {
    background: #fff;
    color: var(--muted);
    border-color: rgba(102, 113, 125, 0.18);
  }

  .mail-row.selected .mail-category-pill {
    color: #fff;
  }

  .mail-reader {
    display: none;
  }

  body.mail-reader-open .mail-reader {
    position: fixed;
    inset: 0;
    z-index: 55;
    display: grid;
    align-content: start;
    max-height: 100dvh;
    overflow: auto;
    padding: 0 14px calc(150px + env(safe-area-inset-bottom));
    scroll-padding-bottom: calc(150px + env(safe-area-inset-bottom));
    background: #fff;
  }

  body.mail-reader-open .mobile-menu-button {
    display: none;
  }

  .mail-reader-actions {
    top: 0;
    margin: 0 -14px 14px;
    padding: 10px 10px;
    gap: 8px;
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    scrollbar-width: none;
  }

  .mail-reader-actions::-webkit-scrollbar {
    display: none;
  }

  .mobile-reader-nav,
  .mobile-reader-back {
    display: inline-flex;
  }

  .mail-toolbar-group {
    flex: 0 0 auto;
    flex-wrap: nowrap;
  }

  .mail-toolbar-button {
    min-height: 46px;
    padding: 0 15px;
    font-size: 15px;
    white-space: nowrap;
  }

  .mail-toolbar-button.icon {
    width: 46px;
  }

  .mail-reader-header {
    padding-top: 0;
  }

  .mail-reader-header h2 {
    font-size: 25px;
    line-height: 1.1;
  }

  .mail-info-grid,
  .mail-category-editor {
    grid-template-columns: 1fr;
  }

  .repcloud-context {
    margin-inline: -2px;
  }

  .repcloud-context-header {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .repcloud-context-actions {
    justify-content: flex-start;
  }

  .repcloud-kpis {
    grid-template-columns: 1fr 1fr;
  }

  .repcloud-context-columns,
  .repcloud-order-row,
  .repcloud-contact-row {
    grid-template-columns: 1fr;
  }

  .repcloud-order-row em {
    justify-self: start;
  }

  .mail-action-toolbar {
    position: sticky;
    bottom: 0;
    z-index: 12;
    margin: 0 -14px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid #e3e8eb;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
  }

  .mail-action-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .message-body-card .mail-preview,
  .email-html-preview {
    font-size: 16px;
  }

  .email-html-preview iframe {
    height: calc(100dvh - 240px);
    min-height: 420px;
  }

	  .forward-modal-grid,
	  .compose-modal-grid,
	  .address-book-toolbar,
	  .address-book-grid,
	  .address-detail-card,
	  .company-profile-head,
	  .company-profile-grid,
	  .contact-info-grid,
	  .contact-edit-grid {
	    grid-template-columns: 1fr;
	  }

  .company-profile-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .forward-modal-grid .wide {
    grid-column: auto;
  }

  .compose-modal-grid .wide {
    grid-column: auto;
  }

  .modal {
    width: 100vw;
    max-width: 100vw;
  }

  .modal-card {
    min-height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    padding: 16px;
  }

  .modal-actions {
    position: sticky;
    bottom: 0;
    margin: 0 -16px -16px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }

  .compose-body {
    min-height: 42dvh;
  }

  .docs-split-grid,
  .docs-source-grid,
  .docs-category-grid,
  .docs-files-overview,
  .docs-result-grid {
    grid-template-columns: 1fr;
  }

  .repcloud-handoff-grid,
  .handoff-result-row {
    grid-template-columns: 1fr;
  }

  .docs-browser-topbar {
    flex-direction: column;
  }

  .docs-browser-actions {
    justify-content: flex-start;
  }

  .docs-command-card {
    grid-template-columns: 1fr;
  }

  .settings-hero-card,
  .settings-card-header,
  .settings-section-header {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-grid.two,
  .settings-status-grid {
    grid-template-columns: 1fr;
  }

  .docs-command-card .docs-search {
    width: 100%;
  }

  .docs-table {
    max-height: none;
  }

  .docs-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .docs-row em {
    justify-self: start;
  }

  .calendar-month {
    min-width: 720px;
  }

  .calendar-main {
    overflow-x: auto;
  }

  .report-grid {
    grid-template-columns: 1fr;
  }

  .repcloud-health-grid,
  .repcloud-desk-layout {
    grid-template-columns: 1fr;
  }

  .assistant-chat {
    right: 10px;
    bottom: 10px;
    left: 10px;
  }

  .assistant-chat-panel {
    width: 100%;
    height: min(620px, calc(100vh - 20px));
  }

  .assistant-chat-messages article {
    max-width: 94%;
  }

  .assistant-page {
    min-height: calc(100vh - 210px);
  }

  .assistant-page-thread {
    min-height: 300px;
    max-height: calc(100vh - 300px);
  }

  .todo-page {
    grid-template-columns: 1fr;
  }

  .todo-sidebar,
  .todo-detail {
    box-shadow: none;
  }

  .todo-sidebar {
    position: static;
    max-height: 240px;
    overflow-y: auto;
  }

  .todo-main {
    max-height: none;
  }

  .todo-list {
    max-height: none;
  }

  .todo-filter-list {
    display: flex;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
  }

  .todo-filter-button {
    flex: 0 0 104px;
  }

  .todo-detail {
    position: fixed;
    inset: 12px;
    width: auto;
    max-height: none;
  }

  body[data-view="tasks"] .todo-detail {
    top: 12px;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
  }

  .todo-quick-add {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .todo-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .todo-item {
    grid-template-columns: 30px minmax(0, 1fr) 34px;
  }

  .todo-item.child {
    margin-left: 18px;
  }

  .todo-star {
    grid-column: auto;
    justify-self: auto;
  }

  .todo-detail-fields div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* Mobile polish pass: keep the phone UI compact, readable, and free of sideways drift. */
@media (max-width: 760px) {
  html,
  body {
    overflow-x: hidden;
  }

  .settings-header-actions,
  .account-center-handoff-actions {
    justify-content: stretch;
  }

  .settings-header-actions > *,
  .account-center-handoff-actions > * {
    flex: 1 1 100%;
  }

  .account-center-summary-row {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .account-center-grants {
    justify-content: flex-start;
  }

  body {
    min-width: 0;
  }

  .workspace {
    width: 100%;
    padding: 12px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 22;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: 10px;
    margin: -12px -12px 12px;
    padding: calc(8px + env(safe-area-inset-top)) 12px 10px;
    border-bottom: 1px solid rgba(216, 226, 239, 0.9);
    background: rgba(248, 250, 251, 0.96);
    backdrop-filter: blur(14px);
  }

  .mobile-menu-button,
  .top-actions .theme-toggle {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    border-radius: 12px;
  }

  .top-actions {
    justify-self: end;
    align-items: center;
  }

  .top-actions button:not(.theme-toggle):not(.openai-status-alert) {
    display: none;
  }

  .topbar .eyebrow {
    margin-bottom: 2px;
    font-size: 11px;
  }

  .topbar h1 {
    font-size: clamp(23px, 8vw, 31px);
  }

  .command-panel {
    margin: 0 0 12px;
    padding: 12px;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(20, 32, 51, 0.08);
  }

  .command-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .command-row input {
    min-height: 46px;
    font-size: 16px;
  }

  .command-row button {
    width: 100%;
    min-height: 48px;
    border-radius: 12px;
  }

  .quick-prompts {
    flex-wrap: nowrap;
    margin-inline: -2px;
    padding: 0 2px 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .quick-prompts::-webkit-scrollbar {
    display: none;
  }

  .quick-prompts button {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 0 14px;
    font-size: 14px;
  }

  .content-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .approval-panel,
  .dashboard-side-panel {
    position: static;
    max-height: none;
  }

  .status-band,
  .dashboard-widgets,
  .calendar-strip,
  .calendar-workspace,
  .report-grid,
  .repcloud-desk-layout,
  .settings-grid.two,
  .settings-status-grid,
  .backup-summary,
  .backup-coverage,
  .backup-settings-grid,
  .docs-split-grid,
  .docs-source-grid,
  .docs-category-grid,
  .docs-files-overview,
  .docs-result-grid,
  .address-book-grid,
  .address-detail-card,
  .contact-info-grid,
  .contact-edit-grid {
    grid-template-columns: 1fr;
  }

  .docs-browser-table.grid-mode {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }

  .section-heading,
  .settings-card-header,
  .settings-section-header,
  .docs-command-card,
  .calendar-control-bar,
  .todo-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .inline-actions,
  .settings-tab-nav,
  .calendar-status,
  .calendar-legend,
  .repcloud-context-actions {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .inline-actions::-webkit-scrollbar,
  .settings-tab-nav::-webkit-scrollbar,
  .calendar-status::-webkit-scrollbar,
  .calendar-legend::-webkit-scrollbar,
  .repcloud-context-actions::-webkit-scrollbar {
    display: none;
  }

  .inline-actions > *,
  .settings-tab-nav > *,
  .calendar-status > *,
  .calendar-legend > *,
  .repcloud-context-actions > * {
    flex: 0 0 auto;
  }

  body[data-view="settings"] .section-heading .inline-actions,
  body[data-view="settings"] .settings-section-header .inline-actions,
  body[data-view="settings"] .settings-card-header .inline-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
  }

  body[data-view="settings"] .section-heading .inline-actions > *,
  body[data-view="settings"] .settings-section-header .inline-actions > *,
  body[data-view="settings"] .settings-card-header .inline-actions > * {
    width: 100%;
    min-width: 0;
  }

  body[data-view="settings"] .section-heading .inline-actions .primary-button,
  body[data-view="settings"] .settings-section-header .inline-actions .primary-button,
  body[data-view="settings"] .settings-card-header .inline-actions .primary-button {
    grid-column: 1 / -1;
  }

  .assistant-chat {
    left: auto;
    right: calc(12px + env(safe-area-inset-right));
    bottom: calc(12px + env(safe-area-inset-bottom));
  }

  .assistant-chat.open {
    left: calc(10px + env(safe-area-inset-left));
    right: calc(10px + env(safe-area-inset-right));
  }

  .assistant-chat-toggle {
    width: 52px;
    min-width: 52px;
    min-height: 44px;
    box-shadow: 0 12px 26px rgba(39, 110, 241, 0.24);
  }

  .assistant-chat-toggle img {
    width: 31px;
    max-width: 31px;
  }

  body[data-view="mail"] .workspace {
    display: block;
    padding: 0;
  }

  body[data-view="mail"] .topbar {
    grid-template-columns: 46px minmax(0, 1fr) auto;
    margin: 0;
    padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
  }

  body[data-view="mail"] .topbar > div:first-of-type {
    display: none;
  }

  body[data-view="mail"] .topbar-mail-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
  }

  body[data-view="mail"] .topbar-mail-search select {
    grid-column: 1 / -1;
    min-height: 38px;
    border-radius: 12px;
    font-size: 14px;
  }

  body[data-view="mail"] .topbar-mail-search input {
    min-height: 42px;
    border-radius: 12px;
    padding-inline: 12px;
    font-size: 16px;
  }

  body[data-view="mail"] .topbar-mail-search input::placeholder {
    font-size: 13px;
  }

  body[data-view="mail"] .section-heading {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 12px;
  }

  body[data-view="mail"] .section-heading h2 {
    font-size: 25px;
  }

  body[data-view="mail"] .mail-profile-strip {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 4px;
    padding: 7px 10px 8px;
    overflow-x: visible;
    background: #fff;
  }

  body[data-view="mail"] .mail-profile-card {
    flex: 1 1 170px;
    min-width: 170px;
    padding: 7px 9px;
    border-radius: 10px;
  }

  body[data-view="mail"] .mail-tools {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    padding: 8px 10px;
  }

  body[data-view="mail"] .mail-tools #mail-search,
  body[data-view="mail"] .mail-tools #mail-folder {
    display: none;
  }

  body[data-view="mail"] .mail-tools select {
    min-height: 42px;
    width: 100%;
    max-width: none;
    border-radius: 999px;
    font-size: 15px;
  }

  body[data-view="mail"] .mail-source {
    display: none;
  }

  body[data-view="mail"] .mail-category-tabs {
    position: sticky;
    top: calc(60px + env(safe-area-inset-top));
    z-index: 15;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 2px;
    padding: 8px 10px 9px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    overflow-x: visible;
  }

  body[data-view="mail"] .mail-category-tabs button {
    flex: 0 1 auto;
    min-height: 34px;
    padding: 0 12px;
    font-size: 15px;
  }

  body[data-view="mail"] .mail-category-tabs strong {
    margin-left: 5px;
  }

body[data-view="mail"] .mail-pager-bar {
  display: block;
  margin: 0;
  padding: 0 14px;
  border-bottom: 1px solid #e3e8eb;
}

body[data-view="mail"] .mail-utility-rail {
  min-height: 30px;
  padding: 2px 0;
}

body[data-view="mail"] .mail-utility-stats {
  gap: 9px;
}

body[data-view="mail"] .mail-pagination {
  gap: 5px;
  min-height: 26px;
}

body[data-view="mail"] .mail-page-step {
  min-width: 28px;
  min-height: 26px;
}

body[data-view="mail"] .mail-page-step span[aria-hidden="true"] {
  font-size: 16px;
}

body[data-view="mail"] .mail-pagination span {
  font-size: 12px;
}

body[data-view="mail"] .mail-pager-bar {
  position: static;
  z-index: 1;
}

  body[data-view="mail"] .mail-workspace .mail-table {
    overflow: visible;
    background: #fff;
  }

  body[data-view="mail"] .mail-row {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
    min-height: 92px;
    padding: 12px 10px;
  }

  body[data-view="mail"] .mail-avatar {
    width: 38px;
    height: 38px;
    font-size: 12px;
  }

  body[data-view="mail"] .mail-row-title {
    gap: 8px;
  }

  body[data-view="mail"] .mail-row-title strong,
  body[data-view="mail"] .mail-row-main p {
    font-size: 16px;
  }

  body[data-view="mail"] .mail-row-title time {
    font-size: 12px;
  }

  body[data-view="mail"] .mail-row-meta {
    gap: 5px;
    align-items: center;
  }

  body[data-view="mail"] .mail-row-meta span {
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 23px;
    padding: 0 8px;
    font-size: 12px;
  }

  body[data-view="mail"] .mail-row-meta span:nth-child(n+5) {
    display: none;
  }

  body[data-view="mail"] .mail-row-thread-summary {
    display: none;
  }

  body[data-view="mail"] .mail-row.swipe-open.swipe-left > :not(.mail-swipe-actions) {
    transform: translateX(-146px);
  }

  body[data-view="mail"] .mail-row.swipe-open.swipe-right > :not(.mail-swipe-actions) {
    transform: translateX(118px);
  }

  body[data-view="mail"] .mail-swipe-actions {
    gap: 6px;
    padding: 0 8px;
  }

  body[data-view="mail"] .mail-swipe-button {
    min-width: 48px;
    min-height: 34px;
    font-size: 11px;
  }

  body.mail-reader-open .mail-reader {
    padding: 0 12px calc(150px + env(safe-area-inset-bottom));
    scroll-padding-bottom: calc(150px + env(safe-area-inset-bottom));
    background: #fff;
  }

  body.mail-reader-open .mail-reader-actions {
    position: sticky;
    top: 0;
    margin: 0 -12px 12px;
    padding: calc(8px + env(safe-area-inset-top)) 8px 8px;
    background: rgba(248, 250, 251, 0.98);
  }

  body.mail-reader-open .mail-toolbar-button {
    min-height: 40px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 14px;
  }

  body.mail-reader-open .mail-toolbar-button.icon {
    width: 40px;
    padding: 0;
  }

  body.mail-reader-open .mail-reader-header h2 {
    font-size: 22px;
    line-height: 1.15;
  }

  body.mail-reader-open .mail-reader-header p,
  body.mail-reader-open .quick-summary-card,
  body.mail-reader-open .message-body-card {
    font-size: 15px;
  }

  body.mail-reader-open .review-section,
  body.mail-reader-open .message-body-card,
  body.mail-reader-open .quick-summary-card,
  body.mail-reader-open .suggested-playbook-card {
    border-radius: 12px;
  }

  body.mail-reader-open .mail-info-grid,
  body.mail-reader-open .mail-category-editor {
    gap: 8px;
  }

  body.mail-reader-open .email-html-preview {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.mail-reader-open .email-html-preview iframe {
    width: 100%;
    min-width: 0;
    height: min(70dvh, 620px);
  }

  body[data-theme="dark"] .topbar,
  body[data-theme="dark"][data-view="mail"] .topbar,
  body[data-theme="dark"][data-view="mail"] .mail-profile-strip,
  body[data-theme="dark"][data-view="mail"] .mail-category-tabs,
  body[data-theme="dark"][data-view="mail"] .mail-pager-bar,
  body[data-theme="dark"].mail-reader-open .mail-reader-actions {
    border-color: rgba(226, 236, 249, 0.16);
    background: rgba(9, 19, 34, 0.96);
  }

  body[data-theme="dark"] .mail-row.selected {
    background: rgba(83, 126, 217, 0.34);
    color: #f8fbff;
  }

  body[data-theme="dark"] .command-panel,
  body[data-theme="dark"] .approval-panel,
  body[data-theme="dark"] .review-section,
  body[data-theme="dark"] .settings-hero-card,
  body[data-theme="dark"] .modal-card {
    box-shadow: none;
  }
}

/* Keep late in the file so dark-mode page surfaces win over module defaults. */
body[data-theme="dark"] .review-section,
body[data-theme="dark"] .activity-list {
  color: var(--ink);
}


body[data-theme="dark"] .source-pill.google,
body[data-theme="dark"] .source-pill.dropbox {
  background: rgba(91, 149, 255, 0.14);
  color: #cfe2ff;
}


body[data-theme="dark"] .rule-readonly-note,
body[data-theme="dark"] .rule-panel-note {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(226, 236, 249, 0.14);
  color: #aeb7c5;
}

body[data-theme="dark"] .workspace-onboarding-readiness {
  background: rgba(31, 49, 77, 0.78);
  border-color: rgba(123, 151, 190, 0.28);
}

body[data-theme="dark"] .workspace-onboarding-readiness.needs-attention {
  background: rgba(127, 83, 28, 0.18);
  border-color: rgba(243, 196, 76, 0.32);
}

body[data-theme="dark"] .workspace-onboarding-stats article {
  background: rgba(13, 25, 42, 0.64);
  border-color: rgba(226, 236, 249, 0.14);
}

body[data-theme="dark"] .workspace-onboarding-copy strong,
body[data-theme="dark"] .workspace-onboarding-stats strong,
body[data-theme="dark"] .workspace-onboarding-hints code {
  color: #d7e3f6;
}

body[data-theme="dark"] .workspace-onboarding-copy p,
body[data-theme="dark"] .workspace-onboarding-stats span,
body[data-theme="dark"] .workspace-onboarding-hints {
  color: #a9b8cc;
}


body[data-theme="dark"] .caldav-setup-card code {
  background: rgba(6, 14, 26, 0.8);
  border-color: rgba(226, 236, 249, 0.18);
  color: #f6f8fc;
}


body[data-theme="dark"] .calendar-control-bar,
body[data-theme="dark"] .calendar-workspace,
body[data-theme="dark"] .calendar-main {
  color: var(--ink);
}

body[data-theme="dark"] .calendar-status span,
body[data-theme="dark"] .segmented-control button,
body[data-theme="dark"] .calendar-legend button,
body[data-theme="dark"] .calendar-agenda,
body[data-theme="dark"] .calendar-sidebar .review-section {
  background: rgba(15, 28, 47, 0.92);
  border-color: rgba(226, 236, 249, 0.16);
  color: var(--ink);
}

body[data-theme="dark"] .segmented-control button.active {
  background: #5b95ff;
  border-color: #5b95ff;
  color: #ffffff;
}

body[data-theme="dark"] .calendar-month {
  background: rgba(226, 236, 249, 0.18);
  border-color: rgba(226, 236, 249, 0.18);
}

body[data-theme="dark"] .calendar-month-head {
  background: #111f35;
  color: #9dacbf;
}

body[data-theme="dark"] .calendar-month-day {
  background: rgba(11, 21, 38, 0.96);
  color: var(--ink);
}

body[data-theme="dark"] .calendar-month-day:hover {
  background: rgba(17, 32, 52, 0.98);
}

body[data-theme="dark"] .calendar-month-day.outside {
  background: rgba(8, 18, 32, 0.88);
  color: #6e7c91;
}

body[data-theme="dark"] .calendar-month-day > span {
  color: #dbe7f7;
}

body[data-theme="dark"] .calendar-add-slot {
  color: #8b9aaf;
}

body[data-theme="dark"] .calendar-add-slot:hover {
  background: rgba(91, 149, 255, 0.1);
  border-color: rgba(91, 149, 255, 0.32);
  color: #cfe2ff;
}

body[data-theme="dark"] .calendar-event {
  background: rgba(91, 149, 255, 0.15);
  border-left-color: #5b95ff;
  color: #e7effc;
}

body[data-theme="dark"] .calendar-event strong {
  color: #b8d4ff;
}

body[data-theme="dark"] .calendar-event.personal {
  background: rgba(243, 196, 76, 0.16);
  border-left-color: #f3c44c;
}

body[data-theme="dark"] .calendar-event.meeting {
  background: rgba(91, 149, 255, 0.16);
  border-left-color: #5b95ff;
}

body[data-theme="dark"] .calendar-event.campaign {
  background: rgba(245, 158, 11, 0.16);
  border-left-color: #f59e0b;
}

body[data-theme="dark"] .calendar-event.hold {
  background: rgba(167, 139, 250, 0.16);
  border-left-color: #a78bfa;
}

body[data-theme="dark"] .calendar-event.travel {
  background: rgba(34, 211, 238, 0.14);
  border-left-color: #22d3ee;
}

body[data-theme="dark"] .calendar-event.scheduled {
  background: rgba(244, 114, 182, 0.14);
  border-left-color: #f472b6;
}

body[data-theme="dark"] .calendar-event.work {
  background: rgba(34, 197, 94, 0.14);
  border-left-color: #22c55e;
}

body[data-theme="dark"] .calendar-events small,
body[data-theme="dark"] .calendar-events p,
body[data-theme="dark"] .calendar-mail-item p,
body[data-theme="dark"] .calendar-decision-card p {
  color: #aeb7c5;
}

/* Final dark-mode contrast pass. Keep this last so it can rescue shared surfaces. */
body[data-theme="dark"] {
  --ink: #f4f7fb;
  --muted: #aab8cc;
  --line: rgba(188, 205, 230, 0.18);
  --card: #101b2e;
  --panel: #0b1425;
  background: #071225;
  color: var(--ink);
}

body[data-theme="dark"] .workspace {
  background:
    radial-gradient(circle at top right, rgba(62, 110, 210, 0.16), transparent 34%),
    linear-gradient(180deg, #0b1630 0%, #071225 42%, #081322 100%);
  color: var(--ink);
}


body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea,
body[data-theme="dark"] .rich-editable,
body[data-theme="dark"] .command-row input,
body[data-theme="dark"] .modal-input {
  background: rgba(7, 15, 28, 0.96);
  border-color: rgba(188, 205, 230, 0.25);
  color: #f8fbff;
}

body[data-theme="dark"] input::placeholder,
body[data-theme="dark"] textarea::placeholder {
  color: #7e8da5;
}

body[data-theme="dark"] .ghost-button,
body[data-theme="dark"] .mini-button,
body[data-theme="dark"] .text-button,
body[data-theme="dark"] .icon-button {
  background: rgba(15, 28, 47, 0.96);
  border-color: rgba(188, 205, 230, 0.24);
  color: #e8f0ff;
}

body[data-theme="dark"] .ghost-button:hover,
body[data-theme="dark"] .mini-button:hover,
body[data-theme="dark"] .text-button:hover,
body[data-theme="dark"] .icon-button:hover {
  background: rgba(30, 51, 83, 0.98);
}

body[data-theme="dark"] .theme-toggle {
  background: rgba(15, 28, 47, 0.96);
  color: #eaf2ff;
}

body[data-theme="dark"] .theme-toggle-icon {
  background: #f4c95d;
  color: #102033;
}

body[data-theme="dark"] .email-html-preview,
body[data-theme="dark"] .email-html-preview iframe {
  background: #ffffff;
  color: #17202b;
}


/* Today dashboard readability polish */
.status-band div {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 253, 0.95));
  border-color: rgba(214, 223, 235, 0.94);
  box-shadow: 0 10px 24px rgba(20, 32, 51, 0.08);
}

.status-band div::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #6fa0ff, #58c0a9);
  opacity: 0.82;
}

.status-band .metric {
  color: var(--ink);
  letter-spacing: 0;
}

.status-band p {
  color: var(--muted);
  font-weight: 600;
}

.dashboard-widgets {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.dashboard-card {
  position: relative;
  overflow: hidden;
  min-height: 330px;
  padding: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(247, 250, 253, 0.95));
  border-color: rgba(214, 223, 235, 0.94);
  color: var(--ink);
  box-shadow: 0 12px 28px rgba(20, 32, 51, 0.08);
}

.dashboard-card-mail,
.dashboard-card-files,
.dashboard-card-calendar,
.dashboard-card-tasks {
  grid-column: span 2;
}

.dashboard-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: #5f8fff;
}

.dashboard-card-mail {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(245, 249, 253, 0.96));
}

.dashboard-card-files {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 246, 241, 0.96));
}

.dashboard-card-calendar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(245, 250, 248, 0.96));
}

.dashboard-card-tasks {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(246, 248, 255, 0.96));
}

.dashboard-card-files::before {
  background: #c48a45;
}

.dashboard-card-calendar::before {
  background: #48a991;
}

.dashboard-card-tasks::before {
  background: #6d87e6;
}

.dashboard-card-heading {
  margin-bottom: 18px;
}

.dashboard-card-heading strong {
  color: var(--ink);
  font-size: 21px;
  letter-spacing: -0.01em;
}

.dashboard-card-heading p {
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
}

.dashboard-icon {
  width: 46px;
  height: 46px;
  background: rgba(95, 143, 255, 0.12);
  color: #2d5faf;
  box-shadow: inset 0 0 0 1px rgba(114, 152, 231, 0.1);
}

.dashboard-card-files .dashboard-icon {
  background: rgba(196, 138, 69, 0.12);
  color: #a96f2f;
}

.dashboard-card-calendar .dashboard-icon {
  background: rgba(72, 169, 145, 0.12);
  color: #0d7f71;
}

.dashboard-card-tasks .dashboard-icon {
  background: rgba(109, 135, 230, 0.12);
  color: #4362c7;
}

.dashboard-row,
.dashboard-folder {
  border-color: rgba(214, 223, 235, 0.94);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 6px 14px rgba(20, 32, 51, 0.05);
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.dashboard-card-mail .dashboard-row {
  min-height: 72px;
  padding: 12px 10px;
}

.dashboard-card-mail .dashboard-row {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(214, 223, 235, 0.94);
}

.dashboard-card-mail .dashboard-row:hover,
.dashboard-row:hover,
.dashboard-folder:hover {
  transform: translateY(-1px);
  background: #ffffff;
  border-color: rgba(95, 143, 255, 0.35);
  box-shadow: 0 12px 24px rgba(20, 32, 51, 0.08);
}

.dashboard-row strong,
.dashboard-folder strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.22;
  letter-spacing: 0;
}

.dashboard-row em {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.25;
}

.dashboard-row small {
  color: #6b7a91;
  font-size: 12.5px;
  letter-spacing: 0;
}

.dashboard-card-mail .mini-avatar {
  width: 34px;
  height: 34px;
  background: #ecf3ff;
  color: #2d5faf;
  box-shadow: inset 0 0 0 1px rgba(117, 170, 255, 0.12);
}

.dashboard-folder {
  min-height: 50px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.98);
  color: var(--ink);
}

.dashboard-folder span[aria-hidden="true"] {
  color: #8aa9da;
}

.dashboard-folder strong {
  color: var(--ink);
}

.dashboard-folder:hover {
  background: #ffffff;
}

.dashboard-empty {
  background: rgba(248, 250, 255, 0.92);
  border-color: rgba(214, 223, 235, 0.8);
  color: var(--muted);
}

.assistant-feed {
  border-color: rgba(183, 198, 218, 0.84);
  box-shadow: 0 16px 34px rgba(28, 46, 78, 0.08);
}

body[data-theme="dark"] .status-band div {
  background: linear-gradient(180deg, rgba(22, 37, 61, 0.98), rgba(13, 24, 42, 0.98));
  border-color: rgba(132, 161, 205, 0.28);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

body[data-theme="dark"] .status-band .metric {
  color: #f7fbff;
}

body[data-theme="dark"] .status-band p {
  color: #b8c8df;
}

body[data-theme="dark"] .dashboard-card {
  border-color: rgba(132, 161, 205, 0.25);
  box-shadow: none;
}

body[data-theme="dark"]:not([data-view="today"]) .dashboard-card-mail,
body[data-theme="dark"]:not([data-view="today"]) .dashboard-card-files,
body[data-theme="dark"]:not([data-view="today"]) .dashboard-card-calendar,
body[data-theme="dark"]:not([data-view="today"]) .dashboard-card-tasks {
  grid-column: span 2;
}

body[data-theme="dark"] .dashboard-card-mail {
  background: linear-gradient(180deg, rgba(18, 33, 56, 0.98), rgba(11, 22, 39, 0.98));
}

body[data-theme="dark"] .dashboard-card-files {
  background: linear-gradient(180deg, rgba(44, 35, 20, 0.98), rgba(20, 24, 31, 0.98));
}

body[data-theme="dark"] .dashboard-card-calendar {
  background: linear-gradient(180deg, rgba(16, 42, 39, 0.98), rgba(10, 24, 37, 0.98));
}

body[data-theme="dark"] .dashboard-card-tasks {
  background: linear-gradient(180deg, rgba(24, 32, 58, 0.98), rgba(11, 22, 39, 0.98));
}

body[data-theme="dark"] .dashboard-card-heading strong,
body[data-theme="dark"] .dashboard-row strong,
body[data-theme="dark"] .dashboard-folder strong {
  color: #f8fbff;
}

body[data-theme="dark"] .dashboard-card-heading p,
body[data-theme="dark"] .dashboard-row em,
body[data-theme="dark"] .dashboard-row small {
  color: #b4c4dc;
}

body[data-theme="dark"] .dashboard-row,
body[data-theme="dark"] .dashboard-folder,
body[data-theme="dark"] .dashboard-card-mail .dashboard-row {
  background: rgba(18, 32, 53, 0.92);
  border-color: rgba(132, 161, 205, 0.24);
  box-shadow: none;
}

body[data-theme="dark"] .dashboard-card-mail .dashboard-row {
  min-height: 72px;
}

body[data-theme="dark"] .dashboard-row:hover,
body[data-theme="dark"] .dashboard-folder:hover,
body[data-theme="dark"] .dashboard-card-mail .dashboard-row:hover {
  background: rgba(27, 47, 77, 0.98);
  border-color: rgba(115, 158, 245, 0.54);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

body[data-theme="dark"] .dashboard-icon {
  background: rgba(92, 148, 255, 0.14);
  color: #9fc0ff;
}

body[data-theme="dark"] .mini-avatar {
  background: hsl(var(--avatar-hue, 164) 46% 22%);
  color: hsl(var(--avatar-hue, 164) 62% 78%);
}


body[data-theme="dark"] .status-button {
  background: rgba(28, 49, 80, 0.98);
  border-color: rgba(132, 174, 255, 0.35);
  color: #dbe9ff;
}

body[data-theme="dark"] .status-button:hover {
  background: rgba(43, 72, 113, 0.98);
  border-color: rgba(151, 190, 255, 0.56);
  color: #ffffff;
}

body[data-theme="dark"] .danger-button {
  background: rgba(77, 31, 31, 0.9);
  border-color: rgba(255, 161, 151, 0.36);
  color: #ffc6be;
}

body[data-theme="dark"] .danger-button:hover {
  background: rgba(103, 39, 38, 0.95);
  border-color: rgba(255, 178, 168, 0.56);
  color: #ffffff;
}

body[data-theme="dark"] .config-row strong.ready,
body[data-theme="dark"] .settings-status strong.ready {
  background: rgba(62, 185, 128, 0.18);
  border: 1px solid rgba(62, 185, 128, 0.34);
  color: #b4f7d8;
}

body[data-theme="dark"] .config-row strong.pending,
body[data-theme="dark"] .settings-status strong.pending {
  background: rgba(243, 196, 76, 0.18);
  border: 1px solid rgba(243, 196, 76, 0.34);
  color: #f5d88e;
}


body[data-theme="dark"] .repcloud-desk-card.wide,
body[data-theme="dark"] .settings-hero-card {
  background: linear-gradient(135deg, rgba(18, 33, 56, 0.99), rgba(10, 20, 36, 0.99));
}

body[data-theme="dark"] .mini-row:hover,
body[data-theme="dark"] .rule-template-button:hover {
  background: rgba(27, 47, 77, 0.98);
  border-color: rgba(112, 161, 255, 0.5);
}

body[data-theme="dark"] .repcloud-desk-card h3,
body[data-theme="dark"] .repcloud-desk-card strong,
body[data-theme="dark"] .repcloud-health-grid b,
body[data-theme="dark"] .mini-row b,
body[data-theme="dark"] .rule-card-header strong,
body[data-theme="dark"] .rule-recipe-grid b,
body[data-theme="dark"] .rule-starter-summary strong,
body[data-theme="dark"] .rule-template-button strong,
body[data-theme="dark"] .settings-hero-card h3,
body[data-theme="dark"] .settings-card-header h3,
body[data-theme="dark"] .settings-status,
body[data-theme="dark"] .settings-status strong {
  color: #f8fbff;
}


body[data-theme="dark"] .settings-tab-nav button,
body[data-theme="dark"] .source-pill,
body[data-theme="dark"] .quick-prompts button {
  background: rgba(18, 33, 56, 0.98);
  border-color: rgba(188, 205, 230, 0.25);
  color: #d8e7ff;
}

body[data-theme="dark"] .settings-tab-nav button.active,
body[data-theme="dark"] .source-pill.active,
body[data-theme="dark"] .quick-prompts button:hover {
  background: rgba(91, 149, 255, 0.22);
  border-color: rgba(126, 176, 255, 0.54);
  color: #ffffff;
}

body[data-theme="dark"] .settings-grid select,
body[data-theme="dark"] .settings-page select,
body[data-theme="dark"] .settings-page input,
body[data-theme="dark"] .settings-page textarea {
  background: rgba(7, 15, 28, 0.98);
  border-color: rgba(188, 205, 230, 0.28);
  color: #f8fbff;
}

body[data-theme="dark"] .settings-page input[type="checkbox"] {
  accent-color: #6d9eff;
}

body[data-theme="dark"] .settings-page label,
body[data-theme="dark"] .settings-signature-label,
body[data-theme="dark"] .check-row {
  color: #dce8fb;
}

body[data-theme="dark"] .rule-status {
  background: rgba(18, 33, 56, 0.98);
  border-color: rgba(188, 205, 230, 0.24);
  color: #c8d8ef;
}


/* Final dark modal pass: keep dialogs readable over blurred dark pages. */
body[data-theme="dark"] .modal::backdrop {
  background: rgba(2, 8, 18, 0.62);
  backdrop-filter: blur(7px);
}

body[data-theme="dark"] .modal-card {
  background: linear-gradient(180deg, rgba(16, 29, 49, 0.99), rgba(10, 20, 36, 0.99));
  border-color: rgba(188, 205, 230, 0.28);
  color: #f8fbff;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.5);
}

body[data-theme="dark"] .modal-header,
body[data-theme="dark"] .modal-actions {
  background: transparent;
}

body[data-theme="dark"] .modal-actions {
  border-top-color: rgba(188, 205, 230, 0.18);
}

body[data-theme="dark"] .modal-card h2,
body[data-theme="dark"] .modal-card h3,
body[data-theme="dark"] .modal-card strong,
body[data-theme="dark"] .modal-card label,
body[data-theme="dark"] .modal-card .field-label {
  color: #f8fbff;
}

body[data-theme="dark"] .modal-card .eyebrow,
body[data-theme="dark"] .modal-note,
body[data-theme="dark"] .modal-card p,
body[data-theme="dark"] .modal-card small {
  color: #b9c7db;
}

body[data-theme="dark"] .modal-card .modal-note {
  color: #aebdd2;
}

body[data-theme="dark"] .modal-input,
body[data-theme="dark"] .modal-body textarea,
body[data-theme="dark"] .modal-body select,
body[data-theme="dark"] .rich-editable {
  background: rgba(7, 15, 28, 0.98);
  border-color: rgba(188, 205, 230, 0.3);
  color: #f8fbff;
}

body[data-theme="dark"] .modal-input::placeholder,
body[data-theme="dark"] .modal-body textarea::placeholder,
body[data-theme="dark"] .rich-editable:empty::before {
  color: #8090a6;
}

body[data-theme="dark"] .modal-separator {
  border-top-color: rgba(188, 205, 230, 0.18);
}

body[data-theme="dark"] .modal-inline-actions button,
body[data-theme="dark"] .rich-toolbar button {
  background: rgba(18, 33, 56, 0.98);
  border-color: rgba(188, 205, 230, 0.26);
  color: #dbe9ff;
}

body[data-theme="dark"] .modal-inline-actions button:hover,
body[data-theme="dark"] .rich-toolbar button:hover {
  background: rgba(35, 62, 106, 0.96);
  border-color: rgba(126, 176, 255, 0.54);
  color: #ffffff;
}


/* Final mail topbar alignment: desktop and tablet widths stay one clean row without clipping. */
@media (min-width: 721px) {
  body[data-view="mail"] .topbar {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    min-height: 54px !important;
    padding: 6px 14px !important;
    overflow: hidden !important;
  }

  body[data-view="mail"] .mobile-menu-button {
    display: none !important;
  }

  body[data-view="mail"] .topbar > div:first-of-type {
    display: block !important;
    flex: 0 0 132px;
    min-width: 0 !important;
    overflow: hidden;
  }

  body[data-view="mail"] .topbar h1 {
    font-size: 22px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body[data-view="mail"] .topbar h1::after {
    content: none !important;
  }

  body[data-view="mail"] .topbar-mail-search {
    --mail-topbar-control-height: 42px;
    --mail-topbar-icon-size: 44px;
    display: flex !important;
    flex: 1 1 auto;
    align-items: center !important;
    justify-content: flex-end;
    gap: 8px !important;
    min-width: 0 !important;
    width: 100%;
    overflow: hidden;
  }

  body[data-view="mail"] .topbar-mail-search > * {
    min-width: 0 !important;
  }

  body[data-view="mail"] .topbar-mail-search input,
  body[data-view="mail"] .topbar-mail-search select,
  body[data-view="mail"] .topbar-compose-button,
  body[data-view="mail"] .mail-refresh-button,
  body[data-view="mail"] .mail-view-options summary {
    min-height: var(--mail-topbar-control-height);
  }

  body[data-view="mail"] .topbar-mail-search input {
    flex: 1 1 420px;
    width: auto !important;
    min-width: 220px;
  }

  body[data-view="mail"] .topbar-mail-search select {
    flex: 0 0 148px;
    width: 148px !important;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body[data-view="mail"] .topbar-compose-button {
    flex: 0 0 auto;
    width: auto !important;
    min-width: 0 !important;
    padding-inline: 14px;
    white-space: nowrap;
  }

  body[data-view="mail"] .mail-refresh-button {
    flex: 0 0 var(--mail-topbar-icon-size);
    width: var(--mail-topbar-icon-size) !important;
    min-width: var(--mail-topbar-icon-size) !important;
    height: var(--mail-topbar-control-height);
  }

  body[data-view="mail"] .mail-view-options summary {
    width: var(--mail-topbar-icon-size) !important;
  }

  body[data-view="mail"] .top-actions {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-end !important;
    flex: 0 0 auto;
    min-width: 48px;
    margin-left: auto;
  }
}

@media (min-width: 721px) and (max-width: 1180px) {
  body[data-view="mail"] .topbar {
    gap: 10px !important;
  }

  body[data-view="mail"] .topbar > div:first-of-type {
    display: none !important;
  }

  body[data-view="mail"] .topbar-mail-search {
    justify-content: flex-start;
  }

  body[data-view="mail"] .topbar-compose-button {
    padding-inline: 12px;
  }

  body[data-view="mail"] .mail-refresh-button {
    width: var(--mail-topbar-icon-size) !important;
    min-width: var(--mail-topbar-icon-size) !important;
  }
}

@media (max-width: 720px) {
  body[data-view="mail"] .topbar {
    display: grid !important;
    grid-template-columns: 42px minmax(0, 1fr) auto !important;
    grid-template-rows: auto auto !important;
    gap: 8px;
  }

  body[data-view="mail"] .topbar-mail-search {
    display: grid !important;
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: minmax(0, 1fr) 42px !important;
  }
}


/* Brand polish pass for the shippable beta. */
.login-screen {
  --auth-button-start: #3b8fb4;
  --auth-button-end: #166a8f;
  background:
    radial-gradient(circle at 18% 18%, rgba(95, 76, 184, 0.12), transparent 25%),
    radial-gradient(circle at 88% 18%, rgba(47, 111, 214, 0.10), transparent 24%),
    radial-gradient(circle at 16% 92%, rgba(28, 184, 163, 0.08), transparent 24%),
    rgba(7, 16, 29, 0.72);
  backdrop-filter: blur(14px);
}

.login-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 12px;
  width: min(100%, 460px);
  padding: 36px;
  border: 1px solid rgba(203, 215, 232, 0.92);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 255, 0.94)),
    #fff;
  box-shadow: 0 28px 82px rgba(9, 17, 32, 0.34);
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 7px;
  background: linear-gradient(90deg, #7b58b8, #2f6fd6, #138d7c, #d6a43b);
}

.login-card img {
  width: 168px;
  margin-bottom: 18px;
}

.login-card h1 {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: clamp(2.7rem, 7vw, 3.55rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: 0;
}

.login-card .modal-note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

.login-card .field-label {
  margin: 0 0 -6px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0;
}

.login-card .modal-input {
  min-height: 46px;
  border-radius: 16px;
  padding: 0 14px;
  border-color: #dbe5ef;
}

.login-card .primary-button {
  width: 100%;
  min-height: 52px;
  justify-content: center;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(90deg, var(--auth-button-start), var(--auth-button-end));
  box-shadow: 0 16px 34px color-mix(in srgb, var(--auth-button-end) 34%, transparent);
  color: #ffffff;
  font-weight: 800;
}

.login-card .primary-button:disabled {
  opacity: 0.92;
  cursor: not-allowed;
}

.sidebar {
  background:
    radial-gradient(circle at top, rgba(77, 150, 255, 0.2), transparent 34%),
    radial-gradient(circle at bottom right, rgba(28, 184, 163, 0.14), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 260px),
    var(--nav);
}

.brand-mark {
  width: 172px;
  height: 44px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(16, 37, 63, 0.94), rgba(7, 16, 29, 0.72));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 10px 24px rgba(0, 0, 0, 0.14);
}

.account-card {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.account-card:hover {
  background: rgba(255, 255, 255, 0.1);
}

.mode-badge {
  border-color: rgba(77, 150, 255, 0.4);
  background: linear-gradient(135deg, rgba(77, 150, 255, 0.18), rgba(28, 184, 163, 0.14));
  color: #d6e8ff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.nav-item {
  border-radius: 12px;
}

.nav-item.active,
.nav-item:hover {
  background: linear-gradient(90deg, rgba(77, 150, 255, 0.24), rgba(28, 184, 163, 0.08));
  box-shadow: inset 0 0 0 1px rgba(94, 168, 255, 0.1);
}

.workspace {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 30%),
    transparent;
}

.topbar {
  border: 1px solid rgba(203, 215, 232, 0.86);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(247, 251, 255, 0.88));
  box-shadow: 0 14px 36px rgba(12, 26, 45, 0.08);
}

.topbar .eyebrow {
  color: var(--teal);
}

.topbar h1 {
  font-size: 30px;
  letter-spacing: -0.02em;
}

.topbar-mail-search input,
.topbar-mail-search select {
  border-color: rgba(194, 207, 222, 0.95);
  background: rgba(255, 255, 255, 0.96);
}

.topbar-mail-search input:focus {
  border-color: rgba(15, 111, 224, 0.56);
  box-shadow: 0 0 0 4px rgba(15, 111, 224, 0.12);
}


.command-panel {
  border: 1px solid rgba(203, 215, 232, 0.82);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 251, 255, 0.84)),
    var(--panel);
  box-shadow: 0 16px 38px rgba(12, 26, 45, 0.08);
}

.primary-button,
.ghost-button {
  border-radius: 12px;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--blue));
  box-shadow: 0 10px 22px rgba(15, 111, 224, 0.2);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(203, 215, 232, 0.86);
}


.conversation-message {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 6px 16px rgba(12, 26, 45, 0.04);
}


body[data-theme="dark"] .login-screen {
  background:
    radial-gradient(circle at top right, rgba(94, 168, 255, 0.16), transparent 24%),
    radial-gradient(circle at bottom left, rgba(28, 184, 163, 0.12), transparent 24%),
    rgba(3, 8, 16, 0.76);
}

body[data-theme="dark"] .login-card {
  border-color: rgba(148, 163, 184, 0.18);
  background:
    linear-gradient(180deg, rgba(12, 18, 29, 0.96), rgba(10, 16, 26, 0.94)),
    #09111d;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.46);
}

body[data-theme="dark"] .sidebar {
  background:
    radial-gradient(circle at top, rgba(94, 168, 255, 0.18), transparent 30%),
    radial-gradient(circle at bottom right, rgba(28, 184, 163, 0.12), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 260px),
    #050d18;
}

body[data-theme="dark"] .topbar,
body[data-theme="dark"] .command-panel {
  border-color: rgba(148, 163, 184, 0.18);
  background:
    linear-gradient(180deg, rgba(13, 19, 31, 0.94), rgba(8, 13, 22, 0.9)),
    #0b1320;
}


/* Neutral desktop refinement: calmer, less cartoonish surfaces and accents. */
.sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)),
    #0f1720;
}

body.sidebar-theme-light .sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(243, 247, 251, 0.98)),
    #f6f9fc;
  color: #152033;
}

body.sidebar-theme-light .brand-mark {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(238, 243, 249, 0.98));
  box-shadow: inset 0 0 0 1px rgba(149, 165, 183, 0.22);
}

body.sidebar-theme-light .brand-mark img.brand-mark-cloud-dark {
  filter: brightness(0) saturate(100%);
}

body.sidebar-theme-light .brand-badge {
  background: linear-gradient(135deg, rgba(47, 111, 214, 0.12), rgba(28, 184, 163, 0.08));
  color: #23549d;
  box-shadow: inset 0 0 0 1px rgba(47, 111, 214, 0.12);
}

body.sidebar-theme-light .brand span {
  color: rgba(21, 32, 51, 0.62);
}

body.sidebar-theme-light .sidebar-toggle {
  border-color: rgba(149, 165, 183, 0.28);
  background: rgba(255, 255, 255, 0.9);
  color: #243144;
}

body.sidebar-theme-light .account-card {
  border-color: rgba(149, 165, 183, 0.2);
  background: rgba(255, 255, 255, 0.92);
  color: #152033;
}

body.sidebar-theme-light .account-card:hover {
  border-color: rgba(47, 111, 214, 0.3);
  background: rgba(255, 255, 255, 0.98);
}

body.sidebar-theme-light .account-avatar {
  background: linear-gradient(135deg, rgba(47, 111, 214, 0.14), rgba(28, 184, 163, 0.10));
  color: #2f6fd6;
  border-color: rgba(47, 111, 214, 0.22);
}

body.sidebar-theme-light .account-card small {
  color: rgba(82, 99, 122, 0.84);
}

body.sidebar-theme-light .nav-item {
  color: rgba(21, 32, 51, 0.76);
}

body.sidebar-theme-light .nav-item.active,
body.sidebar-theme-light .nav-item:hover {
  background: linear-gradient(90deg, rgba(47, 111, 214, 0.12), rgba(28, 184, 163, 0.06));
  color: #1f4f99;
}

body.sidebar-theme-light .icon {
  color: #4b79c8;
}

body.sidebar-theme-light .mode-badge {
  border-color: rgba(149, 165, 183, 0.24);
  background: linear-gradient(135deg, rgba(47, 111, 214, 0.08), rgba(28, 184, 163, 0.06));
  color: #23549d;
}

.brand-mark {
  width: 172px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(18, 26, 38, 0.92), rgba(12, 18, 28, 0.92));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.mode-badge {
  border-color: rgba(148, 163, 184, 0.26);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(241, 245, 249, 0.88);
  box-shadow: none;
}

.topbar,
.command-panel {
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
}

.topbar h1 {
  font-size: 23px;
  letter-spacing: -0.02em;
}

.topbar .eyebrow {
  color: #52637a;
}

.topbar-mail-search input,
.topbar-mail-search select {
  border-color: #d7dee7;
  background: #ffffff;
  box-shadow: none;
}


.primary-button {
  background: linear-gradient(180deg, #2f6fd6, #2a63c0);
  box-shadow: none;
}


button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}


body[data-theme="dark"] button:focus-visible,
body[data-theme="dark"] input:focus-visible,
body[data-theme="dark"] select:focus-visible,
body[data-theme="dark"] textarea:focus-visible,
body[data-theme="dark"] [role="button"]:focus-visible {
  outline-color: rgba(110, 169, 255, 0.62);
}


.topbar .eyebrow,
.command-panel label,
.contact-manager-summary span,
.contact-info-grid span,
.company-profile-metrics span,
.enrichment-row p span {
  text-transform: none;
  font-size: 11px;
  font-weight: 800;
}


.conversation-message {
  background: #ffffff;
  border-color: #e2e8f0;
}


.shortcut-button {
  width: 36px;
  min-width: 36px;
  padding: 0;
  font-size: 16px;
}

.shortcut-help {
  display: grid;
  gap: 14px;
}

.shortcut-group {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fafcff;
}

.shortcut-group h3 {
  margin: 0;
  font-size: 13px;
  color: #1b2a3b;
}

.shortcut-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: #44556a;
  font-size: 13px;
}

.shortcut-row kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid #d4dce6;
  border-radius: 7px;
  background: #fff;
  color: #132131;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.shortcut-row span {
  flex: 1 1 180px;
  color: #566477;
  font-weight: 700;
}

body[data-theme="dark"] .shortcut-group {
  border-color: rgba(188, 205, 230, 0.16);
  background: rgba(14, 26, 45, 0.96);
}

body[data-theme="dark"] .shortcut-group h3 {
  color: #f1f5f9;
}

body[data-theme="dark"] .shortcut-row {
  color: #c7d4e6;
}

body[data-theme="dark"] .shortcut-row kbd {
  border-color: rgba(188, 205, 230, 0.2);
  background: rgba(7, 15, 28, 0.98);
  color: #f8fbff;
}


.topbar {
  border-color: rgba(214, 223, 235, 0.78);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 253, 0.93));
}

.command-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.92)),
    linear-gradient(90deg, rgba(94, 168, 255, 0.04), rgba(28, 184, 163, 0.03));
}

.dashboard-card {
  border-color: rgba(214, 223, 235, 0.9);
}

.dashboard-card:nth-child(2) {
  background: #fdfbf7;
}

.dashboard-card:nth-child(3) {
  background: #f7fbf9;
}

.dashboard-card:nth-child(4) {
  background: #f8faff;
}

.contact-manager-summary > div,
.contact-health-card,
.company-profile-panel,
.company-profile-metrics > div,
.company-person-row,
.company-mail-event,
.company-file-row,
.contact-info-grid > div,
.contact-mail-row,
.enrichment-row,
.repcloud-account-option,
.marketing-list-badge {
  border-color: #e2e8f0;
  background: rgba(255, 255, 255, 0.92);
}

.contact-manager-summary strong,
.contact-health-ring,
.company-profile-metrics strong {
  letter-spacing: -0.02em;
}

.source-pill {
  border-color: #dde5ef;
  background: #fff;
  color: #617186;
}

.source-pill.active {
  background: #1f63c6;
  border-color: #1f63c6;
}

.source-pill.repcloud,
.source-pill.customer,
.source-pill.lead,
.source-pill.vendor,
.source-pill.mine,
.source-pill.unassigned,
.source-pill.apple,
.source-pill.local,
.source-pill.recent {
  border-color: transparent;
}

.source-pill.repcloud,
.source-pill.customer {
  background: rgba(31, 99, 198, 0.14);
  color: #1f63c6;
}

.source-pill.lead {
  background: rgba(19, 141, 124, 0.14);
  color: #138d7c;
}

.source-pill.vendor {
  background: rgba(155, 122, 47, 0.16);
  color: #9b7a2f;
}

.source-pill.mine {
  background: rgba(37, 119, 214, 0.14);
  color: #2577d6;
}

.source-pill.unassigned {
  background: rgba(100, 116, 139, 0.12);
  color: #64748b;
}

.source-pill.apple {
  background: rgba(124, 58, 237, 0.12);
  color: #7c3aed;
}

.source-pill.local {
  background: rgba(14, 116, 144, 0.12);
  color: #0e7490;
}

.source-pill.recent {
  background: rgba(180, 83, 9, 0.12);
  color: #b45309;
}


.contact-alert-pills span {
  border-color: #dde5ef;
  background: #fafcff;
  color: #617186;
}

.address-source-summary {
  gap: 6px;
}

.address-page-strip {
  padding-top: 4px;
  padding-bottom: 4px;
}

.repcloud-account-search input,
.repcloud-account-search button,
.topbar-mail-search input,
.topbar-mail-search select,
.command-row input,
.avatar-upload-button {
  border-color: #d7e0eb;
  box-shadow: none;
}

.primary-button,
.ghost-button,
.mini-button,
.text-button,
.icon-button,
.command-row button {
  box-shadow: none;
}


body.sidebar-theme-dark .sidebar {
  background: linear-gradient(180deg, #0a1222 0%, #0d1628 100%);
  color: #e9f1ff;
}

body.sidebar-theme-light .sidebar {
  background: #f5f7fb;
  color: #162033;
}

@media (min-width: 761px) {
  html.nav-layout-topbar .app-shell,
  body.nav-layout-topbar .app-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  html.nav-layout-topbar .sidebar,
  body.nav-layout-topbar .sidebar {
    position: sticky;
    top: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    align-items: center;
    gap: 0;
    width: 100%;
    padding: 0;
    background: #08111f !important;
    background-image: none !important;
    color: #f8fbff;
    box-shadow: 0 8px 18px rgba(5, 12, 20, 0.12);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }

  html.nav-layout-topbar .brand,
  body.nav-layout-topbar .brand {
    display: none;
  }

  html.nav-layout-topbar .brand-mark,
  body.nav-layout-topbar .brand-mark {
    width: 146px;
    height: 34px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  }

  html.nav-layout-topbar .brand-badge,
  html.nav-layout-topbar .brand > div:not(.brand-mark),
  html.nav-layout-topbar .sidebar-toggle,
  body.nav-layout-topbar .brand-badge,
  body.nav-layout-topbar .brand > div:not(.brand-mark),
  body.nav-layout-topbar .sidebar-toggle {
    display: none;
  }

  html.nav-layout-topbar .account-card,
  body.nav-layout-topbar .account-card {
    display: none;
  }

  html.nav-layout-topbar .account-card:hover,
  body.nav-layout-topbar .account-card:hover {
    border-color: rgba(143, 187, 255, 0.36);
    background: rgba(255, 255, 255, 0.14);
  }

  html.nav-layout-topbar .account-card small,
  body.nav-layout-topbar .account-card small {
    color: rgba(248, 251, 255, 0.64);
  }

  html.nav-layout-topbar .nav-list,
  body.nav-layout-topbar .nav-list {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: safe center;
    gap: 4px;
    overflow-x: auto;
    padding: 8px 12px;
    margin: 0;
    min-width: 0;
    scrollbar-width: none;
    background: transparent;
    box-shadow: none;
    border-bottom: none;
  }

  html.nav-layout-topbar .nav-list::after,
  body.nav-layout-topbar .nav-list::after {
    content: "";
    display: block;
    flex: 0 0 84px;
    width: 84px;
    height: 1px;
    pointer-events: none;
  }

  html.nav-layout-topbar .topnav-brand,
  body.nav-layout-topbar .topnav-brand {
    position: relative;
    z-index: 2;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    width: 84px;
    height: auto;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
  }

  html.nav-layout-topbar .topnav-suite-selector > summary,
  body.nav-layout-topbar .topnav-suite-selector > summary {
    grid-template-columns: 30px 38px;
    min-height: 44px;
    gap: 6px;
    padding: 3px 7px;
    border-radius: 10px;
    background: #0d1a2c;
  }

  html.nav-layout-topbar .topnav-suite-selector .suite-brand-copy,
  html.nav-layout-topbar .topnav-suite-selector .suite-brand-chevron,
  body.nav-layout-topbar .topnav-suite-selector .suite-brand-copy,
  body.nav-layout-topbar .topnav-suite-selector .suite-brand-chevron {
    display: none;
  }

  html.nav-layout-topbar .topnav-suite-selector > summary > img,
  body.nav-layout-topbar .topnav-suite-selector > summary > img {
    display: block;
    width: 38px;
    height: 38px;
    object-fit: contain;
  }

  html.nav-layout-topbar .topnav-suite-selector .suite-brand-menu,
  body.nav-layout-topbar .topnav-suite-selector .suite-brand-menu {
    top: 64px;
    left: 12px;
  }

  html.nav-layout-topbar .nav-list::-webkit-scrollbar,
  body.nav-layout-topbar .nav-list::-webkit-scrollbar {
    display: none;
  }

  html.nav-layout-topbar .nav-item,
  body.nav-layout-topbar .nav-item {
    min-height: 30px;
    padding: 0 8px;
    border-radius: 8px;
    color: rgba(248, 251, 255, 0.86);
    white-space: nowrap;
  }

  html.nav-layout-topbar .nav-item svg.icon,
  body.nav-layout-topbar .nav-item svg.icon {
    color: #8bc4ff;
  }

  html.nav-layout-topbar .nav-item.active,
  html.nav-layout-topbar .nav-item:hover,
  body.nav-layout-topbar .nav-item.active,
  body.nav-layout-topbar .nav-item:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
  }

  html.nav-layout-topbar .workspace,
  body.nav-layout-topbar .workspace {
    padding-top: 10px;
  }
}

@media (min-width: 761px) and (max-width: 1180px) {
  html.nav-layout-topbar .topnav-brand,
  body.nav-layout-topbar .topnav-brand {
    width: 84px;
  }

  html.nav-layout-topbar .topnav-suite-selector > summary,
  body.nav-layout-topbar .topnav-suite-selector > summary {
    grid-template-columns: 30px 38px;
    justify-content: start;
    padding: 3px 7px;
  }

  html.nav-layout-topbar .topnav-suite-selector .suite-brand-copy,
  html.nav-layout-topbar .topnav-suite-selector .suite-brand-chevron,
  body.nav-layout-topbar .topnav-suite-selector .suite-brand-copy,
  body.nav-layout-topbar .topnav-suite-selector .suite-brand-chevron {
    display: none;
  }

  html.nav-layout-topbar .topnav-suite-selector > summary > img,
  body.nav-layout-topbar .topnav-suite-selector > summary > img {
    width: 38px;
    height: 38px;
  }
}

.diagnostics-page {
  display: grid;
  gap: 14px;
}

.diagnostics-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.diagnostics-summary article,
.diagnostics-controls,
.diagnostic-area-card,
.diagnostic-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--soft-shadow);
}

.diagnostics-summary article {
  padding: 16px;
}

.diagnostics-health.ok {
  border-color: rgba(86, 189, 130, 0.35);
}

.diagnostics-health.warning,
.diagnostics-health.action {
  border-color: rgba(214, 122, 0, 0.32);
}

.diagnostics-health.danger {
  border-color: rgba(220, 38, 38, 0.32);
}

.diagnostics-summary span,
.diagnostic-card p,
.diagnostic-area-card span,
.diagnostic-area-card small,
.diagnostics-controls p,
.diagnostic-payload summary {
  color: var(--muted);
  font-weight: 700;
}

.diagnostics-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 2rem;
}

.diagnostics-summary small {
  display: block;
  color: var(--muted);
  font-weight: 800;
  margin-top: 2px;
}

.diagnostics-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
}

.diagnostics-controls h3 {
  margin: 3px 0;
  font-size: 1.05rem;
}

.diagnostics-controls p {
  margin: 0;
}

.diagnostics-areas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.diagnostics-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.diagnostics-filters .chip-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.diagnostics-filters .chip-button span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 900;
}

.diagnostics-filters .chip-button.active {
  border-color: rgba(47, 111, 214, 0.36);
  background: rgba(232, 240, 254, 0.96);
  color: #1f5cae;
}

.diagnostic-area-card {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.diagnostic-area-card.is-quiet {
  opacity: 0.72;
}

.diagnostic-card {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.diagnostic-card.severity-warning {
  border-left: 5px solid #d67a00;
}

.diagnostic-card.severity-error {
  border-left: 5px solid #dc2626;
}

.diagnostic-card.dismissed {
  opacity: 0.62;
}

.diagnostic-card.resolved {
  border-left: 5px solid #17926a;
}

.diagnostic-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.diagnostic-card h3 {
  margin: 4px 0;
  font-size: 1.05rem;
}

.diagnostic-status {
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.1);
  color: #991b1b;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  padding: 6px 10px;
  text-transform: uppercase;
}

.diagnostic-status.is-muted {
  background: rgba(100, 116, 139, 0.12);
  color: var(--muted);
}

.diagnostic-card.resolved .diagnostic-status {
  background: rgba(22, 163, 74, 0.12);
  color: #166534;
}

.diagnostic-detail,
.diagnostic-route,
.diagnostic-recovery {
  border-radius: 12px;
  background: rgba(239, 246, 255, 0.86);
  margin: 0;
  padding: 10px 12px;
}

.diagnostic-recovery {
  display: grid;
  gap: 4px;
  border-color: rgba(47, 111, 214, 0.18);
}

.diagnostic-recovery span {
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.diagnostic-recovery p {
  margin: 0;
}

.diagnostic-payload pre {
  overflow: auto;
  max-height: 220px;
  border-radius: 12px;
  background: #0f172a;
  color: #dbeafe;
  padding: 12px;
  white-space: pre-wrap;
}

body[data-theme="dark"] .diagnostics-summary article,
body[data-theme="dark"] .diagnostics-controls,
body[data-theme="dark"] .diagnostic-area-card,
body[data-theme="dark"] .diagnostic-card {
  background: rgba(15, 23, 42, 0.86);
}

body[data-theme="dark"] .diagnostics-filters .chip-button {
  background: rgba(15, 23, 42, 0.86);
  border-color: rgba(188, 205, 230, 0.18);
  color: #edf4ff;
}

body[data-theme="dark"] .diagnostics-filters .chip-button span {
  color: #aebfdc;
}

body[data-theme="dark"] .diagnostics-filters .chip-button.active {
  background: rgba(31, 58, 96, 0.98);
  border-color: rgba(115, 158, 245, 0.5);
  color: #edf4ff;
}


body.native-shell[data-theme="dark"][data-view="today"] .dashboard-card-files {
  background: linear-gradient(180deg, rgba(44, 35, 20, 0.98), rgba(20, 24, 31, 0.98));
}

body.native-shell[data-theme="dark"][data-view="today"] .dashboard-card-heading strong,
body.native-shell[data-theme="dark"][data-view="today"] .dashboard-row strong,
body.native-shell[data-theme="dark"][data-view="today"] .dashboard-folder strong,
body.native-shell[data-theme="dark"][data-view="today"] .dashboard-approval-row strong {
  color: #f8fbff;
}

body.native-shell[data-theme="dark"][data-view="today"] .dashboard-card-heading p,
body.native-shell[data-theme="dark"][data-view="today"] .dashboard-row em,
body.native-shell[data-theme="dark"][data-view="today"] .dashboard-row small,
body.native-shell[data-theme="dark"][data-view="today"] .dashboard-empty,
body.native-shell[data-theme="dark"][data-view="today"] .dashboard-approval-row em {
  color: #b4c4dc;
}

body.native-shell[data-theme="dark"][data-view="today"] .dashboard-row,
body.native-shell[data-theme="dark"][data-view="today"] .dashboard-folder,
body.native-shell[data-theme="dark"][data-view="today"] .dashboard-card-mail .dashboard-row,
body.native-shell[data-theme="dark"][data-view="today"] .dashboard-approval-row,
body.native-shell[data-theme="dark"][data-view="today"] .mini-button {
  background: rgba(18, 32, 53, 0.92);
  border-color: rgba(132, 161, 205, 0.24);
  color: #edf4ff;
  box-shadow: none;
}

body.native-shell[data-theme="dark"][data-view="today"] .dashboard-row:hover,
body.native-shell[data-theme="dark"][data-view="today"] .dashboard-folder:hover,
body.native-shell[data-theme="dark"][data-view="today"] .dashboard-card-mail .dashboard-row:hover,
body.native-shell[data-theme="dark"][data-view="today"] .dashboard-approval-row:hover {
  background: rgba(27, 47, 77, 0.98);
  border-color: rgba(115, 158, 245, 0.54);
}


@media (max-width: 720px) {
  .diagnostics-summary {
    grid-template-columns: 1fr;
  }

  .diagnostic-card-head {
    display: grid;
  }
}

/* RepCloud atmosphere: shared cloud workspace surface and customizable Today widgets. */
body {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.52) 0 18%, transparent 18% 100%),
    linear-gradient(168deg, transparent 0 42%, rgba(67, 154, 231, 0.08) 42% 57%, transparent 57% 100%),
    linear-gradient(22deg, transparent 0 58%, rgba(23, 141, 124, 0.07) 58% 70%, transparent 70% 100%),
    linear-gradient(180deg, #f7fbff 0%, #edf5fb 48%, #f7f4ed 100%);
}

body::before,
body::after {
  display: none;
}

body[data-theme="dark"] {
  background:
    linear-gradient(145deg, rgba(98, 156, 230, 0.08) 0 18%, transparent 18% 100%),
    linear-gradient(168deg, transparent 0 42%, rgba(72, 152, 219, 0.12) 42% 57%, transparent 57% 100%),
    linear-gradient(22deg, transparent 0 58%, rgba(28, 184, 163, 0.08) 58% 70%, transparent 70% 100%),
    linear-gradient(180deg, #091420 0%, #0c1828 52%, #07121f 100%);
}

.workspace {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.06) 34%, transparent 76%),
    repeating-linear-gradient(120deg, rgba(47, 111, 214, 0.035) 0 1px, transparent 1px 92px);
}

body[data-theme="dark"] .workspace {
  background:
    linear-gradient(180deg, rgba(45, 72, 112, 0.22), rgba(12, 24, 40, 0.08) 38%, transparent 78%),
    repeating-linear-gradient(120deg, rgba(132, 181, 255, 0.045) 0 1px, transparent 1px 92px);
}

body[data-view="today"] .content-grid {
  grid-template-columns: minmax(0, 1fr);
}


body[data-view="today"] .main-column {
  max-width: 1680px;
  width: 100%;
  margin: 0 auto;
}

body[data-view="today"] .view.active {
  gap: 14px;
}

body[data-view="today"] .status-band {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}

body[data-view="today"] .status-band div {
  min-height: 82px;
  padding: 14px 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(210, 221, 235, 0.82);
  box-shadow: none;
}

body[data-view="today"] .dashboard-widgets,
body[data-view="today"]:not(.native-shell) .dashboard-widgets,
body.native-shell[data-view="today"] .dashboard-widgets {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.dashboard-hero {
  grid-column: 1 / -1;
  min-height: 132px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 24px;
  border: 1px solid rgba(210, 221, 235, 0.82);
  border-radius: 8px;
  color: #f8fbff;
  background:
    linear-gradient(156deg, rgba(255, 255, 255, 0.12) 0 11%, transparent 11% 100%),
    linear-gradient(22deg, transparent 0 54%, rgba(45, 127, 215, 0.26) 54% 63%, transparent 63% 100%),
    linear-gradient(135deg, #07101d 0%, #12366c 56%, #2478d4 100%);
  overflow: hidden;
}

.dashboard-hero p {
  margin: 0 0 6px;
  color: rgba(240, 247, 255, 0.78);
  font-weight: 800;
}

.dashboard-hero h2 {
  margin: 0;
  color: #ffffff;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: 0;
}

.dashboard-customize-button {
  flex: 0 0 auto;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(8, 21, 40, 0.46);
  color: #f8fbff;
}

body[data-view="today"] .dashboard-card {
  grid-column: span 4;
  height: 360px;
  min-height: 360px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 18px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(210, 221, 235, 0.86);
  box-shadow: 0 10px 24px rgba(20, 32, 51, 0.07);
}

body[data-view="today"]:not(.native-shell) .dashboard-card-approvals {
  display: flex;
}

body[data-view="today"] .dashboard-card::before {
  display: none;
}

body[data-view="today"] .dashboard-card-mail,
body[data-view="today"] .dashboard-card-stats,
body[data-view="today"] .dashboard-card-files,
body[data-view="today"] .dashboard-card-events,
body[data-view="today"] .dashboard-card-tasks,
body[data-view="today"] .dashboard-card-approvals,
body[data-view="today"] .dashboard-card-activity {
  grid-column: span 4;
}

body[data-view="today"] .dashboard-card-stats {
  grid-column: 1 / -1;
  height: auto;
  min-height: 0;
}

.dashboard-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-stat-tile {
  min-height: 82px;
  padding: 14px 16px;
  border: 1px solid rgba(210, 221, 235, 0.82);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
}

.dashboard-stat-tile .metric {
  display: block;
  font-size: 36px;
  line-height: 1;
  font-weight: 900;
  color: #14233a;
}

.dashboard-stat-tile p {
  margin: 10px 0 0;
  color: #69768a;
  font-size: 13px;
  font-weight: 800;
}

body[data-view="today"] .dashboard-card:nth-child(3n + 2) {
  background: rgba(255, 255, 255, 0.96);
}

body[data-view="today"] .dashboard-card:nth-child(3n + 3) {
  background: rgba(249, 252, 255, 0.96);
}

body[data-view="today"] .dashboard-card:nth-child(3n + 4) {
  background: rgba(250, 249, 246, 0.96);
}

body[data-view="today"] .dashboard-card-heading {
  align-items: center;
  margin-bottom: 16px;
}

body[data-view="today"] .dashboard-card-heading strong {
  font-size: 20px;
  line-height: 1.15;
  letter-spacing: 0;
}

body[data-view="today"] .dashboard-card-heading p {
  max-width: 28ch;
  font-size: 12.5px;
}

body[data-view="today"] .dashboard-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #eaf2ff;
  color: #255fb2;
  font-size: 22px;
}

body[data-view="today"] .dashboard-card-files .dashboard-icon {
  background: #f3ede2;
  color: #9a6527;
}

body[data-view="today"] .dashboard-card-events .dashboard-icon {
  background: #e9f6f2;
  color: #147866;
}

body[data-view="today"] .dashboard-card-tasks .dashboard-icon,
body[data-view="today"] .dashboard-card-approvals .dashboard-icon {
  background: #edf1ff;
  color: #4967cc;
}

body[data-view="today"] .dashboard-card-activity .dashboard-icon {
  background: #f2effa;
  color: #6f43bd;
}

body[data-view="today"] .dashboard-list,
body[data-view="today"] .dashboard-folder-list {
  min-height: 0;
  gap: 9px;
  overflow: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

body[data-view="today"] .dashboard-row,
body[data-view="today"] .dashboard-folder {
  min-height: 54px;
  padding: 10px 12px;
  border-radius: 8px;
  border-color: rgba(213, 224, 238, 0.88);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: none;
  transform: none;
}

body[data-view="today"] .dashboard-row:hover,
body[data-view="today"] .dashboard-folder:hover {
  transform: none;
  background: #ffffff;
  border-color: rgba(62, 122, 225, 0.38);
  box-shadow: 0 8px 18px rgba(20, 32, 51, 0.07);
}

body[data-view="today"] .dashboard-mail-row {
  min-height: 66px;
}

body[data-view="today"] .dashboard-row strong,
body[data-view="today"] .dashboard-folder strong {
  font-size: 14.5px;
}

body[data-view="today"] .dashboard-row em,
body[data-view="today"] .dashboard-row small,
body[data-view="today"] .dashboard-folder em {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: #69768a;
  font-style: normal;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-view="today"] .dashboard-folder {
  align-items: start;
}

body[data-view="today"] .dashboard-folder > span:last-child {
  min-width: 0;
}

body[data-view="today"] .dashboard-folder-snapshot {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  width: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  text-align: left;
}

body[data-view="today"] .dashboard-folder-preview {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #eaf1fb;
  border-bottom: 1px solid rgba(213, 224, 238, 0.88);
}

body[data-view="today"] .dashboard-folder-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body[data-view="today"] .dashboard-folder-copy {
  min-width: 0;
  padding: 12px;
}

.dashboard-event-row,
.dashboard-task-row,
.dashboard-approval-row,
.dashboard-activity-row {
  grid-template-columns: auto minmax(0, 1fr);
}

.task-priority-dot,
.activity-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #ff866e;
  box-shadow: 0 0 0 5px rgba(255, 134, 110, 0.12);
}

.task-priority-dot.important {
  background: #7b45d8;
  box-shadow: 0 0 0 5px rgba(123, 69, 216, 0.12);
}

.activity-dot {
  background: #55a6ff;
  box-shadow: 0 0 0 5px rgba(85, 166, 255, 0.12);
}

.dashboard-empty-state {
  display: grid;
  place-items: center;
  min-height: 188px;
  text-align: center;
}

.dashboard-empty-state span {
  color: rgba(15, 23, 42, 0.34);
  font-size: 48px;
}

.dashboard-empty-state strong,
.dashboard-empty-state em {
  display: block;
}

.dashboard-card-action {
  align-self: flex-start;
  margin-top: auto;
}

.dashboard-widget-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-widget-option {
  display: grid;
  grid-template-columns: auto auto auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 86px;
  padding: 14px;
  border: 1px solid rgba(213, 224, 238, 0.9);
  border-radius: 8px;
  background: rgba(248, 251, 255, 0.92);
  cursor: grab;
  user-select: none;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.dashboard-widget-option.dragging {
  opacity: 0.62;
  transform: scale(0.99);
}

.dashboard-widget-option.drop-target {
  border-color: rgba(47, 111, 214, 0.52);
  background: rgba(232, 241, 255, 0.96);
}

.dashboard-drag-handle {
  width: 22px;
  color: #7d8da4;
  font-weight: 900;
  text-align: center;
}

.dashboard-widget-option input {
  width: 18px;
  height: 18px;
}

.dashboard-widget-option strong,
.dashboard-widget-option em {
  display: block;
}

.dashboard-widget-option em {
  margin-top: 3px;
  color: var(--muted);
  font-style: normal;
  font-size: 12.5px;
  font-weight: 700;
}

body[data-theme="dark"][data-view="today"] .dashboard-hero {
  border-color: rgba(132, 161, 205, 0.24);
  background:
    linear-gradient(156deg, rgba(255, 255, 255, 0.09) 0 11%, transparent 11% 100%),
    linear-gradient(22deg, transparent 0 54%, rgba(64, 150, 244, 0.2) 54% 63%, transparent 63% 100%),
    linear-gradient(135deg, #050d18 0%, #0d2a58 56%, #1f63c6 100%);
}

body[data-theme="dark"][data-view="today"] .status-band div,
body[data-theme="dark"][data-view="today"] .dashboard-card,
body[data-theme="dark"][data-view="today"] .dashboard-widget-option,
body[data-theme="dark"][data-view="today"] .dashboard-stat-tile {
  background: rgba(14, 25, 42, 0.96);
  border-color: rgba(132, 161, 205, 0.24);
  color: #f8fbff;
}

body[data-theme="dark"][data-view="today"] .dashboard-stat-tile .metric {
  color: #f8fbff;
}

body[data-theme="dark"][data-view="today"] .dashboard-stat-tile p {
  color: #b3c1d5;
}

body[data-theme="dark"][data-view="today"] .dashboard-card:nth-child(3n + 3),
body[data-theme="dark"][data-view="today"] .dashboard-card:nth-child(3n + 4) {
  background: rgba(16, 29, 48, 0.96);
}

body[data-theme="dark"][data-view="today"] .dashboard-row,
body[data-theme="dark"][data-view="today"] .dashboard-folder {
  background: rgba(22, 37, 60, 0.9);
  border-color: rgba(132, 161, 205, 0.22);
}

body[data-theme="dark"][data-view="today"] .dashboard-row:hover,
body[data-theme="dark"][data-view="today"] .dashboard-folder:hover {
  background: rgba(29, 49, 79, 0.98);
  border-color: rgba(115, 158, 245, 0.5);
}

body[data-theme="dark"][data-view="today"] .dashboard-folder-preview {
  background: rgba(9, 18, 32, 0.96);
  border-color: rgba(132, 161, 205, 0.22);
}

body[data-theme="dark"][data-view="today"] .dashboard-row em,
body[data-theme="dark"][data-view="today"] .dashboard-row small,
body[data-theme="dark"][data-view="today"] .dashboard-folder em,
body[data-theme="dark"][data-view="today"] .dashboard-widget-option em {
  color: #b3c1d5;
}

body.native-shell[data-view="today"] .dashboard-widgets {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

body.native-shell[data-view="today"] .dashboard-hero {
  min-height: 116px;
}

body.native-shell[data-view="today"] .dashboard-card {
  grid-column: span 4;
  height: 330px;
  min-height: 330px;
  min-width: 0;
  padding: 16px;
}

body.native-shell[data-view="today"] .dashboard-card-stats {
  grid-column: 1 / -1;
  height: auto;
  min-height: 0;
}


@media (min-width: 761px) {
  body[data-view="mail"] .mail-reader-actions {
    align-items: flex-start !important;
    flex-wrap: wrap !important;
  }

  body[data-view="mail"] .mail-reader-actions .mail-toolbar-group {
    flex-wrap: wrap !important;
  }

  body[data-view="mail"] .mail-reader-actions .mail-toolbar-group:first-of-type {
    overflow: visible !important;
  }

  body[data-view="mail"] .mail-reader-actions .mail-toolbar-button:not(.icon),
  body[data-view="mail"] .mail-reader-actions .mail-more-actions > summary {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: fit-content !important;
    max-width: none !important;
    padding-inline: 14px !important;
    overflow: visible !important;
    white-space: nowrap !important;
  }

  body[data-view="mail"] .mail-reader-actions .mail-toolbar-label {
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
  }

  body[data-view="mail"] .mail-reader-actions .mail-toolbar-button.smart-action {
    max-width: none !important;
  }
}

/* Final mobile mail pass: make reader actions reachable and keep category
   filters/pagination from overlapping on phone-sized screens. */
@media (max-width: 760px) {
  body[data-view="mail"] #view-mail.view.active > .mail-category-tabs {
    position: relative !important;
    top: auto !important;
    z-index: 2 !important;
    flex: 0 0 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    padding-block: 5px !important;
  }

  body[data-view="mail"] #view-mail.view.active > .mail-pager-bar {
    position: relative !important;
    z-index: 1 !important;
    flex: 0 0 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    margin: 0 !important;
    padding-block: 2px !important;
  }

  body.mail-reader-open .mail-reader {
    box-sizing: border-box !important;
    height: 100svh !important;
    max-height: 100svh !important;
    padding-inline: 10px !important;
    padding-bottom: max(180px, calc(150px + env(safe-area-inset-bottom))) !important;
    scroll-padding-bottom: max(180px, calc(150px + env(safe-area-inset-bottom))) !important;
    overscroll-behavior: contain !important;
  }

  body.mail-reader-open .mail-reader-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch !important;
    width: calc(100% + 20px) !important;
    min-height: 0 !important;
    gap: 7px !important;
    margin: 0 -10px 14px !important;
    padding: calc(8px + env(safe-area-inset-top)) 10px 9px !important;
    overflow: visible !important;
  }

  body.mail-reader-open .mail-reader-actions > .mail-toolbar-group {
    display: grid !important;
    min-width: 0 !important;
    gap: 6px !important;
  }

  body.mail-reader-open .mail-reader-actions > .mobile-reader-nav {
    order: 1 !important;
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.mail-reader-open .mail-reader-actions > .mail-toolbar-group:nth-of-type(2) {
    order: 2 !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }

  body.mail-reader-open .mail-reader-actions > .mail-toolbar-group:nth-of-type(3) {
    order: 3 !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }

  body.mail-reader-open .mail-reader-actions .mail-toolbar-button {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 36px !important;
    padding: 0 7px !important;
    border-radius: 9px !important;
    font-size: 12px !important;
  }

  body.mail-reader-open .mail-reader-actions .mail-toolbar-icon {
    font-size: 14px !important;
  }

  body.mail-reader-open .mail-reader-actions .mail-reply-all-icon {
    width: 20px !important;
    height: 16px !important;
  }

  body.mail-reader-open .mail-reader-actions .mobile-reader-back {
    justify-content: flex-start !important;
    min-width: 0 !important;
    max-width: none !important;
    padding-inline: 12px !important;
    font-size: 13px !important;
  }

  body.mail-reader-open .mail-reader-actions > .mail-toolbar-group:nth-of-type(3) .mail-toolbar-button.icon,
  body.mail-reader-open .mail-reader-actions .mail-more-actions > summary {
    min-width: 0 !important;
    max-width: none !important;
    width: 100% !important;
  }

  body.mail-reader-open .mail-reader-actions .mail-more-actions-menu {
    position: fixed !important;
    top: var(--mail-more-menu-top, 124px) !important;
    left: var(--mail-more-menu-left, 12px) !important;
    right: auto !important;
    z-index: 10000 !important;
    width: min(260px, calc(100vw - 20px)) !important;
    max-height: min(66dvh, 430px) !important;
    overflow: auto !important;
  }
}


@media (max-width: 760px) {
  body.mail-reader-open .mail-reader {
    box-sizing: border-box !important;
    height: 100svh !important;
    max-height: 100svh !important;
    overscroll-behavior: contain !important;
    padding-inline: 10px !important;
    padding-bottom: max(230px, calc(190px + env(safe-area-inset-bottom))) !important;
    scroll-padding-bottom: max(230px, calc(190px + env(safe-area-inset-bottom))) !important;
  }

  body.mail-reader-open .mail-reader > :last-child {
    margin-bottom: max(42px, env(safe-area-inset-bottom)) !important;
  }

  body.mail-reader-open .mail-reader-actions {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: calc(100% + 20px) !important;
    min-height: 56px !important;
    margin: 0 -10px 14px !important;
    padding: calc(8px + env(safe-area-inset-top)) 10px 9px !important;
    overflow: visible !important;
  }

  body.mail-reader-open .mail-reader-actions .mail-toolbar-group {
    min-width: 0 !important;
  }

  body.mail-reader-open .mail-reader-actions .mail-toolbar-group:first-of-type {
    flex: 1 1 auto !important;
    display: flex !important;
    gap: 7px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding-right: 2px !important;
    scrollbar-width: none !important;
  }

  body.mail-reader-open .mail-reader-actions .mail-toolbar-group:first-of-type::-webkit-scrollbar {
    display: none !important;
  }

  body.mail-reader-open .mail-reader-actions .mail-toolbar-group:last-of-type {
    flex: 0 0 auto !important;
    display: flex !important;
    gap: 6px !important;
    margin-left: 0 !important;
  }

  body.mail-reader-open .mail-reader-actions .mail-toolbar-group:last-of-type > .mail-toolbar-button.icon {
    display: none !important;
  }

  body.mail-reader-open .mail-reader-actions .mail-toolbar-button {
    flex: 0 0 auto !important;
    min-width: max-content !important;
    max-width: 128px !important;
    min-height: 40px !important;
    padding: 0 12px !important;
    border-radius: 10px !important;
    font-size: 14px !important;
  }

  body.mail-reader-open .mail-reader-actions .mobile-reader-back {
    max-width: 82px !important;
  }

  body.mail-reader-open .mail-reader-actions .mail-more-actions > summary {
    min-width: 82px !important;
    max-width: 92px !important;
    padding-inline: 10px !important;
  }

  body.mail-reader-open .mail-reader-actions .mail-more-actions-menu {
    position: fixed !important;
    top: var(--mail-more-menu-top, 64px) !important;
    left: var(--mail-more-menu-left, 12px) !important;
    right: auto !important;
    z-index: 10000 !important;
    width: min(236px, calc(100vw - 20px)) !important;
    max-height: min(70dvh, 420px) !important;
    overflow: auto !important;
  }

  body:not(.native-compose-window) .modal {
    width: 100vw !important;
    max-width: 100vw !important;
  }

  body:not(.native-compose-window) .modal-card {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    padding: 0 !important;
    border-radius: 0 !important;
  }

  body:not(.native-compose-window) .modal-header {
    padding: 14px 16px 10px !important;
  }

  body:not(.native-compose-window) .modal-body {
    gap: 12px !important;
    padding: 0 16px 18px !important;
    overflow: auto !important;
  }

  body:not(.native-compose-window) .compose-modal-grid {
    gap: 10px !important;
  }

  body:not(.native-compose-window) .compose-recipient-input-row {
    align-items: stretch !important;
    flex-wrap: wrap !important;
    min-height: 0 !important;
  }

  body:not(.native-compose-window) .compose-recipient-chip,
  body:not(.native-compose-window) .compose-recipient-input-row .modal-input {
    flex: 1 1 100% !important;
  }

  body:not(.native-compose-window) .compose-body {
    min-height: 34dvh !important;
    max-height: 46dvh !important;
    padding: 14px !important;
    overflow: auto !important;
  }

  body:not(.native-compose-window) .compose-rich-editor .rich-toolbar {
    gap: 6px !important;
    padding: 8px !important;
    overflow-x: auto !important;
  }

  body:not(.native-compose-window) .modal-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin: 0 !important;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom)) !important;
    border-top: 1px solid #dfe7f1 !important;
  }

  body:not(.native-compose-window) .modal-actions .primary-button,
  body:not(.native-compose-window) .modal-actions .ghost-button {
    flex: 1 1 calc(50% - 8px) !important;
    min-width: 0 !important;
    min-height: 42px !important;
    padding-inline: 10px !important;
  }

  body:not(.native-compose-window) .modal-actions [data-action="send-compose"] {
    order: -1 !important;
    flex-basis: 100% !important;
  }
}

/* Final phone mail chrome guard: the topbar uses a compact stacked layout on
   phones so search/actions/profile/category/stats never overlap the list. */
@media (max-width: 760px) {
  body[data-view="mail"]:not(.mail-reader-open) .workspace {
    padding: 0 !important;
    overflow-x: hidden !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .topbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 40 !important;
    display: grid !important;
    grid-template-columns: 48px minmax(0, 1fr) auto !important;
    grid-template-rows: 48px auto !important;
    gap: 8px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 10px 12px 9px !important;
    border-width: 0 0 1px !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .mobile-menu-button {
    grid-column: 1 !important;
    grid-row: 1 !important;
    display: inline-grid !important;
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
    margin: 0 !important;
    border-radius: 12px !important;
    place-self: center start !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .topbar > div:first-of-type {
    display: none !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .top-actions {
    grid-column: 2 / -1 !important;
    grid-row: 1 !important;
    display: grid !important;
    grid-template-columns: minmax(0, auto) 46px !important;
    justify-content: end !important;
    align-items: center !important;
    gap: 8px !important;
    min-width: 0 !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .top-actions > :not(#openai-status-alert):not(#theme-toggle) {
    display: none !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) #openai-status-alert {
    display: inline-flex !important;
    max-width: min(190px, calc(100vw - 126px)) !important;
    min-height: 36px !important;
    padding: 0 10px !important;
    justify-content: center !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 13px !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) #openai-status-alert[hidden] {
    display: none !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) #theme-toggle {
    display: inline-grid !important;
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
    padding: 0 !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .topbar-mail-search {
    --mail-topbar-control-height: 40px !important;
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 48px !important;
    grid-template-rows: 40px 40px 44px !important;
    align-items: stretch !important;
    gap: 7px !important;
    min-width: 0 !important;
    width: 100% !important;
    overflow: visible !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .topbar-mail-search input {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    min-width: 0 !important;
    width: 100% !important;
    height: 40px !important;
    min-height: 40px !important;
    padding-inline: 10px !important;
    border-radius: 10px !important;
    font-size: 14px !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .topbar-mail-search select {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    width: 100% !important;
    max-width: none !important;
    height: 40px !important;
    min-height: 40px !important;
    padding-inline: 10px 30px !important;
    border-radius: 10px !important;
    font-size: 14px !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .topbar-compose-button {
    grid-column: 1 !important;
    grid-row: 3 !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 44px !important;
    min-height: 44px !important;
    border-radius: 10px !important;
    font-size: 15px !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .mail-refresh-button,
  body[data-view="mail"]:not(.mail-reader-open) .mail-view-options summary {
    width: 48px !important;
    min-width: 48px !important;
    height: 44px !important;
    min-height: 44px !important;
    border-radius: 10px !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .mail-refresh-button {
    grid-column: 2 !important;
    grid-row: 3 !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .mail-view-options {
    display: none !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) #view-mail.view.active > .mail-profile-strip {
    display: flex !important;
    flex: 0 0 54px !important;
    min-height: 54px !important;
    max-height: 54px !important;
    gap: 8px !important;
    padding: 6px 12px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: none !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) #view-mail.view.active > .mail-profile-strip::-webkit-scrollbar {
    display: none !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .mail-profile-switch {
    flex: 0 0 240px !important;
    min-width: 240px !important;
    max-width: 240px !important;
    min-height: 42px !important;
    padding: 5px 9px !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .mail-profile-switch.active {
    flex-basis: 260px !important;
    min-width: 260px !important;
    max-width: 260px !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) #view-mail.view.active > .mail-category-tabs {
    display: flex !important;
    flex: 0 0 46px !important;
    min-height: 46px !important;
    max-height: 46px !important;
    flex-wrap: nowrap !important;
    gap: 7px !important;
    padding: 7px 12px 6px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: none !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) #view-mail.view.active > .mail-category-tabs::-webkit-scrollbar {
    display: none !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) #view-mail.view.active > .mail-category-tabs button {
    flex: 0 0 auto !important;
    min-height: 32px !important;
    max-height: 32px !important;
    padding: 0 10px !important;
    font-size: 14px !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) #view-mail.view.active > .mail-pager-bar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    flex: 0 0 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    margin: 0 !important;
    padding: 4px 12px !important;
    overflow: hidden !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .mail-pager-bar .mail-utility-rail {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 8px !important;
    min-width: 0 !important;
    width: 100% !important;
    height: 36px !important;
    max-height: 36px !important;
    overflow: hidden !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .mail-pager-bar > .mail-stats,
  body[data-view="mail"]:not(.mail-reader-open) .mail-pager-bar .mail-utility-stats,
  body[data-view="mail"]:not(.mail-reader-open) .mail-pager-bar > div:first-child {
    min-width: 0 !important;
    height: 28px !important;
    max-height: 28px !important;
    overflow: hidden !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
    font-size: 12px !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .mail-pager-bar .mail-utility-stats article {
    flex: 0 0 auto !important;
    display: inline-flex !important;
    align-items: baseline !important;
    gap: 3px !important;
    height: 18px !important;
    max-height: 18px !important;
    min-height: 0 !important;
    overflow: hidden !important;
    white-space: nowrap !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .mail-pager-bar .mail-utility-stats article:nth-child(n+3) {
    display: none !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) #view-mail.view.active > .mail-workspace {
    min-height: 0 !important;
    overflow: hidden !important;
  }
}

@media (max-width: 1100px) {
  .dashboard-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1320px) {
  body[data-view="today"] .dashboard-card-mail,
  body[data-view="today"] .dashboard-card-files,
  body[data-view="today"] .dashboard-card-events,
  body[data-view="today"] .dashboard-card-tasks,
  body[data-view="today"] .dashboard-card-approvals,
  body[data-view="today"] .dashboard-card-activity {
    grid-column: span 6;
  }
}

@media (max-width: 860px) {
  .mail-utility-rail {
    align-items: flex-start;
    flex-direction: column;
  }

  .mail-utility-stats {
    gap: 10px;
  }

  .mail-pagination {
    margin-left: 0;
  }

  body[data-view="today"] .status-band,
  .dashboard-widget-picker {
    grid-template-columns: 1fr;
  }

  body[data-view="today"] .dashboard-card-mail,
  body[data-view="today"] .dashboard-card-files,
  body[data-view="today"] .dashboard-card-events,
  body[data-view="today"] .dashboard-card-tasks,
  body[data-view="today"] .dashboard-card-approvals,
  body[data-view="today"] .dashboard-card-activity {
    grid-column: 1 / -1;
  }

  .dashboard-hero {
    align-items: flex-start;
    flex-direction: column;
    min-height: 150px;
  }

  .dashboard-hero h2 {
    font-size: 28px;
  }
}

/* Final mobile mail reader guard: keep the back button and action rows in
   document flow so message headers never slide under the toolbar. */
@media (max-width: 760px) {
  body.mail-reader-open .mail-reader {
    display: block !important;
    padding-inline: 10px !important;
    padding-bottom: max(190px, calc(160px + env(safe-area-inset-bottom))) !important;
    overflow-x: hidden !important;
  }

  body.mail-reader-open .mail-reader-actions {
    position: sticky !important;
    top: 0 !important;
    z-index: 20 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(38px, auto) minmax(40px, auto) minmax(40px, auto) !important;
    align-items: stretch !important;
    align-content: start !important;
    width: calc(100% + 20px) !important;
    height: auto !important;
    min-height: calc(126px + env(safe-area-inset-top)) !important;
    margin: 0 -10px 18px !important;
    padding: calc(8px + env(safe-area-inset-top)) 10px 10px !important;
    gap: 7px !important;
    border-radius: 0 0 14px 14px !important;
    overflow: visible !important;
  }

  body.mail-reader-open .mail-reader-actions > .mail-toolbar-group {
    display: grid !important;
    min-width: 0 !important;
    width: 100% !important;
    gap: 6px !important;
    overflow: visible !important;
  }

  body.mail-reader-open .mail-reader-actions > .mobile-reader-nav {
    grid-row: 1 !important;
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.mail-reader-open .mail-reader-actions > .mail-toolbar-group:not(.mobile-reader-nav):nth-of-type(2) {
    grid-row: 2 !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }

  body.mail-reader-open .mail-reader-actions > .mail-toolbar-group:not(.mobile-reader-nav):nth-of-type(3) {
    grid-row: 3 !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }

  body.mail-reader-open .mail-reader-actions .mail-toolbar-button,
  body.mail-reader-open .mail-reader-actions .mail-more-actions > summary {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 38px !important;
    max-height: 42px !important;
    padding: 0 7px !important;
    justify-content: center !important;
    border-radius: 10px !important;
    font-size: 12px !important;
    line-height: 1 !important;
  }

  body.mail-reader-open .mail-reader-actions .mobile-reader-back {
    justify-content: flex-start !important;
    padding-inline: 12px !important;
    font-size: 13px !important;
  }

  body.mail-reader-open .mail-reader-actions .mail-toolbar-icon {
    font-size: 14px !important;
  }

  body.mail-reader-open .mail-reader-actions .mail-message-header,
  body.mail-reader-open .mail-message-header {
    margin-top: 0 !important;
    padding-top: 4px !important;
  }
}

/* End-of-file mobile mail pager override. Keep this last. */
@media (max-width: 760px) {
  body[data-view="mail"]:not(.mail-reader-open),
  body[data-view="mail"]:not(.mail-reader-open) .app-shell,
  body[data-view="mail"]:not(.mail-reader-open) .workspace {
    min-height: 100dvh !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .topbar {
    position: static !important;
    top: auto !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) #view-mail.view.active {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) #view-mail.view.active > .mail-workspace,
  body[data-view="mail"]:not(.mail-reader-open) .mail-workspace,
  body[data-view="mail"]:not(.mail-reader-open) .mail-workspace .mail-table {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) #mail-list {
    overflow: visible !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .mail-pager-bar .mail-utility-rail {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 8px !important;
    height: 36px !important;
    max-height: 36px !important;
    overflow: hidden !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .mail-pager-bar .mail-utility-stats {
    display: none !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .mail-pager-bar .mail-pagination {
    justify-self: end !important;
    align-self: center !important;
    height: 30px !important;
    max-height: 30px !important;
    overflow: hidden !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .topbar {
    position: static !important;
    top: auto !important;
  }
}

/* Absolute final mobile pager clamp: this follows the generic mobile utility
   rail rules so the stats row cannot climb into category filters. */
@media (max-width: 760px) {
  body[data-view="mail"]:not(.mail-reader-open) .mail-pager-bar .mail-utility-rail {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 8px !important;
    height: 36px !important;
    max-height: 36px !important;
    overflow: hidden !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .mail-pager-bar .mail-utility-stats {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    width: auto !important;
    min-width: 0 !important;
    height: 22px !important;
    max-height: 22px !important;
    overflow: hidden !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .mail-pager-bar .mail-utility-stats article {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    align-items: baseline !important;
    gap: 3px !important;
    height: 18px !important;
    max-height: 18px !important;
    min-height: 0 !important;
    overflow: hidden !important;
    white-space: nowrap !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .mail-pager-bar .mail-utility-stats article:nth-child(n+3) {
    display: none !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .mail-pager-bar .mail-pagination {
    align-self: center !important;
    height: 30px !important;
    max-height: 30px !important;
    overflow: hidden !important;
  }
}

/* End-of-file mobile mail pager override. Keep this last. */
@media (max-width: 760px) {
  body[data-view="mail"]:not(.mail-reader-open) .mail-pager-bar .mail-utility-rail {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 8px !important;
    height: 36px !important;
    max-height: 36px !important;
    overflow: hidden !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .mail-pager-bar .mail-utility-stats {
    display: none !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .mail-pager-bar .mail-pagination {
    justify-self: end !important;
    align-self: center !important;
    height: 30px !important;
    max-height: 30px !important;
    overflow: hidden !important;
  }
}

/* Mobile and narrow tablet navigation has one mode: hamburger opens the drawer.
   Desktop can still use topbar/sidebar preferences, but narrow screens should
   never keep the horizontal top nav pinned above the page. */
@media (max-width: 900px) {
  html.nav-layout-topbar .app-shell,
  body.nav-layout-topbar .app-shell,
  html.nav-layout-sidebar .app-shell,
  body.nav-layout-sidebar .app-shell {
    display: block !important;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
    min-height: 100vh !important;
  }

  html.nav-layout-topbar .sidebar,
  body.nav-layout-topbar .sidebar,
  html.nav-layout-sidebar .sidebar,
  body.nav-layout-sidebar .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    z-index: 80 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px !important;
    width: min(84vw, 320px) !important;
    max-width: 320px !important;
    height: 100dvh !important;
    padding: 18px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    transform: translateX(-104%) !important;
    transition: transform 180ms ease !important;
    background: linear-gradient(180deg, #0a1222 0%, #0d1628 100%) !important;
    color: #e9f1ff !important;
    box-shadow: 24px 0 60px rgba(10, 16, 20, 0.28) !important;
    border: 0 !important;
  }

  body.mobile-nav-open .sidebar {
    transform: translateX(0) !important;
  }

  html.nav-layout-topbar .brand,
  body.nav-layout-topbar .brand,
  html.nav-layout-topbar .account-card,
  body.nav-layout-topbar .account-card {
    display: flex !important;
  }

  html.nav-layout-topbar .brand,
  body.nav-layout-topbar .brand {
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    padding-right: 0 !important;
  }

  html.nav-layout-topbar .account-card,
  body.nav-layout-topbar .account-card,
  html.nav-layout-sidebar .account-card,
  body.nav-layout-sidebar .account-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    min-height: 56px !important;
    height: auto !important;
    padding: 10px 12px !important;
    align-items: center !important;
    overflow: visible !important;
    flex: 0 0 auto !important;
  }

  html.nav-layout-topbar .account-card .account-avatar,
  body.nav-layout-topbar .account-card .account-avatar,
  html.nav-layout-sidebar .account-card .account-avatar,
  body.nav-layout-sidebar .account-card .account-avatar {
    width: 38px !important;
    height: 38px !important;
    flex: 0 0 38px !important;
  }

  html.nav-layout-topbar .account-card > span:not(.account-avatar),
  body.nav-layout-topbar .account-card > span:not(.account-avatar),
  html.nav-layout-sidebar .account-card > span:not(.account-avatar),
  body.nav-layout-sidebar .account-card > span:not(.account-avatar) {
    display: grid !important;
    gap: 2px !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  html.nav-layout-topbar .account-card span,
  body.nav-layout-topbar .account-card span,
  html.nav-layout-sidebar .account-card span,
  body.nav-layout-sidebar .account-card span {
    min-width: 0 !important;
  }

  html.nav-layout-topbar .account-card strong,
  body.nav-layout-topbar .account-card strong,
  html.nav-layout-sidebar .account-card strong,
  body.nav-layout-sidebar .account-card strong,
  html.nav-layout-topbar .account-card small,
  body.nav-layout-topbar .account-card small,
  html.nav-layout-sidebar .account-card small,
  body.nav-layout-sidebar .account-card small {
    max-width: 100% !important;
    line-height: 1.15 !important;
  }

  html.nav-layout-topbar .brand-badge,
  html.nav-layout-topbar .brand > div:not(.brand-mark),
  body.nav-layout-topbar .brand-badge,
  body.nav-layout-topbar .brand > div:not(.brand-mark),
  html.nav-layout-topbar .account-card small,
  body.nav-layout-topbar .account-card small,
  html.nav-layout-topbar .nav-item span:last-child,
  body.nav-layout-topbar .nav-item span:last-child {
    display: block !important;
  }

  html.nav-layout-topbar .sidebar-toggle,
  body.nav-layout-topbar .sidebar-toggle,
  html.nav-layout-sidebar .sidebar-toggle,
  body.nav-layout-sidebar .sidebar-toggle,
  html.nav-layout-topbar .topnav-brand,
  body.nav-layout-topbar .topnav-brand {
    display: none !important;
  }

  html.nav-layout-topbar .nav-list,
  body.nav-layout-topbar .nav-list,
  html.nav-layout-sidebar .nav-list,
  body.nav-layout-sidebar .nav-list {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
  }

  html.nav-layout-topbar .nav-item,
  body.nav-layout-topbar .nav-item,
  html.nav-layout-sidebar .nav-item,
  body.nav-layout-sidebar .nav-item {
    display: flex !important;
    justify-content: flex-start !important;
    min-height: 46px !important;
    width: 100% !important;
    padding: 0 12px !important;
    border-radius: 12px !important;
    color: rgba(248, 251, 255, 0.86) !important;
    white-space: normal !important;
  }

  html.nav-layout-topbar .workspace,
  body.nav-layout-topbar .workspace,
  html.nav-layout-sidebar .workspace,
  body.nav-layout-sidebar .workspace {
    padding-top: 0 !important;
  }

  .mobile-menu-button {
    display: inline-grid !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .topbar {
    position: relative !important;
    top: auto !important;
    z-index: 20 !important;
    display: grid !important;
    grid-template-columns: 48px minmax(0, 1fr) auto !important;
    grid-template-rows: 46px auto !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 8px 10px 9px !important;
    border-width: 0 0 1px !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .topbar-mail-search {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 48px !important;
    grid-template-rows: 38px 38px 42px !important;
    gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .topbar-mail-search input,
  body[data-view="mail"]:not(.mail-reader-open) .topbar-mail-search select {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 38px !important;
    min-height: 38px !important;
    border-radius: 10px !important;
    font-size: 14px !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .topbar-mail-search input {
    grid-row: 1 !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .topbar-mail-search select {
    grid-row: 2 !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .topbar-compose-button {
    grid-column: 1 !important;
    grid-row: 3 !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 42px !important;
    min-height: 42px !important;
    border-radius: 10px !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .mail-refresh-button {
    grid-column: 2 !important;
    grid-row: 3 !important;
    width: 48px !important;
    min-width: 48px !important;
    height: 42px !important;
    min-height: 42px !important;
    border-radius: 10px !important;
  }

  body[data-view="mail"]:not(.mail-reader-open) .mail-view-options {
    display: none !important;
  }
}

/* End-of-file mobile reader override. Keep this after all older mobile toolbar
   rules so every email action is reachable on phone-sized screens. */
@media (max-width: 760px) {
  body[data-view="mail"].mail-reader-open .mail-reader {
    position: fixed !important;
    inset: 0 !important;
    display: block !important;
    box-sizing: border-box !important;
    width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    padding: 0 10px max(280px, calc(230px + env(safe-area-inset-bottom))) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    scroll-padding-bottom: max(280px, calc(230px + env(safe-area-inset-bottom))) !important;
  }

  body[data-view="mail"].mail-reader-open .mail-reader-actions {
    position: sticky !important;
    top: 0 !important;
    z-index: 30 !important;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-auto-rows: minmax(42px, auto) !important;
    align-items: stretch !important;
    align-content: start !important;
    gap: 8px !important;
    width: calc(100% + 20px) !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 -10px 16px !important;
    padding: calc(8px + env(safe-area-inset-top)) 10px 10px !important;
    overflow: visible !important;
  }

  body[data-view="mail"].mail-reader-open .mail-reader-actions > .mail-toolbar-group {
    display: contents !important;
  }

  body[data-view="mail"].mail-reader-open .mail-reader-actions > .mobile-reader-nav {
    display: grid !important;
    grid-column: 1 / -1 !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
  }

  body[data-view="mail"].mail-reader-open .mail-reader-actions .mail-toolbar-button.icon {
    display: none !important;
  }

  body[data-view="mail"].mail-reader-open .mail-reader-actions .mail-toolbar-button,
  body[data-view="mail"].mail-reader-open .mail-reader-actions .mail-more-actions > summary {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 42px !important;
    max-height: none !important;
    padding: 0 8px !important;
    border-radius: 10px !important;
    font-size: 12.5px !important;
    line-height: 1.08 !important;
    white-space: normal !important;
    text-align: center !important;
  }

  body[data-view="mail"].mail-reader-open .mail-reader-actions .mail-toolbar-label {
    min-width: 0 !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
  }

  body[data-view="mail"].mail-reader-open .mail-reader-actions .mail-toolbar-button:not(.mobile-reader-back):not(.icon) .mail-toolbar-icon {
    display: none !important;
  }

  body[data-view="mail"].mail-reader-open .mail-reader-actions .mail-more-actions {
    width: 100% !important;
    min-width: 0 !important;
  }

  body[data-view="mail"].mail-reader-open .mail-reader-actions .mobile-reader-back {
    justify-content: flex-start !important;
    padding-inline: 12px !important;
    text-align: left !important;
    white-space: nowrap !important;
  }

  body[data-view="mail"].mail-reader-open .mail-message-header {
    margin-top: 0 !important;
    padding-top: 6px !important;
  }

  body[data-view="mail"].mail-reader-open .review-section,
  body[data-view="mail"].mail-reader-open .message-body-card,
  body[data-view="mail"].mail-reader-open .quick-summary-card,
  body[data-view="mail"].mail-reader-open .suggested-playbook-card,
  body[data-view="mail"].mail-reader-open .mail-compact-details,
  body[data-view="mail"].mail-reader-open .mail-analysis-details,
  body[data-view="mail"].mail-reader-open .mailbox-actions {
    max-height: none !important;
    overflow: visible !important;
  }

  body[data-view="mail"].mail-reader-open .email-html-preview {
    max-height: none !important;
    overflow: visible !important;
    -webkit-overflow-scrolling: auto !important;
  }

  body[data-view="mail"].mail-reader-open .email-html-preview iframe {
    height: auto;
    max-height: none !important;
    overflow: hidden !important;
  }

  body[data-view="mail"].mail-reader-open .message-body-card .primary-button,
  body[data-view="mail"].mail-reader-open .suggested-playbook-card .primary-button,
  body[data-view="mail"].mail-reader-open .mail-compact-details .primary-button {
    width: 100% !important;
    max-width: 100% !important;
    white-space: normal !important;
  }

  body[data-view="mail"].mail-reader-open .mail-compact-details > summary,
  body[data-view="mail"].mail-reader-open .mail-compact-details.mailbox-actions > summary {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: start !important;
    gap: 5px !important;
    min-height: 0 !important;
    padding: 12px 14px !important;
  }

  body[data-view="mail"].mail-reader-open .mail-compact-details > summary strong,
  body[data-view="mail"].mail-reader-open .mail-compact-details.mailbox-actions > summary strong {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }

  body[data-view="mail"].mail-reader-open .mailbox-action-row,
  body[data-view="mail"].mail-reader-open .mailbox-file-row,
  body[data-view="mail"].mail-reader-open .mail-compact-details.mailbox-actions .mailbox-file-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  body[data-view="mail"].mail-reader-open .mailbox-file-row select {
    min-width: 0 !important;
    width: 100% !important;
  }

  body[data-view="mail"].mail-reader-open .mail-compact-details.mailbox-actions[open] > :not(summary) {
    box-sizing: border-box !important;
    width: auto !important;
    max-width: 100% !important;
    margin-right: 12px !important;
    margin-left: 12px !important;
  }

  body[data-view="mail"].mail-reader-open .mailbox-action-row > *,
  body[data-view="mail"].mail-reader-open .mailbox-file-row > *,
  body[data-view="mail"].mail-reader-open .mail-compact-details.mailbox-actions .mail-action-toolbar > * {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
  }

  body[data-view="mail"].mail-reader-open .mail-compact-details.mailbox-actions .mail-action-toolbar {
    position: static !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 8px 0 0 !important;
    padding: 8px !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    backdrop-filter: none !important;
  }
}

/* Desktop reader action labels must stay readable. Let the toolbar wrap instead
   of squeezing command names into ellipses when the reader column narrows. */
@media (min-width: 761px), (hover: hover) and (pointer: fine) {
  body[data-view="mail"] .mail-reader-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    row-gap: 8px !important;
    column-gap: 8px !important;
    overflow: visible !important;
  }

  body[data-view="mail"] .mail-reader-actions > .mail-toolbar-group {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
    min-width: 0 !important;
    overflow: visible !important;
  }

  body[data-view="mail"] .mail-reader-actions > .mail-toolbar-group:first-of-type {
    flex: 1 1 560px !important;
  }

  body[data-view="mail"] .mail-reader-actions > .mail-toolbar-group:last-of-type {
    flex: 0 1 auto !important;
  }

  body[data-view="mail"] .mail-reader-actions .mail-toolbar-button:not(.icon),
  body[data-view="mail"] .mail-reader-actions .mail-more-actions > summary {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: max-content !important;
    max-width: none !important;
    padding-inline: 15px !important;
    overflow: visible !important;
    white-space: nowrap !important;
  }

  body[data-view="mail"] .mail-reader-actions .mail-toolbar-label {
    display: inline !important;
    max-width: none !important;
    min-width: max-content !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
  }

  body[data-view="mail"] .mail-reader-actions .mail-toolbar-icon {
    flex: 0 0 auto !important;
  }

  body[data-view="mail"] .mail-reader-actions .mail-toolbar-button.icon {
    flex: 0 0 42px !important;
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
  }

  body[data-view="mail"] .mail-reader-actions .mail-more-actions {
    flex: 0 0 auto !important;
  }
}


.notification-top-button {
  position: relative;
  width: 42px;
  justify-content: center;
  padding: 0;
}

.notification-top-button strong {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 19px;
  height: 19px;
  border: 2px solid #fff;
  padding: 0 5px;
  font-size: 10px;
}


.notification-center {
  position: fixed;
  top: 74px;
  right: 22px;
  z-index: 80;
  width: min(390px, calc(100vw - 32px));
  max-height: min(620px, calc(100vh - 94px));
  overflow: hidden;
  border: 1px solid rgba(190, 205, 226, 0.92);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.17);
  backdrop-filter: blur(16px);
}

.notification-center-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 15px 16px 13px;
  border-bottom: 1px solid rgba(226, 234, 245, 0.96);
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.98), rgba(255, 255, 255, 0.9));
}

.notification-center-header h3 {
  margin: 2px 0 0;
  font-size: 17px;
  letter-spacing: 0;
}

.notification-center-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.notification-center-actions,
.notification-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.notification-list {
  display: grid;
  gap: 10px;
  max-height: min(520px, calc(100vh - 180px));
  overflow: auto;
  padding: 12px;
}

.notification-card {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  border: 1px solid rgba(222, 231, 242, 0.96);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  padding: 11px 12px 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.notification-card.is-unread {
  border-color: rgba(47, 111, 214, 0.28);
  background: linear-gradient(180deg, #f8fbff, #ffffff);
  box-shadow: 0 8px 18px rgba(47, 111, 214, 0.08);
}

.notification-card-indicator {
  width: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.36);
}

.notification-card.is-unread .notification-card-indicator {
  background: #2f6fd6;
}

.notification-card-main {
  min-width: 0;
}

.notification-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.notification-card-meta span,
.notification-card-meta time {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.notification-card strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
}

.notification-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.38;
}

.notification-card-actions {
  justify-content: flex-start;
  margin-top: 10px;
}

body[data-theme="dark"] .notification-center {
  border-color: rgba(188, 205, 230, 0.18);
  background: rgba(11, 21, 38, 0.96);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

body[data-theme="dark"] .notification-center-header,
body[data-theme="dark"] .notification-card {
  border-color: rgba(188, 205, 230, 0.18);
}

body[data-theme="dark"] .notification-card {
  background: rgba(17, 31, 53, 0.96);
}

body[data-theme="dark"] .notification-card.is-unread {
  background: rgba(28, 55, 93, 0.96);
}

body[data-theme="dark"] .notification-card strong {
  color: #e9f1ff;
}

body[data-theme="dark"] .notification-center-header {
  background: linear-gradient(180deg, rgba(17, 31, 53, 0.98), rgba(11, 21, 38, 0.9));
}


/* Let native and web mail actions use two stable rows when the reader column is
   tight, so wrapped controls stay inside the white sticky action surface. */
@media (min-width: 761px) {
  body[data-view="mail"] .mail-reader-actions,
  body.native-shell[data-view="mail"] .mail-reader-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    align-content: flex-start !important;
    height: auto !important;
    min-height: 52px !important;
    max-height: none !important;
    padding-block: 8px !important;
    overflow: visible !important;
    background: rgba(248, 250, 251, 0.98) !important;
  }

  body[data-view="mail"] .mail-reader-actions > .mail-toolbar-group,
  body.native-shell[data-view="mail"] .mail-reader-actions > .mail-toolbar-group,
  body[data-view="mail"] .mail-reader-actions > .mail-toolbar-group:first-of-type,
  body.native-shell[data-view="mail"] .mail-reader-actions > .mail-toolbar-group:first-of-type,
  body[data-view="mail"] .mail-reader-actions > .mail-toolbar-group:last-of-type,
  body.native-shell[data-view="mail"] .mail-reader-actions > .mail-toolbar-group:last-of-type {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    align-content: center !important;
    min-width: 0 !important;
    overflow: visible !important;
  }

  body[data-view="mail"] .mail-reader-actions > .mail-toolbar-primary-actions,
  body.native-shell[data-view="mail"] .mail-reader-actions > .mail-toolbar-primary-actions {
    flex: 1 1 min(100%, 720px) !important;
    justify-content: center !important;
  }

  body[data-view="mail"] .mail-reader-actions > .mail-toolbar-secondary-actions,
  body.native-shell[data-view="mail"] .mail-reader-actions > .mail-toolbar-secondary-actions {
    flex: 0 1 auto !important;
    justify-content: center !important;
  }

  body[data-view="mail"] .mail-reader-actions > .mail-toolbar-secondary-actions:has(.mail-more-actions:nth-child(1):last-child),
  body.native-shell[data-view="mail"] .mail-reader-actions > .mail-toolbar-secondary-actions:has(.mail-more-actions:nth-child(1):last-child) {
    flex-basis: 100% !important;
  }
}

@media (max-width: 760px) {
  body[data-view="mail"] .mail-workspace {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body[data-view="mail"] .mail-pane-resizer {
    display: none !important;
  }
}


body[data-theme="dark"] .top-actions .openai-status-alert {
  border-color: rgba(245, 188, 91, 0.36) !important;
  background: rgba(74, 46, 12, 0.72) !important;
  color: #ffd797 !important;
}

body[data-theme="dark"] .top-actions .top-status-button {
  border-color: rgba(188, 205, 230, 0.22) !important;
  background: rgba(17, 31, 52, 0.92) !important;
  color: #e8f0ff !important;
  box-shadow: none !important;
}

body[data-theme="dark"] .top-actions .top-status-button:hover,
body[data-theme="dark"] .top-actions .top-status-button[aria-expanded="true"] {
  border-color: rgba(114, 169, 255, 0.34) !important;
  background: rgba(25, 45, 76, 0.98) !important;
}

body[data-theme="dark"] .top-actions .top-status-count {
  background: rgba(145, 184, 255, 0.18) !important;
  color: #f8fbff !important;
}

body[data-theme="dark"] .top-actions .has-pending .top-status-count,
body[data-theme="dark"] .top-actions .has-unread .top-status-count {
  background: #3f73d8 !important;
  color: #fff !important;
}


body[data-theme="dark"] .top-actions .diagnostics-top-button.has-errors {
  border-color: rgba(248, 113, 113, 0.36) !important;
  background: rgba(74, 25, 30, 0.72) !important;
  color: #fecaca !important;
}


body[data-theme="dark"] .workflow-evidence-chip,
body[data-theme="dark"] .workflow-evidence-more summary,
body.native-shell[data-theme="dark"] .workflow-evidence-chip,
body.native-shell[data-theme="dark"] .workflow-evidence-more summary {
  border-color: rgba(188, 205, 230, 0.18) !important;
  background: rgba(8, 17, 31, 0.66) !important;
  color: #dbe8fb !important;
  box-shadow: none !important;
}

body[data-theme="dark"] .workflow-evidence-chip em,
body.native-shell[data-theme="dark"] .workflow-evidence-chip em {
  border-right-color: rgba(188, 205, 230, 0.14) !important;
  color: #91a5c4 !important;
}

body[data-theme="dark"] .workflow-evidence-chip strong,
body.native-shell[data-theme="dark"] .workflow-evidence-chip strong {
  color: #f8fbff !important;
}


/* Final desktop mail toolbar layout guard: when action controls wrap, keep the
   second row inside the sticky white toolbar instead of floating over message
   content. */
@media (min-width: 761px) {
  body[data-view="mail"] .mail-reader-actions,
  body.native-shell[data-view="mail"] .mail-reader-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: stretch !important;
    justify-content: center !important;
    align-content: flex-start !important;
    height: auto !important;
    min-height: 52px !important;
    max-height: none !important;
    overflow: visible !important;
    padding-block: 8px !important;
    background: rgba(248, 250, 251, 0.98) !important;
  }

  body[data-view="mail"] .mail-reader-actions > .mail-toolbar-group,
  body[data-view="mail"] .mail-reader-actions > .mail-toolbar-primary-actions,
  body[data-view="mail"] .mail-reader-actions > .mail-toolbar-secondary-actions,
  body.native-shell[data-view="mail"] .mail-reader-actions > .mail-toolbar-group,
  body.native-shell[data-view="mail"] .mail-reader-actions > .mail-toolbar-primary-actions,
  body.native-shell[data-view="mail"] .mail-reader-actions > .mail-toolbar-secondary-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    min-width: 0 !important;
    overflow: visible !important;
  }

  body[data-view="mail"] .mail-reader-actions > .mail-toolbar-group:first-of-type,
  body[data-view="mail"] .mail-reader-actions > .mail-toolbar-group:last-of-type,
  body.native-shell[data-view="mail"] .mail-reader-actions > .mail-toolbar-group:first-of-type,
  body.native-shell[data-view="mail"] .mail-reader-actions > .mail-toolbar-group:last-of-type {
    flex: 0 0 auto !important;
    justify-content: flex-start !important;
  }

  body[data-view="mail"] .mail-reader-actions > .mail-toolbar-primary-actions,
  body.native-shell[data-view="mail"] .mail-reader-actions > .mail-toolbar-primary-actions {
    flex: 1 1 min(100%, 720px) !important;
  }

  body[data-view="mail"] .mail-reader-actions > .mail-toolbar-secondary-actions,
  body.native-shell[data-view="mail"] .mail-reader-actions > .mail-toolbar-secondary-actions {
    flex: 0 1 auto !important;
  }

  body[data-view="mail"] .mail-reader-actions > .mail-toolbar-secondary-actions:has(.mail-more-actions:nth-child(1):last-child),
  body.native-shell[data-view="mail"] .mail-reader-actions > .mail-toolbar-secondary-actions:has(.mail-more-actions:nth-child(1):last-child) {
    flex-basis: 100% !important;
  }
}

/* Final desktop mail toolbar override: this must stay after the desktop wrap
   guard above. The reader column can be narrow even when the viewport is wide,
   so wrap inside the sticky bar instead of spilling over the message list. */
@media (min-width: 761px) {
  body[data-view="mail"] .mail-reader-actions,
  body.native-shell[data-view="mail"] .mail-reader-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: center !important;
    align-content: center !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 54px !important;
    height: auto !important;
    max-height: none !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    padding-block: 9px !important;
    scrollbar-width: none !important;
  }

  body[data-view="mail"] .mail-reader-actions::-webkit-scrollbar,
  body.native-shell[data-view="mail"] .mail-reader-actions::-webkit-scrollbar {
    display: none !important;
  }

  body[data-view="mail"] .mail-reader-actions > .mail-toolbar-primary-actions,
  body[data-view="mail"] .mail-reader-actions > .mail-toolbar-secondary-actions,
  body.native-shell[data-view="mail"] .mail-reader-actions > .mail-toolbar-primary-actions,
  body.native-shell[data-view="mail"] .mail-reader-actions > .mail-toolbar-secondary-actions {
    display: flex !important;
    flex: 1 1 100% !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 0 !important;
    overflow: visible !important;
  }

  body[data-view="mail"] .mail-reader-actions > .mail-toolbar-secondary-actions,
  body.native-shell[data-view="mail"] .mail-reader-actions > .mail-toolbar-secondary-actions {
    flex: 0 1 auto !important;
  }

  body[data-view="mail"] .mail-reader-actions .mail-toolbar-button,
  body[data-view="mail"] .mail-reader-actions .mail-more-actions > summary,
  body.native-shell[data-view="mail"] .mail-reader-actions .mail-toolbar-button,
  body.native-shell[data-view="mail"] .mail-reader-actions .mail-more-actions > summary {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 34px !important;
    max-width: none !important;
    white-space: nowrap !important;
  }

  body[data-view="mail"] .mail-reader-actions .mail-toolbar-button:not(.icon),
  body.native-shell[data-view="mail"] .mail-reader-actions .mail-toolbar-button:not(.icon) {
    max-width: 132px !important;
  }

  body[data-view="mail"] .mail-reader-actions .mail-toolbar-button:not(.icon) .mail-toolbar-label,
  body.native-shell[data-view="mail"] .mail-reader-actions .mail-toolbar-button:not(.icon) .mail-toolbar-label {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  body[data-view="mail"] .mail-reader-actions .mail-toolbar-secondary-actions,
  body.native-shell[data-view="mail"] .mail-reader-actions .mail-toolbar-secondary-actions {
    gap: 6px !important;
    max-width: 100% !important;
  }

  body[data-view="mail"] .mail-message-header,
  body.native-shell[data-view="mail"] .mail-message-header {
    margin-top: 8px !important;
  }
}

@media (min-width: 761px) {
  body[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions {
    position: static !important;
    top: auto !important;
    z-index: 1 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    justify-items: center !important;
    margin: 0 0 18px !important;
    padding: 10px 8px 12px !important;
    background: #ffffff !important;
    box-shadow: none !important;
  }

  body[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions > .mail-toolbar-primary-actions,
  body[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions > .mail-toolbar-secondary-actions,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions > .mail-toolbar-primary-actions,
body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions > .mail-toolbar-secondary-actions {
    flex: 0 1 auto !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  body[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions .mail-toolbar-button,
  body[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions .mail-more-actions > summary,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions .mail-toolbar-button,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions .mail-more-actions > summary {
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    min-height: 34px !important;
    padding-inline: 0 !important;
  }

  body[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions .mail-toolbar-button.primary,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions .mail-toolbar-button.primary {
    width: 46px !important;
    min-width: 46px !important;
    max-width: 46px !important;
  }

  body[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions .mail-toolbar-label,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions .mail-toolbar-label {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
  }

  body[data-view="mail"].mail-reader-narrow-actions .mail-message-header,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-message-header {
    margin-top: 0 !important;
    padding-top: 20px !important;
  }
}

.brand.suite-brand-selector-wrap { display:block; width:100%; padding:0; }
.suite-brand-selector-wrap > .sidebar-toggle { display:none; }

/* Suite switcher pattern 3: app identity and selector share the sidebar's
   permanent top-left brand slot. */
.suite-brand-selector-wrap {
  position: relative;
  display: block;
}
.suite-brand-selector { position: relative; width: 100%; }
.suite-brand-selector > summary {
  display: grid; grid-template-columns: 36px 38px minmax(0,1fr) 16px;
  align-items: center; gap: 8px; min-height: 62px; padding: 7px;
  border: 1px solid rgba(142,166,197,.26); border-radius: 12px;
  background: rgba(255,255,255,.06); color: #fff; cursor: pointer; list-style: none;
}
.suite-brand-selector > summary::-webkit-details-marker { display:none; }
.suite-brand-selector > summary > img { width:38px; height:38px; border-radius:9px; }
.suite-brand-waffle { display:grid; grid-template-columns:repeat(3,4px); gap:4px; place-content:center; width:36px; height:36px; border-radius:9px; background:rgba(93,143,202,.2); }
.suite-brand-waffle i { display:block; width:4px; height:4px; border-radius:50%; background:#f5f9ff; }
/* The legacy .brand span rule is more specific and otherwise turns this grid
   into a single vertical stack of dots. Keep the launcher a fixed 3-by-3. */
.brand .suite-brand-waffle { display:grid; grid-template-columns:repeat(3,4px); grid-template-rows:repeat(3,4px); width:36px; min-width:36px; height:36px; margin:0; gap:4px; place-content:center; }
.suite-brand-copy { min-width:0; display:grid; gap:3px; }
.suite-brand-copy strong,.suite-brand-copy small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.suite-brand-copy strong { font-size:13px; }
.suite-brand-copy small { color:#9eafc4; font-size:10px; }
.suite-brand-chevron { color:#9eafc4; }
.suite-brand-menu { position:fixed; z-index:260; top:98px; left:24px; width:min(430px,calc(100vw - 28px)); overflow:hidden; border:1px solid #d3deea; border-radius:14px; background:#fff; color:#182840; box-shadow:0 25px 65px rgba(7,19,37,.29); }
.suite-brand-menu header { display:flex; justify-content:space-between; gap:12px; padding:16px 17px 12px; border-bottom:1px solid #e3eaf2; }
.suite-brand-menu header small { color:#6c7b91; }
.suite-brand-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:5px; padding:12px; }
.suite-brand-grid button,.suite-brand-grid a { display:grid; place-items:center; align-content:center; min-height:100px; padding:8px 4px; border:1px solid transparent; border-radius:10px; background:transparent; color:#182840; text-align:center; text-decoration:none; }
.suite-brand-menu [data-suite-app][hidden] { display:none !important; }

/* React tab previews keep the classic shell available for rollback, but the
   visible chrome should still read as modern while React owns the page body. */
body.react-tab-preview-active .topbar {
  align-items: center;
  min-height: 64px;
  padding: 12px 14px;
  border: 1px solid rgba(196, 211, 232, 0.86);
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(246, 250, 255, 0.9)),
    radial-gradient(circle at top right, rgba(47, 111, 214, 0.12), transparent 34%);
  box-shadow: 0 16px 42px rgba(12, 26, 45, 0.08);
  backdrop-filter: blur(18px);
}

body.react-tab-preview-active .topbar h1 {
  font-size: 24px;
  letter-spacing: -0.035em;
}

body.react-tab-preview-active .topbar .eyebrow {
  color: #2f6fd6;
  font-weight: 850;
}

body.react-tab-preview-active .topbar .ghost-button,
body.react-tab-preview-active .topbar .primary-button {
  min-height: 40px;
  border-radius: 13px;
  font-weight: 850;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}
.suite-brand-grid button:hover,.suite-brand-grid button:focus-visible,.suite-brand-grid button.is-current,.suite-brand-grid a:hover,.suite-brand-grid a:focus-visible,.suite-brand-grid a.is-current { border-color:#cbdcf5; background:#eef4ff; }
.suite-brand-grid img { width:42px; height:42px; margin-bottom:7px; border-radius:10px; }
.suite-brand-grid strong,.suite-brand-grid small { display:block; }
.suite-brand-grid strong { font-size:12px; }
.suite-brand-grid small { margin-top:3px; color:#738197; font-size:9px; }
.suite-brand-utility { display:grid; grid-template-columns:38px minmax(0,1fr) auto; align-items:center; gap:11px; margin:0 12px 12px; padding:11px 12px; border-top:1px solid #e3eaf2; border-radius:9px; color:#182840; text-decoration:none; }
.suite-brand-utility:hover,.suite-brand-utility:focus-visible { background:#eef4ff; }
.suite-brand-utility img { width:38px; height:38px; border-radius:9px; }
.suite-brand-utility span,.suite-brand-utility strong,.suite-brand-utility small { display:block; min-width:0; }
.suite-brand-utility small { margin-top:2px; color:#738197; font-size:10px; }
.suite-brand-utility b { color:#6c7b91; font-size:18px; }
body.sidebar-collapsed .suite-brand-selector > summary { grid-template-columns:42px; justify-content:center; padding:5px; }
body.sidebar-collapsed .suite-brand-waffle, body.sidebar-collapsed .suite-brand-copy, body.sidebar-collapsed .suite-brand-chevron { display:none; }
body.sidebar-collapsed .suite-brand-selector > summary > img { width:42px; height:42px; }
body.sidebar-collapsed .suite-brand-menu { left:92px; top:18px; }
@media (min-width:761px) and (max-width:1280px) {
  body.nav-layout-sidebar .suite-brand-selector > summary { grid-template-columns:42px; justify-content:center; padding:5px; }
  body.nav-layout-sidebar .suite-brand-waffle, body.nav-layout-sidebar .suite-brand-copy, body.nav-layout-sidebar .suite-brand-chevron { display:none; }
  body.nav-layout-sidebar .suite-brand-menu { left:92px; top:18px; }
}
@media (max-width:760px) {
  .suite-brand-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .suite-brand-menu { position:fixed; top:84px; left:14px; }
}

/* Final compact action alignment: compact mode starts only once the actual
   reader pane is tight, and the combined button cluster is centered. */
@media (min-width: 761px) {
  body[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions {
    width: 100% !important;
    box-sizing: border-box !important;
    justify-content: center !important;
    gap: 6px !important;
    margin-inline: 0 !important;
    padding-inline: 16px !important;
  }

  body[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions > .mail-toolbar-primary-actions,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions > .mail-toolbar-primary-actions {
    margin-left: auto !important;
  }

  body[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions > .mail-toolbar-secondary-actions,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions > .mail-toolbar-secondary-actions {
    margin-right: auto !important;
  }
}

/* Final action-row stability pass: no middle wrap state. Full mode is one
   centered row; compact mode starts before labels can crowd and is centered. */
@media (min-width: 761px) {
  body[data-view="mail"]:not(.mail-reader-narrow-actions) .mail-reader-actions,
  body.native-shell[data-view="mail"]:not(.mail-reader-narrow-actions) .mail-reader-actions {
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    align-items: center !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    max-height: 60px !important;
    scrollbar-width: none !important;
  }

  body[data-view="mail"]:not(.mail-reader-narrow-actions) .mail-reader-actions > .mail-toolbar-primary-actions,
  body[data-view="mail"]:not(.mail-reader-narrow-actions) .mail-reader-actions > .mail-toolbar-secondary-actions,
  body.native-shell[data-view="mail"]:not(.mail-reader-narrow-actions) .mail-reader-actions > .mail-toolbar-primary-actions,
  body.native-shell[data-view="mail"]:not(.mail-reader-narrow-actions) .mail-reader-actions > .mail-toolbar-secondary-actions {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    width: auto !important;
    max-width: none !important;
  }

  body[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions {
    justify-content: center !important;
    padding-inline: 16px !important;
    margin-inline: 0 !important;
  }

  body[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions > .mail-toolbar-primary-actions,
  body[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions > .mail-toolbar-secondary-actions,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions > .mail-toolbar-primary-actions,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions > .mail-toolbar-secondary-actions {
    justify-content: center !important;
  }
}

/* Narrow topbar mail mode: the full folder/list/reader grid cannot fit in a
   browser-width window. Keep the list plus reader, and remove the folder pane
   before the reader gets squeezed into a tiny column. */
@media (min-width: 761px) and (max-width: 980px) {
  body.nav-layout-topbar[data-view="mail"] .mail-workspace {
    grid-template-columns: minmax(260px, 34vw) minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  body.nav-layout-topbar[data-view="mail"] .mail-folder-rail,
  body.nav-layout-topbar[data-view="mail"] .mail-pane-resizer {
    display: none !important;
  }

  body.nav-layout-topbar[data-view="mail"] .mail-workspace .mail-table {
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  body.nav-layout-topbar[data-view="mail"] .mail-reader {
    grid-column: 2 !important;
    grid-row: 1 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    padding-inline: clamp(14px, 2.5vw, 22px) !important;
    overflow-x: hidden !important;
  }

  body.nav-layout-topbar[data-view="mail"] .mail-reader-actions {
    box-sizing: border-box !important;
    width: 100% !important;
    margin-inline: 0 !important;
    padding-inline: 8px !important;
    gap: 6px !important;
    row-gap: 6px !important;
  }

  body.nav-layout-topbar[data-view="mail"] .mail-reader-actions > .mail-toolbar-group,
  body.nav-layout-topbar[data-view="mail"] .mail-reader-actions > .mail-toolbar-primary-actions,
  body.nav-layout-topbar[data-view="mail"] .mail-reader-actions > .mail-toolbar-secondary-actions {
    flex: 0 1 auto !important;
    gap: 6px !important;
  }

  body.nav-layout-topbar[data-view="mail"] .mail-reader-actions .mail-toolbar-button:not(.primary):not(.icon),
  body.nav-layout-topbar[data-view="mail"] .mail-reader-actions .mail-toolbar-button.primary,
  body.nav-layout-topbar[data-view="mail"] .mail-reader-actions .mail-more-actions > summary {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    padding-inline: 0 !important;
  }

  body.nav-layout-topbar[data-view="mail"] .mail-reader-actions .mail-toolbar-label {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
  }

  body.nav-layout-topbar[data-view="mail"] .mail-message-header {
    grid-template-columns: 48px minmax(0, 1fr) !important;
    gap: 12px !important;
  }

  body.nav-layout-topbar[data-view="mail"] .mail-message-side {
    grid-column: 1 / -1 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    text-align: left !important;
  }

  body.nav-layout-topbar[data-view="mail"] .mail-reader-actions,
  body.nav-layout-topbar[data-view="mail"] .mail-message-header,
  body.nav-layout-topbar[data-view="mail"] .message-body-card,
  body.nav-layout-topbar[data-view="mail"] .quick-summary-card,
  body.nav-layout-topbar[data-view="mail"] .suggested-playbook-card,
  body.nav-layout-topbar[data-view="mail"] .mail-compact-details {
    min-width: 0 !important;
    max-width: 100% !important;
  }
}

/* RepCloud app icon rollout. Keep this at the end so older brand blocks do not stretch square icons. */
.boot-splash-card img.workspace-app-icon {
  width: 58px;
  height: 58px;
  display: block;
  margin-bottom: 16px;
  border-radius: 14px;
  object-fit: contain;
  box-shadow: 0 14px 30px rgba(20, 63, 126, 0.16);
}

.login-card img.login-app-icon {
  display: block;
  width: 58px;
  height: 58px;
  margin-bottom: 16px;
  padding: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  object-fit: contain;
  box-shadow: 0 14px 30px rgba(20, 63, 126, 0.14);
}

.brand {
  grid-template-columns: 48px minmax(0, 1fr) auto;
  grid-template-rows: auto;
  align-items: center;
  gap: 10px;
  padding-right: 0;
}

.brand-mark {
  grid-column: 1;
  grid-row: 1;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 0 0 1px rgba(135, 202, 255, 0.2),
    0 12px 26px rgba(0, 0, 0, 0.18);
}

.brand-mark img.workspace-app-icon {
  width: 36px;
  height: 36px;
  margin: auto;
  border-radius: 10px;
  object-fit: contain;
}

.brand > div:not(.brand-mark) {
  grid-column: 2;
  grid-row: 1;
}

.sidebar-toggle {
  position: static;
  grid-column: 3;
  grid-row: 1;
}

.topnav-brand img.workspace-app-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.suite-switcher {
  position: relative;
  flex: 0 0 auto;
}

.suite-switcher summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px 0 8px;
  border: 1px solid rgba(203, 215, 232, 0.86);
  border-radius: 12px;
  background: #ffffff;
  color: #172338;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

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

.suite-switcher summary::after {
  content: "⌄";
  color: #617086;
  font-size: 14px;
  line-height: 1;
}

.suite-switcher summary img {
  width: 24px;
  height: 24px;
  border-radius: 7px;
}

.suite-switcher[open] summary,
.suite-switcher summary:hover {
  border-color: rgba(54, 107, 214, 0.48);
  box-shadow: 0 10px 24px rgba(42, 85, 150, 0.12);
}

.suite-switcher-menu {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 50;
  display: grid;
  gap: 6px;
  width: 284px;
  padding: 10px;
  border: 1px solid rgba(193, 207, 227, 0.92);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 20px 46px rgba(15, 32, 58, 0.18);
}

.suite-switcher .suite-switcher-button {
  display: grid !important;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 54px;
  width: 100%;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #172338;
  text-align: left;
}

.suite-switcher .suite-switcher-button:hover,
.suite-switcher .suite-switcher-button.active {
  border-color: rgba(54, 107, 214, 0.2);
  background: #eef5ff;
}


.suite-switcher-button img {
  width: 36px;
  height: 36px;
  border-radius: 9px;
}

.suite-switcher-button strong,
.suite-switcher-button small {
  display: block;
}

.suite-switcher-button strong {
  font-size: 13px;
}

.suite-switcher-button small {
  margin-top: 2px;
  color: #617086;
  font-size: 11px;
  font-weight: 800;
}

body[data-theme="dark"] .suite-switcher summary,
body[data-theme="dark"] .suite-switcher-menu {
  border-color: rgba(148, 163, 184, 0.22);
  background: #101827;
  color: #f4f8ff;
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.32);
}

body[data-theme="dark"] .suite-switcher summary::after,
body[data-theme="dark"] .suite-switcher-button small {
  color: #a8b4c7;
}

body[data-theme="dark"] .suite-switcher .suite-switcher-button {
  color: #f4f8ff;
}

body[data-theme="dark"] .suite-switcher .suite-switcher-button:hover,
body[data-theme="dark"] .suite-switcher .suite-switcher-button.active {
  background: #18345d;
}

/* Global suite chrome is a dedicated rail, like the desktop shell. It owns
   layout space and therefore never covers an embedded app's own navigation. */
.suite-rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 240;
  display: flex;
  width: 58px;
  padding: 10px 7px;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  border-right: 1px solid rgba(124, 158, 201, 0.28);
  background: linear-gradient(180deg, #101b30 0%, #091426 100%);
  box-shadow: 8px 0 24px rgba(15, 30, 54, 0.12);
}

body.booting .suite-rail,
body.auth-required .suite-rail {
  display: none;
}

.app-shell {
  width: calc(100% - 58px);
  margin-left: 58px;
}

.suite-rail .suite-switcher {
  width: 44px;
}

.suite-rail .suite-switcher > summary {
  display: grid;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  place-items: center;
  border-color: rgba(142, 190, 237, 0.35);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.suite-rail .suite-switcher > summary::after {
  content: none;
}

.suite-launcher-grid {
  display: grid;
  grid-template-columns: repeat(3, 4px);
  gap: 3px;
}

.suite-launcher-grid i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #eef7ff;
}

.suite-rail .suite-switcher-menu {
  top: 0;
  right: auto;
  left: 51px;
  width: 300px;
}

.suite-rail-divider {
  width: 30px;
  height: 1px;
  margin: 2px 0 3px;
  background: rgba(164, 195, 229, 0.25);
}

.suite-rail-app {
  position: relative;
  display: grid;
  width: 44px;
  height: 44px;
  padding: 7px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
}

.suite-rail-app img {
  width: 30px;
  height: 30px;
  border-radius: 9px;
}

.suite-rail-app:hover,
.suite-rail-app.active {
  border-color: rgba(146, 197, 243, 0.34);
  background: rgba(255, 255, 255, 0.12);
}

.suite-rail-app.active::before {
  content: "";
  position: absolute;
  left: -7px;
  width: 3px;
  height: 24px;
  border-radius: 0 3px 3px 0;
  background: #57b9ff;
}

.suite-switcher-heading {
  display: grid;
  gap: 2px;
  margin-bottom: 2px;
  padding: 7px 8px 10px;
  border-bottom: 1px solid rgba(193, 207, 227, 0.72);
}

.suite-switcher-heading strong {
  color: #172338;
  font-size: 15px;
}

.suite-switcher-heading small {
  color: #617086;
  font-size: 11px;
  font-weight: 750;
}

body[data-theme="dark"] .suite-switcher-heading {
  border-color: rgba(148, 163, 184, 0.2);
}

body[data-theme="dark"] .suite-switcher-heading strong {
  color: #f4f8ff;
}

body[data-theme="dark"] .suite-switcher-heading small {
  color: #a8b4c7;
}

/* A collapsed Workspace rail must always expose its way back open. */
body.sidebar-collapsed .sidebar-toggle {
  position: absolute !important;
  top: 18px;
  right: -27px;
  z-index: 12;
  display: inline-grid !important;
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(173, 194, 222, 0.42);
  border-radius: 9px;
  background: #142139;
  color: #f4f8ff;
  transform: rotate(180deg);
}

html.nav-layout-topbar body.sidebar-collapsed .sidebar-toggle,
body.nav-layout-topbar.sidebar-collapsed .sidebar-toggle {
  display: none !important;
}

/* Embedded apps own their internal navigation. Remove every Workspace layout
   column/header around them while retaining the fixed global app launcher. */
html.embedded-app-view .app-shell,
html.embedded-app-view body.nav-layout-sidebar .app-shell,
html.embedded-app-view body.nav-layout-topbar .app-shell {
  display: block !important;
  grid-template-columns: none !important;
  grid-template-rows: none !important;
  width: calc(100% - 58px) !important;
  margin-left: 58px !important;
  min-height: 100vh !important;
}

html.embedded-app-view .sidebar,
html.embedded-app-view .mobile-nav-backdrop {
  display: none !important;
}

html.embedded-app-view .workspace {
  display: block !important;
  width: 100% !important;
  height: 100vh !important;
  min-height: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

html.embedded-app-view .topbar {
  position: fixed !important;
  inset: 0 !important;
  z-index: 210;
  display: block !important;
  width: 0 !important;
  height: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  pointer-events: none;
}

html.embedded-app-view .topbar > * {
  display: none !important;
}

.suite-rail,
.suite-rail * {
  pointer-events: auto;
}

html.embedded-app-view .content-grid,
html.embedded-app-view .main-column,
html.embedded-app-view #view-crm.view.active,
html.embedded-app-view #view-publisher.view.active,
html.embedded-app-view .crm-embed,
html.embedded-app-view .crm-embed-page,
html.embedded-app-view .crm-embed-shell,
html.embedded-app-view .publisher-embed,
html.embedded-app-view .publisher-embed-page,
html.embedded-app-view .publisher-embed-shell {
  width: 100% !important;
  height: 100vh !important;
  min-height: 0 !important;
  margin: 0 !important;
}

/* CRM and Publisher already provide their own app-specific navigation inside
   the frame. Keep the Workspace header/app switcher, but never show a second
   outer navigation rail beside the embedded app. */
body[data-view="crm"] .app-shell,
body[data-view="publisher"] .app-shell {
  grid-template-columns: minmax(0, 1fr) !important;
}

body[data-view="crm"] .sidebar,
body[data-view="publisher"] .sidebar,
body[data-view="crm"] .mobile-nav-backdrop,
body[data-view="publisher"] .mobile-nav-backdrop {
  display: none !important;
}

/* Desktop parity: one compact suite header, one launcher button, and a
   temporary app popover. App navigation never becomes a second sidebar. */
.suite-header {
  position: relative;
  z-index: 240;
  display: flex;
  width: 100%;
  height: 50px;
  padding: 7px 14px;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(181, 199, 223, 0.72);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 3px 12px rgba(17, 35, 62, 0.06);
}

body.booting .suite-header,
body.auth-required .suite-header {
  display: none;
}

.suite-header + .app-shell,
html.embedded-app-view .suite-header + .app-shell,
html.embedded-app-view body.nav-layout-sidebar .suite-header + .app-shell,
html.embedded-app-view body.nav-layout-topbar .suite-header + .app-shell {
  width: 100% !important;
  height: calc(100vh - 50px) !important;
  min-height: calc(100vh - 50px) !important;
  margin-left: 0 !important;
}

/* Parent-owned escape navigation for embedded suite apps. It occupies its own
   row, so the iframe can never cover the route back to Workspace. */
html.embedded-app-view .crm-embed-page,
html.embedded-app-view .publisher-embed-page {
  display: grid !important;
  grid-template-rows: minmax(0, 1fr) !important;
  height: 100vh !important;
  overflow: hidden !important;
}

html.embedded-app-view .crm-embed-shell,
html.embedded-app-view .publisher-embed-shell {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
}

.embedded-app-navigation {
  position: relative;
  z-index: 230;
  display: flex;
  height: 48px;
  padding: 6px 12px;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #d7e0eb;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(15, 32, 58, 0.07);
}

.embedded-app-switcher {
  position: relative;
}

.embedded-app-switcher > summary {
  display: inline-flex;
  min-height: 36px;
  padding: 0 11px;
  align-items: center;
  gap: 8px;
  border: 1px solid #ccd7e5;
  border-radius: 8px;
  background: #f7f9fc;
  color: #172338;
  cursor: pointer;
  list-style: none;
}

.embedded-app-switcher > summary::-webkit-details-marker {
  display: none;
}

.embedded-app-waffle {
  color: #246aca;
  font-size: 20px;
  line-height: 1;
}

.embedded-app-switcher-menu {
  position: absolute;
  top: 42px;
  left: 0;
  width: min(420px, calc(100vw - 24px));
  padding: 14px;
  border: 1px solid #d2dce8;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 18px 42px rgba(15, 32, 58, 0.2);
}

.embedded-app-switcher-title {
  margin: 0 0 10px 2px;
  color: #617086;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.embedded-app-switcher-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.embedded-app-switcher-grid button {
  display: grid;
  min-height: 104px;
  padding: 12px 8px 10px;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #172338;
  font-weight: 750;
  text-align: center;
}

.embedded-app-switcher-grid button img {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 11px;
}

.embedded-app-switcher-grid button:hover,
.embedded-app-switcher-grid button:focus-visible {
  border-color: #cbdcf5;
  background: #eef5ff;
}

.embedded-app-current {
  color: #617086;
  font-size: 13px;
  font-weight: 800;
}

body[data-theme="dark"] .embedded-app-navigation,
body[data-theme="dark"] .embedded-app-switcher-menu {
  border-color: #334155;
  background: #101827;
}

body[data-theme="dark"] .embedded-app-switcher > summary,
body[data-theme="dark"] .embedded-app-switcher-grid button {
  border-color: #334155;
  background: #182235;
  color: #f4f8ff;
}

@media (max-width: 520px) {
  .embedded-app-current {
    display: none;
  }

  .embedded-app-switcher-menu {
    width: min(330px, calc(100vw - 24px));
  }

  .embedded-app-switcher-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Tablet shell: use the compact navigation rail before the desktop sidebar and
   action cluster start competing with the page content. */
@media (min-width: 761px) and (max-width: 1280px) {
  html,
  body {
    min-width: 0 !important;
    overflow-x: hidden !important;
  }

  html.nav-layout-sidebar .app-shell,
  body.nav-layout-sidebar .app-shell {
    grid-template-columns: 84px minmax(0, 1fr) !important;
  }

  html.nav-layout-sidebar .sidebar,
  body.nav-layout-sidebar .sidebar {
    width: 84px !important;
    padding-inline: 10px !important;
  }

  html.nav-layout-sidebar .brand,
  body.nav-layout-sidebar .brand {
    display: grid !important;
    grid-template-columns: 42px !important;
    justify-content: center !important;
    justify-items: center !important;
  }

  body.nav-layout-sidebar .brand > div:not(.brand-mark),
  body.nav-layout-sidebar .brand-badge,
  body.nav-layout-sidebar .account-card > span:last-child,
  body.nav-layout-sidebar .nav-item span:last-child,
  body.nav-layout-sidebar .mode-badge,
  body.nav-layout-sidebar .sidebar-toggle {
    display: none !important;
  }

  body.nav-layout-sidebar .account-card,
  body.nav-layout-sidebar .nav-item {
    justify-content: center !important;
    padding-inline: 0 !important;
  }

  body.nav-layout-sidebar .account-card {
    display: grid !important;
    place-items: center !important;
  }

  .workspace,
  .topbar,
  .content-grid,
  .main-column {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .topbar {
    grid-template-columns: minmax(150px, 1fr) auto !important;
    gap: 10px !important;
  }

  .top-actions {
    min-width: 0 !important;
    gap: 6px !important;
  }

  .top-actions > .openai-status-alert,
  .top-actions > button[data-action="open-config"],
  .top-actions > button[data-action="open-log"],
  .top-actions > button[data-action="logout"],
  .top-actions > button[data-action="run-sweep"] {
    display: none !important;
  }

  .topbar h1 {
    overflow: hidden;
    font-size: clamp(22px, 2.7vw, 28px) !important;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.suite-header .suite-switcher > summary {
  display: grid;
  width: 38px;
  min-width: 38px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  place-items: center;
  border-color: rgba(42, 107, 213, 0.2);
  border-radius: 10px;
  background: rgba(42, 107, 213, 0.11);
  box-shadow: none;
}

.suite-header .suite-switcher > summary::after {
  content: none;
}

.suite-header .suite-launcher-grid i {
  background: #246aca;
}

.suite-header .suite-switcher-menu {
  top: calc(100% + 10px);
  right: auto;
  left: 0;
  grid-template-columns: repeat(2, 112px);
  width: 276px;
  padding: 18px;
  gap: 10px;
}

.suite-header .suite-switcher-heading {
  grid-column: 1 / -1;
  padding: 0 0 10px;
}

.suite-header .suite-switcher .suite-switcher-button {
  display: flex !important;
  width: 112px;
  height: 88px;
  min-height: 88px;
  padding: 10px 6px;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  text-align: center;
  border-color: rgba(23, 35, 56, 0.06);
  background: rgba(23, 35, 56, 0.035);
}

.suite-header .suite-switcher-button img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
}

.suite-header .suite-switcher-button small {
  display: none;
}

.suite-current-app {
  display: flex;
  align-items: center;
  gap: 8px;
}

.suite-current-app img {
  width: 30px;
  height: 30px;
  border-radius: 9px;
}

.suite-current-app strong,
.suite-current-app small {
  display: block;
  line-height: 1.05;
}

.suite-current-app strong {
  color: #172338;
  font-size: 14px;
}

.suite-current-app small {
  margin-top: 2px;
  color: #617086;
  font-size: 11px;
  font-weight: 750;
}

html.embedded-app-view .workspace,
html.embedded-app-view .content-grid,
html.embedded-app-view .main-column,
html.embedded-app-view #view-crm.view.active,
html.embedded-app-view #view-publisher.view.active,
html.embedded-app-view .crm-embed,
html.embedded-app-view .crm-embed-page,
html.embedded-app-view .crm-embed-shell,
html.embedded-app-view .publisher-embed,
html.embedded-app-view .publisher-embed-page,
html.embedded-app-view .publisher-embed-shell {
  height: calc(100vh - 50px) !important;
}

body[data-theme="dark"] .suite-header {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(16, 24, 39, 0.97);
}

body[data-theme="dark"] .suite-current-app strong {
  color: #f4f8ff;
}

body[data-theme="dark"] .suite-current-app small {
  color: #a8b4c7;
}

/* Final web launcher model: occupy the existing app-logo slot. The launcher
   adds no rows or columns and remains at the same coordinate for Workspace,
   CRM, and Publisher embeds. */
.suite-launcher {
  position: fixed;
  top: 18px;
  left: 50px;
  z-index: 260;
  width: 44px;
  height: 44px;
}

body.booting .suite-launcher,
body.auth-required .suite-launcher {
  display: none;
}

.suite-launcher + .app-shell,
html.embedded-app-view .suite-launcher + .app-shell,
html.embedded-app-view body.nav-layout-sidebar .suite-launcher + .app-shell,
html.embedded-app-view body.nav-layout-topbar .suite-launcher + .app-shell {
  width: 100% !important;
  height: 100vh !important;
  min-height: 100vh !important;
  margin-left: 0 !important;
}

.suite-launcher .suite-switcher,
.suite-launcher .suite-switcher > summary {
  width: 44px;
  height: 44px;
}

.suite-launcher .suite-switcher > summary {
  display: grid;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(122, 182, 235, 0.42);
  border-radius: 12px;
  background: #173052;
  box-shadow: 0 8px 20px rgba(5, 18, 37, 0.24);
}

.suite-launcher .suite-switcher > summary::after {
  content: none;
}

.suite-launcher .suite-launcher-grid i {
  background: #eff8ff;
}

.suite-launcher .suite-switcher-menu {
  top: 0;
  right: auto;
  left: 54px;
  grid-template-columns: repeat(2, 112px);
  width: 276px;
  padding: 18px;
  gap: 10px;
}

.suite-launcher .suite-switcher-heading {
  grid-column: 1 / -1;
  padding: 0 0 10px;
}

.suite-launcher .suite-switcher .suite-switcher-button {
  display: flex !important;
  width: 112px;
  height: 88px;
  min-height: 88px;
  padding: 10px 6px;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  text-align: center;
  border-color: rgba(23, 35, 56, 0.06);
  background: rgba(23, 35, 56, 0.035);
}

.suite-launcher .suite-switcher-button img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
}

.suite-launcher .suite-switcher-button small {
  display: none;
}

html.embedded-app-view .workspace,
html.embedded-app-view .content-grid,
html.embedded-app-view .main-column,
html.embedded-app-view #view-crm.view.active,
html.embedded-app-view #view-publisher.view.active,
html.embedded-app-view .crm-embed,
html.embedded-app-view .crm-embed-page,
html.embedded-app-view .crm-embed-shell,
html.embedded-app-view .publisher-embed,
html.embedded-app-view .publisher-embed-page,
html.embedded-app-view .publisher-embed-shell {
  height: 100vh !important;
}

/* Launcher temporarily removed: preserve each application's native geometry. */
.app-shell,
html.embedded-app-view .app-shell,
html.embedded-app-view body.nav-layout-sidebar .app-shell,
html.embedded-app-view body.nav-layout-topbar .app-shell {
  width: 100% !important;
  height: 100vh !important;
  min-height: 100vh !important;
  margin-left: 0 !important;
}

/* Workspace identity pass: keep the square app icon centered in collapsed nav and
   carry the same teal/blue mark into the Today banner. */
body.sidebar-collapsed .brand {
  width: 100%;
  justify-items: center;
  justify-content: center;
}

body.sidebar-collapsed .brand-mark {
  width: 42px;
  height: 42px;
  margin: 0 auto;
  border-radius: 10px;
  overflow: visible;
}

body.sidebar-collapsed .brand-mark img,
body.sidebar-collapsed .brand-mark img.workspace-app-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: contain;
}

.dashboard-hero {
  position: relative;
  isolation: isolate;
  border-color: rgba(93, 156, 190, 0.36);
  background:
    radial-gradient(circle at 86% 24%, rgba(126, 214, 224, 0.28), transparent 28%),
    linear-gradient(150deg, rgba(255, 255, 255, 0.12) 0 12%, transparent 12% 100%),
    linear-gradient(26deg, transparent 0 52%, rgba(73, 151, 183, 0.3) 52% 62%, transparent 62% 100%),
    linear-gradient(135deg, #07111f 0%, #133f62 52%, #2e829f 100%);
}

.dashboard-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(115deg, transparent 0 42%, rgba(255, 255, 255, 0.08) 42% 48%, transparent 48% 100%),
    linear-gradient(18deg, transparent 0 68%, rgba(255, 255, 255, 0.1) 68% 73%, transparent 73% 100%);
  pointer-events: none;
}

.dashboard-hero-icon {
  position: absolute;
  right: 28px;
  top: 22px;
  width: 70px;
  height: 70px;
  border-radius: 18px;
  opacity: 0.18;
  filter: drop-shadow(0 16px 32px rgba(0, 0, 0, 0.18));
  pointer-events: none;
}

body[data-theme="dark"][data-view="today"] .dashboard-hero {
  border-color: rgba(116, 207, 220, 0.22);
  background:
    radial-gradient(circle at 86% 24%, rgba(126, 214, 224, 0.22), transparent 28%),
    linear-gradient(150deg, rgba(255, 255, 255, 0.09) 0 12%, transparent 12% 100%),
    linear-gradient(26deg, transparent 0 52%, rgba(73, 151, 183, 0.22) 52% 62%, transparent 62% 100%),
    linear-gradient(135deg, #050d18 0%, #0f314f 52%, #236b86 100%);
}

/* RepCloud suite shell standard: shared app lockup and profile card sizing. */
.brand {
  grid-template-columns: 42px minmax(0, 1fr) auto;
  grid-template-rows: auto;
  align-items: center;
  gap: 10px;
  padding-right: 0;
}

.brand-mark {
  grid-column: 1;
  grid-row: 1;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

.brand-mark img,
.brand-mark img.workspace-app-icon {
  display: block;
  width: 42px;
  height: 42px;
  margin: 0;
  border-radius: 8px;
  object-fit: contain;
}

body.sidebar-collapsed .brand {
  display: grid;
  grid-template-columns: 42px;
  grid-template-rows: 42px;
  justify-content: center;
  justify-items: center;
  width: 100%;
  gap: 0;
  padding: 0;
}

body.sidebar-collapsed .brand-mark {
  grid-column: 1;
  grid-row: 1;
  width: 42px;
  height: 42px;
  margin: 0;
}

body.sidebar-collapsed .brand-mark img,
body.sidebar-collapsed .brand-mark img.workspace-app-icon {
  width: 42px;
  height: 42px;
  margin: 0;
}

body.sidebar-collapsed .brand > div:not(.brand-mark),
body.sidebar-collapsed .brand-badge {
  display: none;
}

.brand > div:not(.brand-mark) {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.brand strong {
  font-size: 0.95rem;
  line-height: 1.08;
  font-weight: 850;
  letter-spacing: 0;
}

.brand span {
  margin-top: 2px;
  font-size: 0.72rem;
  line-height: 1.08;
  font-weight: 750;
}

/* Keep Workspace's suite identity at the same scale as CRM. These selectors
   intentionally outrank the legacy generic .brand typography above. */
.brand .suite-brand-selector > summary {
  grid-template-columns: 36px 42px minmax(0, 1fr) 16px;
  min-height: 64px;
  gap: 8px;
  padding: 7px;
}

.brand .suite-brand-selector > summary > img {
  width: 42px;
  height: 42px;
}

.brand .suite-brand-copy {
  display: grid;
  min-width: 0;
  margin: 0;
  gap: 3px;
}

.brand .suite-brand-copy strong {
  display: block;
  margin: 0;
  overflow: hidden;
  color: #fff;
  font-size: 13px;
  line-height: 1.05;
  font-weight: 850;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand .suite-brand-copy small {
  display: block;
  margin: 0;
  overflow: hidden;
  color: #9eafc4;
  font-size: 10px;
  line-height: 1.05;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-card {
  min-height: 60px;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
}

.account-avatar {
  width: 42px;
  height: 42px;
  font-size: 0.9rem;
}

.account-card strong {
  font-size: 0.88rem;
  line-height: 1.1;
}

.account-card small {
  margin-top: 3px;
  font-size: 0.72rem;
  line-height: 1.1;
}

/* Keep account identity and suite controls in their own layout cells at all
   browser zoom levels. Generic brand/span rules must not overlap the avatar. */
html.nav-layout-sidebar .account-card,
body.nav-layout-sidebar .account-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
}

html.nav-layout-sidebar .account-card .account-avatar,
body.nav-layout-sidebar .account-card .account-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  height: 42px;
  margin: 0;
  overflow: hidden;
}

html.nav-layout-sidebar .account-card .account-avatar em,
body.nav-layout-sidebar .account-card .account-avatar em {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  line-height: 1;
  text-align: center;
  transform: none;
}

html.nav-layout-sidebar .account-card .account-avatar.avatar-loaded em,
body.nav-layout-sidebar .account-card .account-avatar.avatar-loaded em {
  display: none;
}

html.nav-layout-sidebar .account-card > span:not(.account-avatar),
body.nav-layout-sidebar .account-card > span:not(.account-avatar) {
  display: grid;
  min-width: 0;
  overflow: hidden;
  text-align: left;
}

html.nav-layout-sidebar .account-card strong,
html.nav-layout-sidebar .account-card small,
body.nav-layout-sidebar .account-card strong,
body.nav-layout-sidebar .account-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html.nav-layout-sidebar .brand .suite-brand-selector > summary,
body.nav-layout-sidebar .brand .suite-brand-selector > summary {
  grid-template-columns: 36px 42px minmax(0, 1fr);
}

html.nav-layout-sidebar .brand .suite-brand-chevron,
body.nav-layout-sidebar .brand .suite-brand-chevron {
  display: none;
}

@media (max-width: 760px) {
  .suite-switcher summary span {
    display: none;
  }

  .suite-switcher summary {
    width: 42px;
    justify-content: center;
    padding: 0;
  }

  .suite-switcher summary::after {
    display: none;
  }

  .suite-switcher-menu {
    right: -84px;
    width: min(284px, calc(100vw - 28px));
  }
}

/* Final narrow-reader action behavior: keep a single sticky icon row. This is
   keyed to the actual reader pane width by app.js, not the full window. */
@media (min-width: 761px) {
  body[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions {
    position: sticky !important;
    top: 0 !important;
    z-index: 8 !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: auto !important;
    min-width: 0 !important;
    height: 52px !important;
    min-height: 52px !important;
    max-height: 52px !important;
    margin: 0 -34px 18px !important;
    padding: 8px 34px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    border-bottom: 1px solid #edf1f5 !important;
    background: rgba(255, 255, 255, 0.98) !important;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.04) !important;
    scrollbar-width: none !important;
  }

  body[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions::-webkit-scrollbar,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions::-webkit-scrollbar {
    display: none !important;
  }

  body[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions > .mail-toolbar-primary-actions,
  body[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions > .mail-toolbar-secondary-actions,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions > .mail-toolbar-primary-actions,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions > .mail-toolbar-secondary-actions {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    gap: 6px !important;
    overflow: visible !important;
  }

  body[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions .mail-toolbar-button,
  body[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions .mail-more-actions > summary,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions .mail-toolbar-button,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions .mail-more-actions > summary {
    flex: 0 0 40px !important;
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    height: 36px !important;
    min-height: 36px !important;
    padding-inline: 0 !important;
  }

  body[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions .mail-toolbar-button.primary,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions .mail-toolbar-button.primary {
    flex-basis: 44px !important;
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
  }

  body[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions .mail-toolbar-label,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions .mail-toolbar-label {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
  }

  body[data-view="mail"].mail-reader-narrow-actions .mail-message-header,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-message-header {
    margin-top: 0 !important;
    padding-top: 20px !important;
  }
}

/* Absolute last mail-toolbar correction: the compact mode should only be a
   centered icon strip, never a left-starting strip with negative margins. */
@media (min-width: 761px) {
  body[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions {
    position: sticky !important;
    top: 0 !important;
    z-index: 8 !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 52px !important;
    min-height: 52px !important;
    max-height: 52px !important;
    box-sizing: border-box !important;
    margin: 0 0 18px !important;
    padding: 8px 10px !important;
    gap: 6px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    border-bottom: 1px solid #edf1f5 !important;
    background: rgba(255, 255, 255, 0.98) !important;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.04) !important;
    scrollbar-width: none !important;
  }

  body[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions > .mail-toolbar-primary-actions,
  body[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions > .mail-toolbar-secondary-actions,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions > .mail-toolbar-primary-actions,
  body.native-shell[data-view="mail"].mail-reader-narrow-actions .mail-reader-actions > .mail-toolbar-secondary-actions {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    gap: 6px !important;
    overflow: visible !important;
  }

  body[data-view="mail"].mail-reader-open .mobile-reader-nav {
    display: flex !important;
  }

  body[data-view="mail"].mail-reader-open .mobile-reader-back {
    display: inline-flex !important;
    width: auto !important;
    min-width: fit-content !important;
    padding-inline: 12px !important;
  }
}

/* Landscape phones are wider than the portrait breakpoint but do not have
   room for Mail's folder/list/reader columns. Keep the message list as the
   primary surface, then swap it for the reader when a message is opened. */
@media (hover: none) and (pointer: coarse) and (orientation: landscape) and (max-width: 1000px) {
  body[data-view="mail"] #view-mail.view.active > .mail-workspace,
  body[data-view="mail"] .mail-workspace {
    display: block !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  body[data-view="mail"] .mail-folder-rail,
  body[data-view="mail"] .mail-pane-resizer,
  body[data-view="mail"] .mail-reader {
    display: none !important;
  }

  body[data-view="mail"] .mail-workspace .mail-table,
  body[data-view="mail"] #mail-list {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  body[data-view="mail"].mail-reader-open .mail-workspace .mail-table {
    display: none !important;
  }

  body[data-view="mail"].mail-reader-open .mail-reader {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
}

/* Calendar: match the native three-pane pattern while preserving the web
   calendar and connector behavior. */
.calendar-workspace {
  display: grid;
  grid-template-columns: 230px minmax(620px, 1fr) 330px;
  gap: 14px;
  align-items: start;
}

.calendar-source-pane,
.calendar-detail-pane {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.calendar-source-pane {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 150px);
  padding: 14px;
  overflow: auto;
}

.calendar-source-header,
.calendar-detail-header,
.calendar-detail-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.calendar-source-header strong,
.calendar-detail-header strong {
  display: block;
  color: var(--text);
}

.calendar-source-header span,
.calendar-detail-header span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.calendar-source-list {
  display: grid;
  gap: 6px;
  margin: 14px 0;
}

.calendar-source-button {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.calendar-source-button:hover {
  border-color: var(--line);
  background: var(--surface-soft);
}

.calendar-source-button > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-source-button > i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.calendar-source-button.personal > i { background: #c6922f; }
.calendar-source-button.meeting > i { background: #208a70; }
.calendar-source-button.campaign > i { background: #7c55c7; }
.calendar-source-button.scheduled > i { background: #4b63cf; }
.calendar-source-button.hold > i { background: #d05c75; }
.calendar-source-button.travel > i { background: #2c9cb4; }
.calendar-source-button.work > i { background: #3976d1; }
.calendar-source-button.muted { opacity: 0.48; }

.calendar-source-button strong {
  min-width: 28px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.calendar-source-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.calendar-source-metrics > div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.calendar-source-metrics strong,
.calendar-source-metrics span {
  display: block;
}

.calendar-source-metrics strong { font-size: 18px; }
.calendar-source-metrics span { color: var(--muted); font-size: 11px; }
.calendar-from-mail-button { width: 100%; }

.calendar-source-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.calendar-main { min-width: 0; }

.calendar-detail-pane {
  position: sticky;
  top: 12px;
  min-height: 480px;
  max-height: calc(100vh - 150px);
  padding: 16px;
  overflow: auto;
}

.calendar-detail-empty {
  display: grid;
  min-height: 420px;
  place-content: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.calendar-detail-empty strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.calendar-detail-close { flex: 0 0 auto; }

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

.calendar-detail-fields > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.calendar-detail-fields > .wide { grid-column: 1 / -1; }

.calendar-detail-fields span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calendar-detail-fields strong,
.calendar-detail-fields p {
  overflow-wrap: anywhere;
}

.calendar-detail-fields p {
  margin: 0;
  line-height: 1.45;
}

.calendar-detail-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.calendar-detail-backdrop { display: none; }

.calendar-agenda {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.calendar-agenda > summary {
  padding: 12px 14px;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

/* Workspace already has its own navigation rail, so a nominally wide browser
   can still leave the Calendar canvas too narrow for seven useful day columns.
   Keep details in a drawer until the full viewport is genuinely expansive. */
@media (max-width: 2100px) {
  .calendar-workspace {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .calendar-detail-pane {
    position: fixed;
    z-index: 1002;
    top: 0;
    right: 0;
    width: min(440px, 92vw);
    height: 100vh;
    max-height: none;
    border-radius: 14px 0 0 14px;
    transform: translateX(105%);
    transition: transform 180ms ease;
  }

  .calendar-detail-pane.is-open { transform: translateX(0); }

  .calendar-detail-backdrop {
    position: fixed;
    z-index: 1001;
    inset: 0;
    display: block;
    border: 0;
    background: rgba(15, 23, 42, 0.34);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  .calendar-workspace.detail-open .calendar-detail-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
}

/* Calendar focus layout: keep the month canvas full width and show details only on demand. */
.calendar-workspace {
  display: block;
}

.calendar-main {
  width: 100%;
  min-width: 0;
}

.calendar-detail-modal {
  position: fixed;
  z-index: 1002;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: none;
}

.calendar-detail-dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
  pointer-events: auto;
}

body[data-theme="dark"] .calendar-detail-dialog {
  background: var(--card);
}

.calendar-detail-backdrop {
  position: fixed;
  z-index: 1001;
  inset: 0;
  display: block;
  width: 100vw;
  height: 100vh;
  border: 0;
  border-radius: 0;
  background: rgba(15, 23, 42, 0.38);
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 640px) {
  .calendar-detail-modal {
    padding: 10px;
  }

  .calendar-detail-dialog {
    width: 100%;
    max-height: calc(100vh - 20px);
    padding: 14px;
  }

  .calendar-detail-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .calendar-detail-fields > .wide {
    grid-column: auto;
  }
}

@media (max-width: 1000px) {
  .calendar-workspace { grid-template-columns: minmax(0, 1fr); }

  .calendar-source-pane {
    position: static;
    max-height: none;
  }

  .calendar-source-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .calendar-source-list { grid-template-columns: minmax(0, 1fr); }
  .calendar-source-header { align-items: flex-start; }
  .calendar-detail-pane { width: min(100%, 420px); }
  .calendar-detail-fields { grid-template-columns: minmax(0, 1fr); }
  .calendar-detail-fields > .wide { grid-column: auto; }
}

/* Calendar density pass: the month canvas is the primary surface, mirroring
   Desktop. Side panes provide context without turning every value into a card. */
@media (min-width: 1001px) and (max-width: 2100px) {
  .calendar-workspace {
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 10px;
  }
}

.calendar-source-pane {
  padding: 12px;
  border-radius: 8px;
  box-shadow: none;
}

.calendar-source-header {
  align-items: flex-start;
}

.calendar-source-header .primary-button {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

.calendar-source-list {
  margin: 10px 0;
}

.calendar-source-button {
  padding: 7px 6px;
  border-radius: 6px;
}

.calendar-source-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 10px 0;
  border-block: 1px solid var(--line);
}

.calendar-source-metrics > div {
  padding: 8px 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.calendar-source-metrics strong { font-size: 15px; }

.calendar-month-day {
  min-height: 132px;
  padding: 8px;
}

.calendar-events {
  gap: 3px;
}

.calendar-event,
body[data-theme="dark"] .calendar-event,
.calendar-event.personal,
.calendar-event.meeting,
.calendar-event.campaign,
.calendar-event.hold,
.calendar-event.travel,
.calendar-event.scheduled,
.calendar-event.work,
body[data-theme="dark"] .calendar-event.personal,
body[data-theme="dark"] .calendar-event.meeting,
body[data-theme="dark"] .calendar-event.campaign,
body[data-theme="dark"] .calendar-event.hold,
body[data-theme="dark"] .calendar-event.travel,
body[data-theme="dark"] .calendar-event.scheduled,
body[data-theme="dark"] .calendar-event.work {
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 2px 3px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  text-align: left;
}

.calendar-event:hover,
body[data-theme="dark"] .calendar-event:hover {
  background: var(--surface-soft);
}

.calendar-event-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.calendar-event.personal .calendar-event-dot { background: #c6922f; }
.calendar-event.meeting .calendar-event-dot { background: #208a70; }
.calendar-event.campaign .calendar-event-dot { background: #7c55c7; }
.calendar-event.hold .calendar-event-dot { background: #d05c75; }
.calendar-event.travel .calendar-event-dot { background: #2c9cb4; }
.calendar-event.scheduled .calendar-event-dot { background: #4b63cf; }
.calendar-event.work .calendar-event-dot { background: #3976d1; }

.calendar-event-title {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event small {
  grid-column: 2;
  color: var(--muted);
  font-size: 10px;
}

.calendar-month.month-view .calendar-add-slot {
  opacity: 0;
  transition: opacity 120ms ease;
}

.calendar-month.month-view .calendar-month-day:hover .calendar-add-slot,
.calendar-month.month-view .calendar-month-day:focus-within .calendar-add-slot {
  opacity: 1;
}

@media (max-width: 2100px) {
  .calendar-detail-pane {
    width: min(360px, 92vw);
    padding: 14px;
    border-radius: 8px 0 0 8px;
    box-shadow: -8px 0 24px rgba(15, 23, 42, 0.12);
  }

  .calendar-detail-fields {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    margin: 14px 0;
    border-block: 1px solid var(--line);
  }

  .calendar-detail-fields > div,
  .calendar-detail-fields > .wide {
    grid-column: auto;
    padding: 10px 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
  }

  .calendar-detail-fields > div:last-child {
    border-bottom: 0;
  }
}

/* Modal-specific overrides must follow the legacy responsive side-pane rules. */
.calendar-detail-dialog .calendar-detail-pane {
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.calendar-detail-dialog .calendar-detail-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  border: 0;
}

.calendar-detail-dialog .calendar-detail-fields > div,
.calendar-detail-dialog .calendar-detail-fields > .wide {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.calendar-detail-dialog .calendar-detail-fields > .wide {
  grid-column: 1 / -1;
}

.calendar-detail-dialog .calendar-invitee-detail-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 8px 0 0;
}

.calendar-detail-dialog .calendar-invitee-detail-chips .appointment-invitee-chip {
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  width: auto;
  max-width: min(280px, 100%);
  min-height: 34px;
  gap: 7px;
  margin: 0;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
}

.calendar-detail-dialog .calendar-invitee-detail-chips .compose-recipient-avatar {
  display: inline-grid;
  flex: 0 0 26px;
  place-items: center;
  width: 26px;
  min-width: 26px;
  height: 26px;
  margin: 0;
  font-size: 10px;
  line-height: 1;
}

.calendar-detail-dialog .calendar-invitee-detail-chips .appointment-invitee-chip-text {
  display: block;
  min-width: 0;
  margin: 0;
}

.calendar-detail-dialog .calendar-invitee-detail-chips .appointment-invitee-chip-text strong,
.calendar-detail-dialog .calendar-invitee-detail-chips .appointment-invitee-chip-text small {
  display: block;
  max-width: 220px;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: 0;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.calendar-detail-dialog .calendar-invitee-detail-chips .appointment-invitee-chip-text small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

@media (max-width: 640px) {
  .calendar-detail-dialog .calendar-detail-fields {
    grid-template-columns: 1fr;
  }
}

/* Final compact-rail contract. Both the tablet rail and the retained native
   CRM rail have room for one 42px control only; desktop brand/account grids
   must never leak into this state. */
@media (min-width: 761px) and (max-width: 1280px) {
  html.nav-layout-sidebar .brand,
  body.nav-layout-sidebar .brand {
    display: grid !important;
    grid-template-columns: 42px !important;
    justify-content: center !important;
    justify-items: center !important;
    width: 100% !important;
    padding: 0 !important;
  }

  html.nav-layout-sidebar .brand .suite-brand-selector,
  body.nav-layout-sidebar .brand .suite-brand-selector {
    width: 52px !important;
    margin-inline: auto !important;
  }

  html.nav-layout-sidebar .brand .suite-brand-selector > summary,
  body.nav-layout-sidebar .brand .suite-brand-selector > summary {
    display: grid !important;
    grid-template-columns: 42px !important;
    place-items: center !important;
    width: 52px !important;
    min-width: 52px !important;
    min-height: 52px !important;
    padding: 5px !important;
    overflow: hidden !important;
  }

  html.nav-layout-sidebar .brand .suite-brand-waffle,
  html.nav-layout-sidebar .brand .suite-brand-copy,
  html.nav-layout-sidebar .brand .suite-brand-chevron,
  body.nav-layout-sidebar .brand .suite-brand-waffle,
  body.nav-layout-sidebar .brand .suite-brand-copy,
  body.nav-layout-sidebar .brand .suite-brand-chevron {
    display: none !important;
  }

  html.nav-layout-sidebar .brand .suite-brand-selector > summary > img,
  body.nav-layout-sidebar .brand .suite-brand-selector > summary > img {
    grid-column: 1 !important;
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    margin: 0 !important;
  }

  html.nav-layout-sidebar .account-card,
  body.nav-layout-sidebar .account-card {
    display: grid !important;
    grid-template-columns: 42px !important;
    place-items: center !important;
    width: 56px !important;
    min-width: 56px !important;
    max-width: 56px !important;
    margin-inline: auto !important;
    padding: 6px !important;
    overflow: hidden !important;
  }

  html.nav-layout-sidebar .account-card > span:not(.account-avatar),
  body.nav-layout-sidebar .account-card > span:not(.account-avatar) {
    display: none !important;
  }
}

/* Initials are an overlay, not a flex/grid child. Keeping this contract global
   prevents modal and sidebar layout rules from stretching or offsetting them. */
.account-avatar {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.account-avatar > em {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  font-style: normal;
  line-height: 1;
  text-align: center;
  transform: none;
}

.account-avatar > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.account-avatar.avatar-loaded > em {
  display: none;
}

/* Workspace outline: placement, hierarchy, and row types share one visual
   language across the web and native clients. */
.todo-assignee-filter {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.todo-assignee-filter select,
#todo-quick-type {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 10px;
  background: var(--surface, #fff);
  color: var(--ink);
  font: inherit;
  text-transform: none;
  letter-spacing: 0;
}

#todo-quick-type {
  width: 100px;
}

.todo-outline-help {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
}

.todo-item {
  margin-left: calc(var(--task-depth, 0) * 24px);
  transition: margin-left 140ms ease, border-color 140ms ease, background 140ms ease;
}

.todo-item.child {
  margin-left: calc(var(--task-depth, 0) * 24px);
}

.todo-item:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 28%, transparent);
  outline-offset: 2px;
}

.todo-item.item-heading {
  margin-top: 14px;
  border-color: transparent;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface, #fff));
}

.todo-item.item-heading .todo-item-title strong {
  font-size: 15px;
  letter-spacing: 0.02em;
}

.todo-item.item-note {
  border-style: dashed;
  background: color-mix(in srgb, #f4b740 7%, var(--surface, #fff));
}

.todo-item-glyph {
  display: grid;
  place-items: center;
  width: 28px;
  min-height: 28px;
  color: var(--accent);
  font-weight: 900;
}

@media (max-width: 760px) {
  .todo-quick-add {
    grid-template-columns: 38px 86px minmax(0, 1fr);
  }

  .todo-item,
  .todo-item.child {
    margin-left: calc(var(--task-depth, 0) * 12px);
  }

  .todo-outline-help {
    display: none;
  }
}
