:root {
  --ink: #16151f;
  --muted: #777789;
  --line: #ecebf2;
  --surface: #ffffff;
  --soft: #f7f7fb;
  --purple: #5d3fd3;
  --purple-dark: #372c91;
  --violet: #8b5cf6;
  --blue: #24a3d8;
  --gold: #f4ad22;
  --green: #17a871;
  --red: #df4d55;
  --shadow: 0 20px 55px rgba(35, 26, 76, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Laptop one-screen dashboard pass: no scroll, left menu, compact search drawer. */
@media all { /* v18: was min-width 761px */
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .shell,
  .shell.sidebar-collapsed {
    display: grid !important;
    grid-template-columns: 212px minmax(0, 1fr) !important;
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
  }

  body.auth-pending .shell,
  body.signed-out .shell {
    display: none !important;
  }

  .sidebar,
  .shell.sidebar-collapsed .sidebar {
    width: 212px !important;
    height: 100vh;
    min-height: 0;
    padding: 18px 14px !important;
    gap: 14px;
    overflow: hidden;
    background: #182433 !important;
  }

  .sidebar .brand {
    display: flex !important;
    min-height: 34px;
    margin: 0 0 8px;
    color: #f6f9ff;
  }

  .sidebar .brand strong,
  .sidebar .brand span {
    color: #f6f9ff;
  }

  .sidebar .primary-action {
    display: none;
  }

  .nav {
    display: grid !important;
    gap: 5px;
  }

  .nav-item {
    display: grid !important;
    grid-template-columns: 20px 1fr;
    min-height: 34px;
    padding: 7px 9px;
    color: rgba(238, 244, 255, 0.74);
    font-size: 12px;
    font-weight: 800;
  }

  .nav-icon {
    display: block;
    width: 16px;
    color: rgba(238, 244, 255, 0.5);
    font-size: 9px;
  }

  .sidebar-footer {
    display: none;
  }

  .main {
    height: 100vh;
    min-height: 0;
    padding: 10px 12px 12px;
    overflow: hidden;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-height: 40px;
    margin: 0 0 8px;
    padding: 0;
    background: transparent !important;
  }

  .page-heading,
  .profile-button,
  .dashboard-command-bar,
  .dashboard-settings-dots {
    display: none !important;
  }

  .topbar-tools {
    grid-column: 1 / -1;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-height: 40px;
    flex-wrap: nowrap;
  }

  .quick-ui-toggles {
    order: 2;
    gap: 6px;
  }

  .quick-icon-button {
    width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    border-radius: 50%;
    font-size: 11px;
  }

  .search {
    order: 1;
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
    width: auto;
    max-width: 560px;
  }

  .search::before {
    content: "⌕";
    position: absolute;
    right: 0;
    top: 0;
    z-index: 2;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    color: #5d3fd3;
    background: #efecff;
    font-size: 18px;
    font-weight: 950;
    pointer-events: none;
  }

  .search input {
    width: 34px;
    min-height: 34px;
    padding: 0 16px;
    border-radius: 999px;
    opacity: 0;
    color: var(--ink);
    background: #eceef3;
    transition: width 180ms ease, opacity 180ms ease, padding 180ms ease;
  }

  .search:focus-within input,
  .search input:not(:placeholder-shown) {
    width: min(520px, calc(100vw - 420px));
    padding: 8px 44px 8px 16px;
    opacity: 1;
  }

  .global-search-results {
    top: calc(100% + 8px);
    width: min(520px, calc(100vw - 420px));
  }

  #view-overview.active {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: repeat(6, minmax(0, 1fr));
    grid-auto-flow: dense;
    grid-auto-rows: minmax(110px, 1fr);
    height: calc(100vh - 60px);
    min-height: 0;
    max-height: calc(100vh - 60px);
    gap: 8px;
    padding: 8px;
    overflow: hidden;
    border-radius: 18px;
  }

  #view-overview > .dashboard-grid,
  #view-overview > .overview-main-grid,
  #view-overview > .dashboard-extra-grid {
    display: contents;
  }

  #view-overview [data-dashboard-topic].dashboard-topic-visible {
    min-height: 0;
    padding: 11px 12px;
    border-radius: 16px;
    overflow: hidden;
  }

  #view-overview [data-dashboard-topic="health"].dashboard-topic-visible {
    grid-column: 1 / span 5 !important;
    grid-row: 1 / span 1 !important;
  }

  #view-overview [data-dashboard-topic="revenue"].dashboard-topic-visible {
    grid-column: 1 / span 4 !important;
    grid-row: 2 / span 2 !important;
  }

  #view-overview [data-dashboard-topic="visitors"].dashboard-topic-visible {
    grid-column: 5 / span 4 !important;
    grid-row: 1 / span 3 !important;
  }

  #view-overview [data-dashboard-topic="payments"].dashboard-topic-visible {
    grid-column: 9 / span 4 !important;
    grid-row: 1 / span 3 !important;
  }

  #view-overview [data-dashboard-topic="email"].dashboard-topic-visible {
    grid-column: 1 / span 8 !important;
    grid-row: 4 / span 3 !important;
  }

  #view-overview [data-dashboard-topic="calendar"].dashboard-topic-visible {
    grid-column: 9 / span 4 !important;
    grid-row: 4 / span 3 !important;
  }

  .dashboard-module-title {
    margin-bottom: 6px;
    font-size: clamp(15px, 1.1vw, 20px);
  }

  .em-panel .dashboard-module-title {
    font-size: clamp(16px, 1.15vw, 21px);
  }

  .dashboard-module-head {
    margin-bottom: 2px;
  }

  .dashboard-inline-filter {
    transform: scale(0.86);
    transform-origin: right center;
  }

  .system-orb-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 5px;
  }

  .system-orb {
    gap: 3px;
  }

  .system-orb-circle,
  .system-orb.watch .system-orb-circle,
  .system-orb.open .system-orb-circle {
    width: 26px;
  }

  .system-orb strong {
    font-size: 8px;
  }

  .system-orb small,
  .ping-strip {
    display: none;
  }

  .dashboard-stat-row {
    gap: 6px;
  }

  .dashboard-stat-row div {
    padding: 7px;
    border-radius: 10px;
  }

  .dashboard-stat-row strong {
    font-size: 24px;
  }

  .board-line-chart {
    height: 116px;
  }

  .dashboard-mini-bars {
    height: 142px;
  }

  .em-panel .bar-chart,
  .em-panel .date-chart {
    min-height: 0;
    height: 100%;
  }

  .payment-pie-wrap {
    grid-template-columns: 0.72fr 1fr;
    gap: 10px;
  }

  .payment-total-grid {
    gap: 6px;
  }

  .payment-total-grid button {
    min-height: 32px;
    padding: 6px 8px;
    border-radius: 10px;
  }

  .payment-pizza {
    width: min(190px, 100%);
  }

  .dashboard-calendar-panel .panel-header {
    margin: 0 0 4px;
  }

  .dashboard-calendar-grid {
    height: calc(100% - 46px);
    gap: 2px;
  }

  .dashboard-calendar-day {
    min-height: 0;
    padding: 4px;
  }

  .tara-widget {
    transform: scale(0.86);
    transform-origin: right bottom;
  }
}

@media all { /* v18: was min-width 761px */
  .topbar {
    min-height: 58px;
    padding: 10px 18px;
  }

  .topbar-tools {
    align-items: flex-start;
  }

  .profile-button {
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 999px;
    line-height: 1;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(141, 91, 246, 0.22), transparent 28rem),
    linear-gradient(135deg, #f5f2ff 0%, #ffffff 45%, #f0f8ff 100%);
}

body.dark-mode {
  --ink: #f4f1ff;
  --muted: #b9b4c9;
  --line: rgba(255, 255, 255, 0.12);
  --surface: #181424;
  --soft: #211b31;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(141, 91, 246, 0.22), transparent 26rem),
    linear-gradient(135deg, #14101d 0%, #1a1724 55%, #101923 100%);
}

body.dark-mode .panel,
body.dark-mode .login-card,
body.dark-mode .drawer-card,
body.dark-mode .detail-card,
body.dark-mode .global-search-results,
body.dark-mode .global-search-item,
body.dark-mode .payment-card,
body.dark-mode .newsletter-group,
body.dark-mode .newsletter-contact {
  background: var(--surface);
  color: var(--ink);
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea,
body.dark-mode .search input {
  border-color: var(--line);
  color: var(--ink);
  background: #211b31;
}

body.dark-mode .topbar {
  background: rgba(24, 20, 36, 0.92);
}

body.auth-pending .shell,
body.signed-out .shell {
  display: none;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(93, 63, 211, 0.12), rgba(36, 163, 216, 0.08)),
    #f7f7fb;
}

.login-screen[hidden] {
  display: none !important;
}

.login-card {
  width: min(440px, 100%);
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(31, 28, 59, 0.14);
}

.login-card .brand.compact {
  margin-bottom: 8px;
}

.login-card h1 {
  margin: 4px 0 0;
  font-size: 30px;
}

.login-card label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-weight: 800;
}

a {
  text-decoration: none;
}

body,
a,
button,
input,
select,
textarea,
p,
span,
strong,
small,
td,
th,
label,
div {
  overflow-wrap: anywhere;
  word-break: break-word;
}

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

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: calc(100vh - 28px);
  margin: 14px;
  overflow: hidden;
  border: 1px solid rgba(93, 63, 211, 0.2);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.shell.sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.shell.sidebar-collapsed .sidebar {
  width: 0;
  padding-right: 0;
  padding-left: 0;
  overflow: hidden;
  border: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 24px 20px;
  color: #fff;
  background: linear-gradient(180deg, #312783 0%, #4438a4 100%);
  transition: width 180ms ease, padding 180ms ease;
}

.mobile-menu-head {
  display: none;
}

.brand,
.profile-button,
.panel-header,
.section-head,
.metric-card,
.reply-row,
.payment-card,
.tara-widget header,
.calendar-card {
  display: flex;
  align-items: center;
}

.brand {
  gap: 14px;
}

.brand-mark,
.avatar,
.tara-face {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  color: var(--purple-dark);
  background: #fff;
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.sidebar-footer span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

.primary-action,
.primary-small,
.upload-button,
.ghost-button,
.icon-button,
.profile-button,
.nav-item {
  border: 0;
}

.primary-action {
  width: 100%;
  padding: 13px 16px;
  border-radius: 9px;
  color: var(--purple-dark);
  background: #fff;
  font-weight: 800;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.82);
  background: transparent;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
}

.nav-icon {
  width: 25px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  font-weight: 900;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-footer strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.main {
  min-width: 0;
  padding: 24px 30px 34px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfbfe 100%);
  overflow-y: auto;
  overflow-x: hidden;
}

.topbar {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.menu-button,
.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 10px;
  background: var(--soft);
  color: var(--purple-dark);
  font-weight: 900;
}

.menu-button {
  gap: 4px;
}

.menu-button span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar-tools {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
}

.search {
  position: relative;
  order: 3;
  flex: 0 0 100%;
  min-width: 0;
  max-width: none;
}

.search span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.search input {
  width: 100%;
  min-height: 48px;
  padding: 14px 22px;
  border: 1px solid #e4e3ec;
  border-radius: 18px;
  background: #eceef3;
  outline: 0;
  color: var(--ink);
  font-weight: 800;
}

.search input::placeholder {
  color: #8d8d99;
}

.global-search-results {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 50;
  width: min(760px, 88vw);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(35, 26, 76, 0.16);
}

.global-search-empty,
.global-search-capabilities {
  padding: 14px 16px;
  color: var(--muted);
  background: #f2f3f7;
  font-size: 13px;
  font-weight: 800;
}

.global-search-item {
  display: grid;
  width: 100%;
  gap: 4px;
  padding: 13px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.global-search-item:hover {
  background: #f7f7fb;
}

.global-search-item strong {
  font-size: 14px;
}

.global-search-item span {
  position: static;
  width: auto;
  height: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.search input:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: rgba(93, 63, 211, 0.45);
  box-shadow: 0 0 0 4px rgba(93, 63, 211, 0.1);
}

.profile-button {
  gap: 10px;
  padding: 6px 10px;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.avatar {
  width: 42px;
  height: 42px;
  color: #fff;
  background: linear-gradient(135deg, #222 0%, #8b5cf6 100%);
}

.profile-button strong,
.profile-button small {
  display: block;
}

.profile-button small {
  color: var(--muted);
}

.user-switcher {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.user-switcher select {
  min-width: 178px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.metric-grid.compact {
  grid-template-columns: repeat(3, minmax(170px, 1fr));
}

.metric-card {
  position: relative;
  min-height: 224px;
  align-items: flex-start;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 10px 28px rgba(36, 31, 72, 0.06);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.metric-card:hover,
.metric-card:focus-visible {
  border-color: color-mix(in srgb, var(--accent, var(--purple)) 35%, #fff);
  box-shadow: 0 18px 40px rgba(36, 31, 72, 0.12);
  transform: translateY(-2px);
}

.metric-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  content: "";
  background: var(--accent, var(--purple));
}

.metric-circle-card::before {
  display: none;
}

.metric-circle-card {
  align-items: center;
  justify-content: space-between;
  aspect-ratio: 1;
  min-height: 0;
  padding: 20px;
  text-align: center;
  border-radius: 24px;
  background: linear-gradient(180deg, #fff 0%, color-mix(in srgb, var(--accent, var(--purple)) 7%, #fff) 100%);
}

.metric-graph {
  grid-column: span 1;
  border-radius: 28px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent, var(--purple)) 8%, #fff), #fff 58%),
    #fff;
}

.metric-content {
  position: relative;
  z-index: 1;
}

.metric-value {
  display: block;
  margin: 9px 0 7px;
  font-size: 36px;
  font-weight: 900;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric-symbol {
  display: grid;
  position: relative;
  z-index: 1;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 999px;
  color: var(--accent, var(--purple));
  background: color-mix(in srgb, var(--accent, var(--purple)) 12%, #fff);
  font-weight: 900;
}

.metric-circle-card .metric-symbol {
  width: 38px;
  height: 38px;
  margin: 0 auto 8px;
  font-size: 13px;
}

.metric-expand {
  position: relative;
  z-index: 1;
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--accent, var(--purple));
  background: color-mix(in srgb, var(--accent, var(--purple)) 12%, #fff);
  font-size: 12px;
  font-weight: 900;
}

.metric-circle-card .metric-expand {
  margin-top: 2px;
}

.metric-kpi-donut {
  display: grid;
  position: relative;
  z-index: 1;
  width: min(150px, 78%);
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff 0 55%, transparent 56%),
    conic-gradient(var(--accent, var(--purple)) var(--pct), #edf0f6 0);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.8),
    0 18px 32px color-mix(in srgb, var(--accent, var(--purple)) 16%, transparent);
}

.metric-kpi-donut::before {
  position: absolute;
  inset: 13px;
  border-radius: 50%;
  background:
    linear-gradient(180deg, #fff, color-mix(in srgb, var(--accent, var(--purple)) 6%, #fff));
  box-shadow: 0 8px 18px rgba(34, 30, 62, 0.08);
  content: "";
}

.metric-kpi-donut > div {
  position: relative;
  z-index: 1;
}

.metric-kpi-donut .metric-value {
  margin: 0;
  font-size: 28px;
}

.metric-circle-card .metric-content {
  display: grid;
  gap: 2px;
}

.metric-mini-bars {
  display: flex;
  position: relative;
  z-index: 1;
  align-items: end;
  gap: 7px;
  width: 100%;
  min-height: 76px;
  padding-top: 8px;
}

.metric-mini-bars i {
  display: block;
  flex: 1;
  min-width: 8px;
  border-radius: 999px 999px 5px 5px;
  background: linear-gradient(180deg, var(--accent, var(--purple)), var(--purple-dark));
}

.metric-line-graph {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 78px;
}

.metric-line-graph svg {
  width: 100%;
  height: 78px;
}

.metric-line-graph path {
  fill: none;
  stroke: var(--accent, var(--purple));
  stroke-linecap: round;
  stroke-width: 7;
}

.metric-mini-donut {
  display: grid;
  position: relative;
  z-index: 1;
  width: 92px;
  height: 92px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--accent, var(--purple)) var(--pct), #eef0f6 0);
}

.metric-mini-donut span {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  font-weight: 900;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 20px;
}

.overview-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(300px, 3fr);
  gap: 20px;
  align-items: stretch;
}

.em-panel,
.payment-pie-panel {
  min-height: 520px;
}

.em-panel .panel-header {
  align-items: flex-start;
}

.em-panel [data-left-view-filters="overview"] {
  max-width: 520px;
}

.secondary-dashboard-grid {
  margin-top: 20px;
}

.dashboard-calendar-panel {
  grid-column: 1 / -1;
}

.dashboard-calendar {
  display: grid;
  gap: 14px;
  overflow: hidden;
}

.dashboard-calendar-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f2f3f7;
}

.dashboard-calendar-title strong {
  font-size: 18px;
}

.dashboard-calendar-title span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.calendar-panel-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
}

.calendar-panel-actions label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.calendar-panel-actions select {
  min-width: 190px;
}

.dashboard-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.dashboard-calendar-head {
  display: grid;
  min-height: 34px;
  place-items: center;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: #f2f3f7;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-calendar-day {
  position: relative;
  display: grid;
  aspect-ratio: 1 / 1;
  min-height: 0;
  padding: 9px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #f8f9fc;
  color: var(--ink);
  text-align: left;
}

.dashboard-calendar-day.muted {
  background: #f4f5f8;
}

.dashboard-calendar-day.has-appointments {
  cursor: pointer;
  background: #fff;
  box-shadow: inset 0 0 0 2px rgba(93, 63, 211, 0.16);
}

.dashboard-calendar-day.has-appointments:hover {
  z-index: 1;
  box-shadow: inset 0 0 0 2px var(--purple), 0 12px 28px rgba(35, 26, 76, 0.12);
}

.dashboard-calendar-day > strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.dashboard-day-count {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--purple);
  font-size: 11px;
  font-weight: 900;
}

.dashboard-day-colors,
.dashboard-calendar-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.dashboard-calendar-day small {
  align-self: end;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.2;
}

.dashboard-calendar-legend {
  padding: 2px 0 4px;
}

.dashboard-calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.appointment-color {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--purple);
}

.appointment-color.viewing {
  background: var(--green);
}

.appointment-color.consultation {
  background: var(--blue);
}

.appointment-color.telephone {
  background: var(--gold);
}

.appointment-color.physical_meeting {
  background: var(--purple);
}

.appointment-color.webinar {
  background: var(--red);
}

.db-metric-grid {
  grid-template-columns: minmax(220px, 320px);
  margin-top: 20px;
  margin-bottom: 0;
}

.panel {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 12px 26px rgba(37, 32, 72, 0.05);
}

.panel.wide {
  grid-column: span 1;
}

.panel-header,
.section-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  outline: 0;
}

select,
input {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  padding: 12px;
  resize: vertical;
}

.ghost-button,
.primary-small,
.upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 9px;
  font-weight: 800;
}

.ghost-button {
  color: var(--purple);
  background: #f1efff;
}

.primary-small,
.upload-button {
  color: #fff;
  background: var(--purple);
}

.primary-small.as-link,
.ghost-button.as-link {
  text-decoration: none;
}

.primary-small:disabled,
.ghost-button:disabled,
[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.52;
}

.upload-button input {
  display: none;
}

.bar-chart {
  display: block;
  min-height: 205px;
  padding: 6px 0 0;
}

.em-panel .bar-chart {
  min-height: 410px;
}

.date-chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.date-chart .chart-grid-line {
  stroke: #e5e6ee;
  stroke-width: 1;
}

.date-chart .chart-axis-line {
  stroke: #8d91a4;
  stroke-width: 2;
}

.date-chart text {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.date-chart rect,
.date-chart polyline,
.date-chart circle {
  transition: opacity 160ms ease, transform 160ms ease;
}

.date-chart .chart-point {
  cursor: help;
}

.date-chart .chart-point:hover {
  opacity: 0.72;
}

[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 40;
  min-width: max-content;
  max-width: 240px;
  padding: 8px 10px;
  border-radius: 8px;
  color: #fff;
  background: rgba(22, 21, 31, 0.94);
  box-shadow: 0 10px 24px rgba(22, 21, 31, 0.16);
  content: attr(data-tooltip);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.filter-bar button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 13px;
  font-weight: 900;
}

.filter-bar button:hover,
.filter-bar button.active {
  border-color: rgba(93, 63, 211, 0.34);
  color: var(--purple);
  background: #f1efff;
}

.metric-filter-bar {
  margin-bottom: 16px;
}

.dropdown-filter-bar {
  align-items: end;
}

.dropdown-filter-bar label {
  display: grid;
  min-width: min(240px, 100%);
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.dropdown-filter-bar select {
  min-width: 220px;
  border-radius: 9px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  text-transform: none;
}

.advanced-settings {
  margin-top: 20px;
}

.advanced-settings summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 26px rgba(37, 32, 72, 0.05);
  cursor: pointer;
  list-style: none;
}

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

.advanced-settings summary::after {
  content: "+";
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  color: var(--purple);
  background: #f1efff;
  font-size: 20px;
  font-weight: 900;
}

.advanced-settings[open] summary::after {
  content: "-";
}

.advanced-settings summary span,
.advanced-settings summary strong {
  display: block;
}

.advanced-settings summary strong {
  margin-top: 4px;
  font-size: 18px;
}

.advanced-settings > .panel {
  margin-top: 14px;
}

.payment-pie-wrap {
  display: grid;
  justify-items: center;
  gap: 22px;
}

.payment-pie {
  display: grid;
  position: relative;
  width: min(270px, 86%);
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff 0 48%, transparent 49%),
    conic-gradient(var(--segments));
  box-shadow:
    inset 0 0 0 12px rgba(255, 255, 255, 0.68),
    0 26px 52px rgba(37, 32, 72, 0.14);
}

.payment-pie::before {
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 247, 251, 0.78));
  box-shadow: inset 0 0 0 1px rgba(93, 63, 211, 0.08);
  content: "";
}

.payment-pie span {
  display: grid;
  position: relative;
  grid-template-rows: 1fr auto;
  width: 104px;
  height: 104px;
  align-items: center;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 14px 30px rgba(37, 32, 72, 0.12);
  font-size: 34px;
  font-weight: 900;
}

.payment-pie span strong {
  line-height: 1;
}

.payment-pie span small {
  display: block;
  margin-top: -12px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.payment-pie-legend {
  display: grid;
  width: 100%;
  gap: 10px;
}

.payment-pie-legend button {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  font-weight: 800;
}

.payment-pie-legend button:hover {
  border-color: rgba(93, 63, 211, 0.32);
  background: #f8f7ff;
}

.payment-pie-legend i {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.plain-title-link {
  display: inline-flex;
  max-width: 100%;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.dashboard-replies-panel {
  grid-column: 1 / -1;
}

.dashboard-replies-panel .panel-header {
  align-items: flex-start;
}

.dashboard-reply-controls {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(180px, 0.7fr);
  gap: 12px;
  margin: -6px 0 16px;
}

.dashboard-reply-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-reply-detail {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}

.dashboard-reply-detail div,
.dashboard-reply-detail strong,
.dashboard-reply-detail span {
  display: block;
}

.dashboard-reply-detail span {
  margin-top: 4px;
  color: var(--muted);
}

.dashboard-reply-detail p {
  color: var(--muted);
}

.dashboard-reply-detail b {
  color: var(--ink);
}

.dashboard-reply-entry {
  display: grid;
  width: 100%;
  gap: 3px;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.dashboard-reply-entry span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dashboard-topic-controls {
  display: none;
}

.dashboard-topic-summary {
  display: none;
}

.dashboard-shortcut {
  display: grid;
  width: 100%;
  gap: 4px;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.dashboard-shortcut strong {
  font-size: 16px;
}

.dashboard-shortcut span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dashboard-extra-grid {
  display: grid;
  gap: 20px;
}

.profile-settings {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.profile-settings label,
.dashboard-topic-picker {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.dashboard-topic-picker label {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  color: var(--ink);
  font-size: 13px;
}

.column-menu {
  position: relative;
  width: max-content;
  max-width: 100%;
  justify-self: start;
}

.column-menu summary {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--purple);
  background: var(--purple-soft);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

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

.column-menu summary::after {
  content: "v";
  margin-left: 8px;
  font-weight: 950;
}

.column-menu[open] summary::after {
  transform: rotate(180deg);
}

.column-menu .column-topic-picker {
  position: static;
  width: min(460px, calc(100vw - 32px));
  max-height: 440px;
  margin-top: 8px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(33, 27, 76, 0.16);
}

#payments-column-menu .column-menu .column-topic-picker,
#contacts-column-menu .column-menu .column-topic-picker {
  position: static;
}

#payments-column-menu .column-menu .column-topic-picker {
  min-width: 460px;
}

#contacts-column-menu .column-menu .column-topic-picker {
  min-width: 520px;
}

.column-topic-picker label {
  grid-template-columns: 24px minmax(140px, 1fr) auto;
  align-items: center;
  min-height: 42px;
  padding: 8px;
  gap: 9px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.2;
}

.column-order-actions {
  display: inline-flex;
  gap: 4px;
}

.column-order-actions button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--purple);
  background: #fff;
  font-weight: 950;
  cursor: pointer;
}

.column-order-actions button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.column-topic-picker input {
  width: 20px;
  height: 20px;
  min-height: 0;
  accent-color: var(--purple);
}

.profile-save-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.profile-save-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.donut-wrap {
  display: grid;
  place-items: center;
  gap: 18px;
  min-height: 230px;
}

.donut {
  display: grid;
  width: 154px;
  height: 154px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--purple) var(--pct), #eef0f6 0);
}

.donut span {
  display: grid;
  width: 98px;
  height: 98px;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  font-size: 26px;
  font-weight: 900;
}

.legend {
  display: grid;
  gap: 8px;
  width: 100%;
  color: var(--muted);
  font-size: 13px;
}

.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 999px;
}

.legend .blue {
  background: var(--purple);
}

.legend .gray {
  background: #d8dbe6;
}

.sparkline {
  height: 120px;
  background:
    linear-gradient(180deg, transparent 0 49%, var(--line) 49% 51%, transparent 51%),
    url("data:image/svg+xml,%3Csvg width='360' height='120' viewBox='0 0 360 120' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 86 C 44 72, 51 34, 91 52 S 151 112, 188 69 236 11, 278 37 310 78, 354 60' fill='none' stroke='%235d3fd3' stroke-width='6' stroke-linecap='round'/%3E%3C/svg%3E")
      center / 100% 100% no-repeat;
}

.inline-stat {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 18px;
}

.inline-stat strong {
  font-size: 32px;
}

.inline-stat span {
  color: var(--muted);
}

.reply-list,
.status-stack {
  display: grid;
  gap: 12px;
}

.reply-row {
  gap: 14px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.reply-row .avatar,
.payment-card .avatar {
  width: 38px;
  height: 38px;
  font-size: 14px;
}

.mobile-contact-phone,
.payment-table-head {
  display: none;
}

.reply-row p,
.payment-card p {
  color: var(--muted);
  font-size: 13px;
}

.reply-row button {
  margin-left: auto;
}

.status-item {
  display: grid;
  gap: 7px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef0f6;
}

.track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent, var(--purple));
}

.section-head {
  align-items: end;
}

.table-wrap {
  max-width: 100%;
  overflow-x: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 0;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: normal;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.tag {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--tag-color, var(--purple));
  background: var(--tag-bg, #f1efff);
  font-size: 12px;
  font-weight: 800;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(210px, 1fr));
  gap: 18px;
}

.payment-table-controls,
.contact-table-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.payment-table-controls label,
.contact-table-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.stripe-panel {
  margin-bottom: 18px;
}

.stripe-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.stripe-readiness {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.readiness-progress {
  display: none;
  height: 10px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #edeafb;
}

.readiness-progress.active {
  display: block;
}

.readiness-progress span {
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--purple), var(--blue));
  transition: width 240ms ease;
}

.readiness-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.readiness-dot {
  display: grid;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--red);
  font-size: 12px;
  font-weight: 900;
}

.readiness-item.pass .readiness-dot {
  background: var(--green);
}

.readiness-item strong,
.readiness-item span {
  display: block;
}

.readiness-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.env-grid,
.test-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.env-grid code,
.test-card-grid div {
  min-width: 0;
  padding: 13px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}

.test-card-grid {
  margin-top: 14px;
}

.test-card-grid strong,
.test-card-grid span {
  display: block;
}

.test-card-grid span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.payment-result {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.payment-result .panel {
  max-width: 720px;
}

.payment-result h1 {
  margin: 8px 0 14px;
}

.payment-result p {
  margin-bottom: 18px;
  color: var(--muted);
}

.webinar-publish-panel {
  margin-bottom: 18px;
}

.webinar-room-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.webinar-room-preview div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}

.webinar-room-preview strong,
.webinar-room-preview p {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
}

.webinar-room-preview p {
  color: var(--muted);
  font-size: 13px;
}

.users-table {
  display: grid;
  gap: 16px;
}

.newsletter-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(320px, 1fr);
  gap: 14px;
}

.newsletter-layout .wide,
.newsletter-composer,
.newsletter-dispatch-panel {
  grid-column: 1 / -1;
}

.compact-fields {
  grid-template-columns: 1fr;
}

.inline-search {
  margin-bottom: 14px;
}

.newsletter-groups,
.newsletter-contact-list {
  display: grid;
  gap: 10px;
  max-height: 430px;
  overflow: auto;
  padding-right: 4px;
}

.newsletter-group-actions,
.newsletter-upload-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, auto));
  align-items: end;
  gap: 8px;
  margin-top: 12px;
}

.newsletter-upload-row {
  grid-template-columns: minmax(0, 1.4fr) minmax(130px, 0.6fr);
  margin-top: 0;
}

.newsletter-contact-picker[hidden] {
  display: none;
}

.newsletter-contact-picker {
  margin-top: 12px;
}

.newsletter-select-help,
.newsletter-empty,
.newsletter-file-preview {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.newsletter-file-preview {
  display: grid;
  gap: 3px;
  margin-top: 10px;
  padding: 12px;
  border-radius: 12px;
  background: #f7f6fc;
}

.newsletter-group,
.newsletter-contact,
.newsletter-history-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.newsletter-history-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.newsletter-history-item {
  justify-content: space-between;
  border-color: transparent;
  background: #f7f6fc;
}

.newsletter-history-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.newsletter-group {
  justify-content: space-between;
}

.newsletter-group.active {
  border-color: rgba(93, 63, 211, 0.45);
  background: #f3f0ff;
}

.newsletter-group span,
.newsletter-contact small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.newsletter-contact input {
  width: 18px;
  height: 18px;
  accent-color: var(--purple);
}

.newsletter-send-log {
  margin-top: 14px;
}

.success-note,
.error-note {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 12px;
  font-weight: 800;
}

.success-note {
  background: #eaf8f2;
  color: var(--green);
}

.error-note {
  background: #fff0f0;
  color: var(--red);
}

.success-note span,
.error-note span {
  color: var(--ink);
  font-weight: 700;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.45fr) minmax(0, 1.55fr);
  gap: 18px;
  align-items: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}

.user-summary {
  display: flex;
  align-items: center;
  gap: 0;
}

.user-summary p {
  margin-top: 4px;
  color: var(--muted);
}

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

.permission-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.permission-chip input {
  width: 16px;
  height: 16px;
  accent-color: var(--purple);
}

.readonly-mode .upload-button,
.readonly-mode [data-write-action] {
  filter: grayscale(0.2);
}

.webinar-site {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(93, 63, 211, 0.12), transparent 36%),
    #fbfbfe;
}

.webinar-hero {
  display: grid;
  min-height: 34vh;
  align-content: center;
  padding: 48px min(7vw, 86px);
  color: #fff;
  background:
    linear-gradient(135deg, rgba(49, 39, 131, 0.94), rgba(93, 63, 211, 0.78)),
    url("data:image/svg+xml,%3Csvg width='900' height='420' viewBox='0 0 900 420' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 340 L190 130 L300 230 L430 80 L610 270 L720 160 L900 340 L900 420 L0 420 Z' fill='%23ffffff' opacity='.16'/%3E%3C/svg%3E")
      center / cover no-repeat;
}

.webinar-hero .eyebrow {
  color: rgba(255, 255, 255, 0.76);
}

.webinar-hero h1 {
  max-width: 760px;
  margin-top: 8px;
  font-size: clamp(34px, 5vw, 66px);
}

.webinar-hero p:last-child {
  margin-top: 16px;
  font-size: 18px;
}

.webinar-join-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(360px, 1.15fr);
  gap: 28px;
  max-width: 1120px;
  margin: -44px auto 0;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}

.webinar-join-panel p {
  margin-top: 10px;
  color: var(--muted);
}

.zoom-embed-shell {
  display: grid;
  gap: 14px;
}

.zoom-frame-placeholder {
  display: grid;
  min-height: 280px;
  place-items: center;
  padding: 26px;
  border: 1px dashed rgba(93, 63, 211, 0.32);
  border-radius: 12px;
  background: #f8f6ff;
  text-align: center;
}

.zoom-frame-placeholder strong,
.zoom-frame-placeholder span {
  display: block;
}

.zoom-frame-placeholder span {
  max-width: 440px;
  margin-top: 8px;
  color: var(--muted);
}

.disabled-link {
  pointer-events: none;
  opacity: 0.62;
}

.kanban-column {
  min-height: 470px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}

.kanban-column h3 {
  margin: 0 0 14px;
  font-size: 15px;
}

.payment-card {
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(37, 32, 72, 0.06);
}

.amount {
  margin-left: auto;
  text-align: right;
  font-weight: 900;
}

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

.field-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field-grid .full {
  grid-column: 1 / -1;
}

.form-builder {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 20px;
}

.preview-panel {
  align-self: start;
}

.preview-panel h2 {
  margin: 6px 0 18px;
  font-size: 24px;
}

.preview-question {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.calendar-card {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-top: 18px;
  padding: 18px;
  border: 1px dashed rgba(93, 63, 211, 0.35);
  border-radius: 12px;
  background: #fbfaff;
}

.calendar-card a {
  color: var(--purple);
  font-weight: 900;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.calendar-day,
.calendar-head {
  min-height: 72px;
  padding: 10px;
  border-radius: 10px;
}

.calendar-head {
  min-height: auto;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.calendar-day {
  border: 1px solid var(--line);
  background: #f1f2f6;
  color: #a1a4af;
}

.calendar-day.available {
  border-color: rgba(23, 168, 113, 0.35);
  background: #eaf8f2;
  color: var(--ink);
}

.calendar-day strong,
.calendar-day span {
  display: block;
}

.calendar-day span {
  margin-top: 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(22, 21, 31, 0.42);
  backdrop-filter: blur(5px);
}

.drawer.open {
  display: flex;
}

.drawer-card {
  position: relative;
  z-index: 91;
  width: min(1180px, 100%);
  max-height: min(92vh, 980px);
  padding: 26px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 32px 90px rgba(22, 21, 31, 0.28);
}

.foreground-chart {
  padding: 18px 18px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #fbfbfe);
}

.chart-axis-note {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.chart-axis-note span {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
}

.drawer-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.drawer-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.detail-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.detail-card-button {
  display: block;
  width: 100%;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.detail-card-button:hover,
.detail-card-button:focus-visible {
  border-color: rgba(93, 63, 211, 0.42);
  background: #faf9ff;
  transform: translateY(-1px);
  outline: none;
}

.detail-card p {
  margin-top: 6px;
  color: var(--muted);
}

.empty-state {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--soft);
  font-weight: 800;
}

.tara-widget {
  position: fixed;
  top: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  width: clamp(320px, 20vw, 420px);
  min-width: 320px;
  max-width: min(760px, calc(100vw - 36px));
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(93, 63, 211, 0.2);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(35, 26, 76, 0.2);
  transition: width 180ms ease, height 180ms ease, transform 180ms ease;
}

.tara-resize-handle {
  position: absolute;
  inset: 0 auto 0 -4px;
  z-index: 3;
  width: 10px;
  cursor: ew-resize;
}

.tara-resize-handle::after {
  position: absolute;
  top: 50%;
  left: 4px;
  width: 3px;
  height: 56px;
  border-radius: 999px;
  background: rgba(93, 63, 211, 0.28);
  content: "";
  transform: translateY(-50%);
}

.tara-widget.is-resizing {
  transition: none;
}

.tara-widget header {
  gap: 12px;
  padding: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--purple-dark), var(--violet));
  cursor: default;
  user-select: none;
}

.tara-widget header button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
}

.tara-widget header button:first-of-type {
  margin-left: 0;
}

.tara-widget header #minimize-tara {
  margin-left: auto;
}

.tara-widget header .tara-face {
  width: 50px;
  height: 50px;
  border: 0;
  border-radius: 50%;
  color: var(--purple-dark);
  background: #fff;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.tara-widget header span {
  display: block;
  color: rgba(255, 255, 255, 0.75);
  font-size: 12px;
}

.tara-body {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  flex: 1;
  min-height: 0;
}

.tara-widget.minimized .tara-body {
  display: none;
}

.tara-widget.minimized {
  top: auto;
  width: auto;
  min-width: 0;
  height: auto;
}

.tara-widget.minimized header {
  gap: 0;
  justify-content: center;
  padding: 8px;
  border-radius: 16px;
}

.tara-widget.minimized header > div {
  display: none;
}

.tara-widget.minimized .tara-resize-handle,
.tara-widget.minimized #minimize-tara {
  display: none;
}

.tara-widget.minimized .tara-face {
  width: 58px;
  height: 58px;
  padding: 0;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 900;
}

.tara-messages {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
  overflow: auto;
  overflow-x: hidden;
  background: #fbfbfe;
}

.message {
  max-width: 88%;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 6px 16px rgba(37, 32, 72, 0.06);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message.user {
  justify-self: end;
  color: #fff;
  background: var(--purple);
}

.tara-widget form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.tara-widget form button {
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: var(--purple);
  font-weight: 800;
}

/* v18: legacy narrow-screen block removed (replaced by the responsive layer at the end) */

@media all { /* v18: was min-width 761px */
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .shell {
    display: block;
    margin: 0;
    border-radius: 0;
  }

  .sidebar {
    position: fixed;
    top: 76px;
    left: 18px;
    right: auto;
    z-index: 30;
    display: flex;
    width: min(320px, calc(100vw - 36px));
    max-height: calc(100dvh - 104px);
    padding: 16px;
    overflow: auto;
    border-radius: 18px;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    box-shadow: 0 24px 70px rgba(31, 22, 65, 0.28);
    transform: translateY(-8px) scale(0.98);
    transition: opacity 130ms ease, transform 130ms ease, visibility 130ms ease;
  }

  .shell.mobile-nav-open .sidebar {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    visibility: visible;
  }

  .shell.mobile-nav-open::before {
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(20, 16, 43, 0.22);
    content: "";
  }

  .mobile-menu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .nav {
    display: grid;
    width: 100%;
    gap: 8px;
  }

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: start;
    width: 100%;
    min-height: 42px;
    padding: 11px 14px;
  }

  .nav-icon,
  .sidebar .brand,
  .sidebar-footer {
    display: none;
  }

  .nav-item span:last-child,
  .sidebar .primary-action {
    display: block;
  }

  .main {
    min-height: 100dvh;
    padding: 14px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    gap: 10px;
    margin: -14px -14px 14px;
    padding: 10px 14px 12px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  .menu-button {
    width: 18px;
    height: 18px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .menu-button span {
    width: 12px;
    height: 1.5px;
  }

  .topbar-tools {
    grid-column: 1 / -1;
    display: contents;
  }

  .profile-button {
    grid-column: 3;
    grid-row: 1;
    margin-left: auto;
    align-self: start;
    justify-self: end;
    padding: 6px 12px;
    border-radius: 999px;
    background: #f1efff;
    color: var(--purple-dark);
  }

  .profile-button .avatar,
  .profile-button small,
  .page-heading .eyebrow {
    display: none;
  }

  .profile-button strong {
    text-transform: lowercase;
    font-size: 13px;
    line-height: 1;
  }

  .search {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    max-width: none;
    margin-top: 8px;
  }

  .search input {
    width: 100%;
    min-height: 42px;
    border-radius: 14px;
  }

  .metric-grid,
  .metric-grid.compact,
  .overview-main-grid,
  .dashboard-grid,
  .dashboard-extra-grid,
  .kanban,
  .form-builder,
  .field-grid,
  .drawer-list,
  .newsletter-layout,
  .newsletter-layout .wide {
    grid-template-columns: 1fr;
  }

  .view {
    gap: 10px;
  }

  #view-overview [data-dashboard-topic] {
    display: none;
  }

  #view-overview [data-dashboard-topic].dashboard-topic-visible {
    display: block;
  }

  #view-overview [data-dashboard-topic]:not(.dashboard-topic-open) > :not(.dashboard-topic-summary) {
    display: none !important;
  }

  .dashboard-topic-summary {
    display: flex;
    width: 100%;
    min-height: 42px;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    border: 0;
    color: var(--ink);
    background: transparent;
    text-align: left;
    font-size: 15px;
    font-weight: 900;
  }

  .dashboard-topic-summary::after {
    content: "v";
    display: grid;
    width: 44px;
    height: 26px;
    place-items: center;
    border-radius: 999px;
    color: var(--purple);
    background: color-mix(in srgb, var(--purple) 10%, #fff);
    font-size: 16px;
    line-height: 1;
  }

  .dashboard-topic-open .dashboard-topic-summary::after {
    content: "^";
  }

  .panel {
    padding: 12px;
    border-radius: 12px;
    min-height: 0;
  }

  .panel-header,
  .section-head {
    margin-bottom: 8px;
  }

  #view-overview .dashboard-duplicate-header,
  #view-overview .dashboard-inner-title,
  .panel-header .eyebrow,
  .section-head p,
  .chart-axis-note,
  [data-tooltip]::after {
    display: none !important;
  }

  .payment-pie-wrap {
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 10px;
  }

  .newsletter-layout {
    gap: 10px;
  }

  .newsletter-contact-list,
  .newsletter-groups,
  .newsletter-history-list {
    max-height: 300px;
  }
}

/* v18: legacy narrow-screen block removed (replaced by the responsive layer at the end) */

@media all { /* v18: was min-width 761px */
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .main {
    max-width: 1180px;
    margin: 0 auto;
  }

  .view {
    max-width: 100%;
    gap: 10px;
  }

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

  .section-head p,
  .panel-header .eyebrow,
  .chart-axis-note,
  .metric-expand,
  [data-tooltip]::after {
    display: none !important;
  }

  .panel {
    padding: 14px;
    border-radius: 12px;
    min-height: 0;
  }

  .overview-main-grid,
  .dashboard-grid,
  .dashboard-extra-grid,
  .kanban,
  .form-builder,
  .field-grid,
  .drawer-list,
  .newsletter-layout,
  .newsletter-layout .wide {
    grid-template-columns: 1fr;
  }

  #view-overview .overview-main-grid,
  #view-overview .secondary-dashboard-grid,
  #view-overview .dashboard-extra-grid {
    display: grid;
    gap: 10px;
  }

  #view-overview [data-dashboard-topic] {
    display: none;
  }

  #view-overview [data-dashboard-topic].dashboard-topic-visible {
    display: block;
  }

  #view-overview [data-dashboard-topic]:not(.dashboard-topic-open) > :not(.dashboard-topic-summary) {
    display: none !important;
  }

  .dashboard-topic-summary {
    display: flex;
    width: 100%;
    min-height: 42px;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    border: 0;
    color: var(--ink);
    background: transparent;
    text-align: left;
    font-size: 15px;
    font-weight: 900;
  }

  .dashboard-topic-summary::after {
    content: "v";
    display: grid;
    width: 52px;
    height: 28px;
    place-items: center;
    border-radius: 999px;
    color: var(--purple);
    background: color-mix(in srgb, var(--purple) 10%, #fff);
    font-size: 16px;
    line-height: 1;
  }

  .dashboard-topic-open .dashboard-topic-summary::after {
    content: "^";
  }

  #view-overview .dashboard-duplicate-header,
  #view-overview .dashboard-inner-title,
  .em-panel [data-left-view-filters="overview"],
  #view-payments [data-left-view-filters],
  #view-contacts .section-head,
  #view-contacts [data-left-view-filters],
  #view-contacts .panel-header,
  #view-webinar .section-head,
  #view-webinar [data-left-view-filters],
  #view-webinar .panel-header,
  .webinar-table thead {
    display: none;
  }

  .em-panel,
  .payment-pie-panel {
    min-height: 0 !important;
  }

  .em-panel .bar-chart,
  .bar-chart {
    min-height: 160px;
  }

  .date-chart {
    min-height: 150px;
    max-height: 180px;
  }

  .payment-pie-wrap {
    grid-template-columns: 128px minmax(0, 1fr);
    align-items: center;
    justify-items: stretch;
    gap: 12px;
  }

  .payment-pie {
    width: 124px;
    box-shadow:
      inset 0 0 0 10px rgba(255, 255, 255, 0.72),
      0 18px 36px rgba(37, 32, 72, 0.12);
  }

  .payment-pie::before {
    inset: 18px;
  }

  .payment-pie span {
    width: 52px;
    height: 52px;
    font-size: 19px;
  }

  .payment-pie-legend {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .payment-pie-legend button {
    min-height: 28px;
    padding: 0 8px;
    border-radius: 8px;
    font-size: 12px;
  }

  .payment-table-controls {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(120px, 0.7fr) minmax(140px, 0.8fr);
    gap: 8px;
    margin-bottom: 8px;
  }

  .payment-table-controls label,
  .contact-table-controls label {
    display: grid;
    gap: 0;
    min-width: 0;
    font-size: 0;
  }

  .payment-table-controls label span,
  .contact-table-controls label span {
    display: none;
  }

  .payment-table-controls input,
  .payment-table-controls select,
  .contact-table-controls input,
  .contact-table-controls select {
    min-height: 34px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
  }

  .kanban {
    display: block;
    gap: 0;
  }

  .kanban-column {
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .kanban-column h3 {
    margin: 12px 0 8px;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0;
    text-transform: uppercase;
  }

  .payment-table-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 90px 110px;
    gap: 8px;
    padding: 0 0 7px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }

  .payment-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 90px 110px;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 0;
    margin: 0;
    padding: 10px 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    text-align: left;
  }

  .payment-card p {
    display: none;
  }

  .payment-card strong,
  .payment-card .amount,
  .payment-date {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .payment-card .tag {
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 9px;
    justify-content: center;
    white-space: nowrap;
  }

  .payment-card .amount {
    margin-left: 0;
    color: var(--payment-status-color, var(--ink));
    font-size: 12px;
    text-align: left;
  }

  .payment-date {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-align: right;
  }

  .contact-table-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(150px, 0.5fr);
    gap: 8px;
    margin-bottom: 8px;
  }

  .table-wrap {
    overflow-x: hidden;
  }

  .contacts-table {
    display: table;
    width: 100%;
    table-layout: fixed;
  }

  #contacts-table {
    display: table-row-group;
    width: 100%;
  }

  .contacts-table thead {
    display: table-header-group;
  }

  .contacts-table th {
    display: none;
    padding: 0 0 7px;
    border-bottom: 1px solid var(--line);
    font-size: 11px;
  }

  .contacts-table th:nth-child(1),
  .contacts-table th:nth-child(2) {
    display: table-cell;
  }

  #contacts-table tr {
    display: table-row;
    cursor: pointer;
  }

  #contacts-table td {
    display: none;
    min-width: 0;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #contacts-table td:nth-child(1),
  #contacts-table td:nth-child(2) {
    display: table-cell;
  }

  #contacts-table td:nth-child(1) {
    width: 52%;
    font-weight: 900;
  }

  .contacts-table th:nth-child(1) {
    width: 52%;
  }

  #contacts-table td:nth-child(2) {
    width: 48%;
    color: var(--muted);
    font-size: 12px;
    text-align: right;
  }

  .contacts-table th:nth-child(2) {
    width: 48%;
    text-align: right;
  }

  .newsletter-layout,
  .newsletter-layout .wide,
  .field-grid {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    min-width: 0;
  }

  .newsletter-layout {
    gap: 10px;
  }

  .newsletter-contact-list,
  .newsletter-groups,
  .newsletter-history-list {
    max-height: 300px;
  }

  .dashboard-calendar-grid,
  .calendar-grid {
    gap: 4px;
  }

  .dashboard-calendar-day,
  .calendar-day,
  .calendar-head {
    min-height: 0;
    aspect-ratio: 1;
    padding: 4px;
    border-radius: 8px;
  }

  #view-overview.active {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(0, calc((100dvh - 92px) / 2));
    gap: 12px;
    align-content: start;
    min-height: 0;
    padding: 10px 12px 14px;
    overflow-y: auto;
  }

  #view-overview > section {
    display: contents !important;
  }

  #view-overview .overview-main-grid,
  #view-overview .secondary-dashboard-grid,
  #view-overview .dashboard-extra-grid {
    display: contents !important;
  }

  #view-overview [data-dashboard-topic].dashboard-topic-visible {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    grid-column: auto !important;
    min-height: 0;
    padding: 12px;
    overflow: hidden;
  }

  #view-overview [data-dashboard-topic].wide.dashboard-topic-visible {
    grid-column: auto !important;
  }

  #view-overview [data-dashboard-topic].dashboard-topic-open {
    min-height: 0;
  }

  #view-overview [data-dashboard-topic].dashboard-topic-open > :not(.dashboard-topic-summary) {
    min-height: 0;
    overflow: hidden;
  }

  #view-overview [data-dashboard-topic]:not(.dashboard-topic-open) {
    grid-auto-rows: auto;
    align-self: start;
  }

  .dashboard-topic-summary::after,
  .dashboard-topic-open .dashboard-topic-summary::after {
    content: "v";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 52px;
    height: 28px;
    border-radius: 999px;
    background: var(--purple-soft);
    color: var(--purple);
    font-weight: 950;
  }

  .dashboard-topic-open .dashboard-topic-summary::after {
    transform: rotate(180deg);
  }

  .dashboard-calendar {
    gap: 6px;
  }

  .dashboard-calendar-title {
    padding: 8px 10px;
  }

  .dashboard-calendar-title strong {
    font-size: 14px;
  }

  .dashboard-calendar-title span,
  .dashboard-calendar-legend {
    display: none;
  }

  .dashboard-calendar-grid {
    gap: 0;
  }

  .dashboard-calendar-head {
    min-height: 22px;
    font-size: 9px;
  }

  .dashboard-calendar-day {
    padding: 4px;
  }

  .dashboard-calendar-day > strong {
    margin-bottom: 2px;
    font-size: 11px;
  }

  .dashboard-calendar-day small {
    display: none;
  }

  .dashboard-day-count {
    top: 3px;
    right: 3px;
    min-width: 16px;
    height: 16px;
    font-size: 8px;
  }

  .payment-table-head,
  .payment-card {
    grid-template-columns: var(--table-columns, minmax(0, 1fr) 96px 96px);
  }

  .payment-table-panel {
    overflow: hidden;
  }

  .payment-list {
    max-height: none;
    overflow: auto;
  }

  .payment-table-head {
    gap: 8px;
    padding: 7px 10px;
  }

  .payment-card {
    gap: 8px;
    min-height: 34px;
    padding: 8px 10px;
    border: 0;
    border-radius: 999px;
  }

  .payment-card strong,
  .payment-card p,
  .payment-card .amount,
  .payment-date {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .contacts-table th,
  #contacts-table td {
    display: table-cell;
  }

  #contacts-table td {
    padding-right: 12px;
  }

  .contacts-table th:last-child,
  #contacts-table td:last-child {
    padding-right: 0;
    text-align: right;
  }

  .dashboard-topic-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .dashboard-topic-picker strong {
    grid-column: 1 / -1;
  }

  .dashboard-topic-picker label {
    min-height: 52px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
  }

  .dashboard-topic-picker input {
    width: 28px;
    height: 28px;
    min-height: 0;
    accent-color: var(--purple);
  }

  .column-topic-picker {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .column-topic-picker strong {
    grid-column: 1 / -1;
  }
}

.column-menu .column-topic-picker label span {
  display: block !important;
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: none;
}

.column-menu .column-topic-picker label .column-order-actions {
  display: inline-flex !important;
}

#payments-column-menu .column-topic-picker,
#contacts-column-menu .column-topic-picker {
  grid-template-columns: 1fr !important;
}

#payments-column-menu .column-topic-picker strong,
#contacts-column-menu .column-topic-picker strong {
  grid-column: auto !important;
}

#payments-column-menu .column-topic-picker label,
#contacts-column-menu .column-topic-picker label {
  grid-template-columns: 34px minmax(180px, 1fr) auto !important;
  width: 100%;
  column-gap: 12px !important;
}

#payments-column-menu .column-topic-picker input,
#contacts-column-menu .column-topic-picker input {
  width: 22px !important;
  height: 22px !important;
  min-height: 0 !important;
  justify-self: start;
}

.dashboard-command-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 14px 34px rgba(37, 32, 72, 0.06);
}

.dashboard-command-bar strong {
  display: block;
  color: var(--ink);
  font-size: 18px;
  font-weight: 950;
}

.dashboard-period-control {
  display: grid;
  min-width: 180px;
  gap: 5px;
}

.dashboard-period-control span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.market-dashboard-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
}

.market-dashboard-grid .panel {
  min-height: 0;
  padding: 16px;
  overflow: hidden;
}

.health-list,
.integration-grid {
  display: grid;
  gap: 9px;
}

.health-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  padding: 9px 10px;
  border: 0;
  border-radius: 12px;
  color: var(--ink);
  background: var(--soft);
  text-align: left;
  cursor: pointer;
}

.health-row strong,
.integration-card strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.health-row small,
.integration-card span,
.chart-caption,
.integration-hint {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.35;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 5px 8px;
  border-radius: 999px;
  color: #fff;
  background: var(--purple);
  font-size: 10px;
  font-weight: 950;
}

.status-pill.ready {
  background: var(--green);
}

.status-pill.watch,
.status-pill.open {
  color: #251700;
  background: var(--gold);
}

.status-pill.later {
  background: #778091;
}

.status-pill.issue {
  background: var(--red);
}

.dashboard-stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.dashboard-stat-row.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-stat-row div {
  min-width: 0;
  padding: 10px 8px;
  border-radius: 12px;
  background: var(--soft);
}

.dashboard-stat-row strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: clamp(18px, 2.2vw, 30px);
  font-weight: 950;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-stat-row span {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-line-chart {
  display: block;
  width: 100%;
  height: 118px;
}

.mini-line-chart polygon {
  fill: color-mix(in srgb, var(--chart-color) 22%, transparent);
}

.mini-line-chart polyline {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dashboard-mini-bars {
  display: flex;
  align-items: end;
  gap: 4px;
  height: 118px;
  padding: 10px 8px;
  border-radius: 12px;
  background: var(--soft);
}

.dashboard-mini-bars i {
  flex: 1 1 4px;
  min-width: 3px;
  border-radius: 999px 999px 3px 3px;
  opacity: 0.9;
}

.integration-hint {
  margin: 0 0 10px;
}

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

.integration-card {
  display: grid;
  min-width: 0;
  gap: 7px;
  padding: 10px;
  border-radius: 12px;
  background: var(--soft);
}

body.dark-mode .dashboard-command-bar,
body.dark-mode .health-row,
body.dark-mode .dashboard-stat-row div,
body.dark-mode .dashboard-mini-bars,
body.dark-mode .integration-card,
body.dark-mode .payment-pie span,
body.dark-mode .payment-pie::before {
  background: #211b31;
}

body.dark-mode .payment-pie {
  background:
    radial-gradient(circle, #181424 0 48%, transparent 49%),
    conic-gradient(var(--segments));
}

body.dark-mode .mini-line-chart polygon {
  opacity: 0.7;
}

@media (max-width: 1200px) {
  .market-dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* v18: legacy narrow-screen block removed (replaced by the responsive layer at the end) */

/* Command-center redesign: final overrides for the live CRM board. */
@media all { /* v18: was min-width 761px */
  body.dark-mode {
    --ink: #f7f3ff;
    --muted: #b9b1cc;
    --line: rgba(157, 130, 255, 0.18);
    --surface: #161020;
    --soft: #21182f;
    --shadow: 0 24px 70px rgba(5, 2, 16, 0.35);
    background: #100c19;
  }

  body.dark-mode .main,
  body.dark-mode .view,
  body.dark-mode .shell {
    background: #100c19;
  }

  body.dark-mode .topbar {
    border-bottom: 1px solid rgba(157, 130, 255, 0.12);
    background: #262130;
  }

  body.dark-mode .panel,
  body.dark-mode .drawer-card,
  body.dark-mode .detail-card,
  body.dark-mode .advanced-settings,
  body.dark-mode .newsletter-layout,
  body.dark-mode .table-wrap,
  body.dark-mode .kanban-column,
  body.dark-mode .payment-table-panel,
  body.dark-mode .stripe-panel,
  body.dark-mode .calendar-card,
  body.dark-mode .calendar-grid,
  body.dark-mode .webinar-room-preview > div,
  body.dark-mode .preview-panel,
  body.dark-mode .newsletter-file-preview,
  body.dark-mode .newsletter-send-log,
  body.dark-mode .users-table,
  body.dark-mode .profile-settings,
  body.dark-mode .login-card {
    border-color: rgba(157, 130, 255, 0.16);
    color: var(--ink);
    background: #161020;
    box-shadow: 0 22px 58px rgba(4, 1, 12, 0.28);
  }

  body.dark-mode input,
  body.dark-mode select,
  body.dark-mode textarea,
  body.dark-mode .search input,
  body.dark-mode .filter-bar label,
  body.dark-mode .dropdown-filter-bar label,
  body.dark-mode .field-grid label,
  body.dark-mode .payment-table-controls label,
  body.dark-mode .contact-table-controls label,
  body.dark-mode .profile-settings label,
  body.dark-mode .dashboard-topic-picker label,
  body.dark-mode .column-menu .dashboard-topic-picker label {
    border-color: rgba(157, 130, 255, 0.18);
    color: var(--ink);
    background: #21182f;
  }

  body.dark-mode input::placeholder,
  body.dark-mode textarea::placeholder {
    color: #8f86a6;
  }

  body.dark-mode .section-head h2,
  body.dark-mode .panel h2,
  body.dark-mode .panel-header h2,
  body.dark-mode .payment-card strong,
  body.dark-mode .contacts-table th,
  body.dark-mode #contacts-table td,
  body.dark-mode .webinar-table th,
  body.dark-mode .webinar-table td,
  body.dark-mode .dashboard-topic-picker span,
  body.dark-mode .column-menu .column-topic-picker label span {
    color: var(--ink);
  }

  body.dark-mode .section-head {
    color: var(--ink);
    background: transparent;
  }

  body.dark-mode .contacts-table,
  body.dark-mode .webinar-table {
    background: transparent;
  }

  body.dark-mode #contacts-table tr,
  body.dark-mode .webinar-table tbody tr,
  body.dark-mode .payment-card {
    border: 0;
    color: var(--ink);
    background: #161020;
  }

  body.dark-mode .payment-table-head,
  body.dark-mode .tag,
  body.dark-mode .ghost-button,
  body.dark-mode .dashboard-shortcut,
  body.dark-mode .newsletter-group,
  body.dark-mode .newsletter-contact,
  body.dark-mode .newsletter-history-item,
  body.dark-mode .dashboard-calendar-title,
  body.dark-mode .dashboard-calendar-day,
  body.dark-mode .calendar-day,
  body.dark-mode .calendar-head,
  body.dark-mode .dashboard-reply-controls label,
  body.dark-mode .dashboard-reply-detail,
  body.dark-mode .dashboard-reply-entry {
    border-color: rgba(157, 130, 255, 0.16);
    color: var(--ink);
    background: #21182f;
  }

  body.dark-mode .dashboard-calendar-day.muted,
  body.dark-mode .calendar-day.muted {
    background: rgba(33, 24, 47, 0.45);
  }

  body.dark-mode .dashboard-calendar-day.has-appointments,
  body.dark-mode .calendar-day.has-slots {
    background: #24183a;
  }

  body.dark-mode .dashboard-topic-picker label,
  body.dark-mode .profile-settings .dashboard-topic-picker label {
    background: #21182f !important;
  }

  body.dark-mode .dashboard-topic-picker input {
    accent-color: #7f5dff;
  }

  #view-overview.active {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-auto-rows: 118px;
    gap: 14px;
    padding: 14px;
  }

  #view-overview > .dashboard-command-bar {
    display: grid;
    grid-column: span 3;
    grid-row: span 2;
    align-content: end;
    min-height: 0;
    margin: 0;
    padding: 18px;
    border-radius: 18px;
    background: var(--surface);
  }

  #view-overview > .dashboard-command-bar strong {
    max-width: 11ch;
    font-size: 28px;
    line-height: 1;
    text-wrap: balance;
  }

  .dashboard-period-control {
    min-width: 0;
    margin-top: 16px;
  }

  #view-overview [data-dashboard-topic].dashboard-topic-visible {
    border-radius: 18px;
    padding: 14px;
    background: var(--surface);
  }

  #view-overview [data-dashboard-topic="health"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="revenue"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="visitors"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="integrations"].dashboard-topic-visible {
    grid-column: span 3 !important;
    grid-row: span 2;
  }

  #view-overview [data-dashboard-topic="email"].dashboard-topic-visible {
    grid-column: span 6 !important;
    grid-row: span 3;
  }

  #view-overview [data-dashboard-topic="payments"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="calendar"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="replies"].dashboard-topic-visible {
    grid-column: span 4 !important;
    grid-row: span 3;
    min-width: 0;
  }

  #view-overview [data-dashboard-topic="replies"].dashboard-topic-visible {
    min-width: 260px;
  }

  #view-overview [data-dashboard-topic="contacts"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="webinar"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="forms"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="newsletter"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="settings"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="users"].dashboard-topic-visible {
    grid-column: span 2 !important;
    grid-row: span 1;
  }

  .dashboard-topic-summary {
    min-height: 28px;
    margin-bottom: 8px;
    padding: 0;
    color: var(--ink);
    background: transparent;
    font-size: 15px;
  }

  .dashboard-topic-summary::after,
  .dashboard-topic-open .dashboard-topic-summary::after {
    width: 34px;
    height: 22px;
    background: rgba(108, 76, 255, 0.16);
    color: #7d5cff;
  }

  .health-list {
    gap: 7px;
  }

  .health-row {
    min-height: 39px;
    padding: 7px 10px;
    border-radius: 11px;
  }

  .health-row strong,
  .integration-card strong {
    font-size: 11px;
  }

  .health-row small,
  .integration-card span,
  .integration-hint,
  .chart-caption {
    font-size: 10px;
  }

  .ping-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    padding: 7px 9px;
    border-radius: 999px;
    color: var(--muted);
    background: var(--soft);
    font-size: 10px;
    font-weight: 900;
  }

  .ping-strip strong {
    color: var(--ink);
    font-size: 10px;
  }

  .dashboard-stat-row {
    gap: 7px;
  }

  .dashboard-stat-row div {
    padding: 8px;
    border-radius: 12px;
  }

  .dashboard-stat-row strong {
    font-size: 27px;
  }

  .mini-line-chart,
  .dashboard-mini-bars {
    height: 92px;
  }

  .integration-grid {
    gap: 7px;
  }

  .integration-card {
    padding: 8px;
    border-radius: 11px;
  }

  .em-panel .bar-chart {
    min-height: 0;
    height: 100%;
  }

  .date-chart {
    height: 100%;
  }

  .payment-pie {
    width: min(190px, 75%);
  }

  .payment-pie span {
    width: 78px;
    height: 78px;
    font-size: 25px;
  }

  .payment-pie-legend {
    gap: 7px;
  }

  .payment-pie-legend button {
    min-height: 34px;
    border-radius: 999px;
  }

  .dashboard-calendar-grid {
    gap: 2px;
  }

  .dashboard-calendar-day {
    min-height: 0;
    padding: 3px;
    border-radius: 7px;
  }
}

/* One-board analytics view requested for the live laptop CRM. */
.quick-ui-toggles {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quick-icon-button {
  display: grid;
  min-width: 42px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: var(--purple-dark);
  background: #f0ecff;
  font-weight: 950;
  box-shadow: inset 0 0 0 1px rgba(93, 63, 211, 0.08);
  transition: transform 160ms ease, background 160ms ease;
}

.quick-icon-button:hover {
  transform: translateY(-1px);
  background: #e6dfff;
}

body.dark-mode .quick-icon-button {
  color: #f7f3ff;
  background: #241a38;
  box-shadow: inset 0 0 0 1px rgba(157, 130, 255, 0.18);
}

.board-module-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.board-module-toolbar strong {
  color: var(--ink);
  font-size: clamp(26px, 2.7vw, 44px);
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}

.board-module-toolbar label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.board-module-toolbar select {
  max-width: 170px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 26px 8px 11px;
  color: var(--ink);
  background: var(--soft);
  font-weight: 900;
}

.board-line-chart {
  width: 100%;
  height: 170px;
  min-height: 130px;
  overflow: visible;
}

.board-line-chart line {
  stroke: rgba(119, 119, 137, 0.22);
  stroke-width: 1;
}

.board-line-chart polyline {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 8px 12px rgba(23, 168, 113, 0.12));
}

.board-line-chart text {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.system-orb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 12px;
}

.system-orb {
  display: grid;
  gap: 7px;
  justify-items: center;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: center;
}

.system-orb-circle {
  position: relative;
  display: grid;
  width: clamp(52px, 4.6vw, 72px);
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(from 210deg, #12c885, #17a871, #0f7d59, #12c885);
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.09), 0 0 0 8px rgba(23, 168, 113, 0.1), 0 18px 30px rgba(23, 168, 113, 0.18);
}

.system-orb-circle i {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 0 0 9px rgba(255, 255, 255, 0.1);
}

.system-orb strong {
  max-width: 100%;
  font-size: 11px;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.system-orb small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.system-orb.watch .system-orb-circle,
.system-orb.open .system-orb-circle {
  background: conic-gradient(from 210deg, #ffc44d, #f4ad22, #b9790c, #ffc44d);
  box-shadow: 0 0 0 7px rgba(244, 173, 34, 0.1), 0 18px 30px rgba(244, 173, 34, 0.16);
}

.system-orb.issue .system-orb-circle,
.payment-health-pill.issue i {
  background: conic-gradient(from 210deg, #ff6f78, #df4d55, #9e2430, #ff6f78);
  animation: criticalPulse 2.2s ease-in-out infinite;
}

@keyframes criticalPulse {
  0%,
  100% {
    box-shadow: 0 0 0 6px rgba(223, 77, 85, 0.08), 0 18px 30px rgba(223, 77, 85, 0.12);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(223, 77, 85, 0.24), 0 22px 38px rgba(223, 77, 85, 0.32);
  }
}

.payment-graph-panel {
  margin-bottom: 14px;
}

.payment-health-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 9px 12px;
  color: var(--ink);
  background: var(--soft);
  font-size: 12px;
  font-weight: 950;
}

.payment-health-pill i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green);
}

.payment-health-pill.ready i {
  box-shadow: 0 0 0 6px rgba(23, 168, 113, 0.1);
}

.dashboard-settings-dots {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #f7f3ff;
  background: rgba(108, 76, 255, 0.24);
  font-size: 20px;
  font-weight: 950;
  line-height: 1;
}

.dashboard-module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.dashboard-module-title {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: clamp(17px, 1.4vw, 24px);
  line-height: 1.05;
  font-weight: 950;
}

.dashboard-module-head .dashboard-module-title {
  margin-bottom: 0;
}

.dashboard-inline-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  white-space: nowrap;
}

.dashboard-inline-filter select {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 26px 8px 10px;
  color: var(--ink);
  background: var(--soft);
  font-weight: 900;
}

.payment-pie-stat {
  display: grid;
  gap: 0;
  justify-items: start;
}

.payment-pie-stat strong {
  color: var(--ink);
  font-size: clamp(36px, 4vw, 58px);
  line-height: 0.88;
  font-variant-numeric: tabular-nums;
}

.payment-pie-stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.payment-pizza {
  position: relative;
  width: min(170px, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--segments));
  box-shadow: 0 18px 40px rgba(5, 2, 16, 0.24);
}

.payment-pizza span {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  color: #161020;
  background: rgba(255, 255, 255, 0.86);
  font-size: 24px;
  font-weight: 950;
}

@media all { /* v18: was min-width 761px */
  #view-overview.active {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-auto-rows: 92px;
    gap: 12px;
    min-height: calc(100vh - 112px);
    margin: 0;
    padding: 18px;
    border: 1px solid rgba(93, 63, 211, 0.16);
    border-radius: 28px;
    background:
      radial-gradient(circle at 22% 0%, rgba(93, 63, 211, 0.12), transparent 32rem),
      var(--surface);
    box-shadow: 0 30px 80px rgba(35, 26, 76, 0.12);
  }

  body.dark-mode #view-overview.active {
    border-color: rgba(157, 130, 255, 0.2);
    background:
      radial-gradient(circle at 20% 0%, rgba(127, 93, 255, 0.18), transparent 31rem),
      #100c19;
    box-shadow: 0 30px 90px rgba(4, 1, 12, 0.36);
  }

  #view-overview > .dashboard-command-bar {
    grid-column: 12 / -1 !important;
    grid-row: 1 !important;
    align-self: start;
    justify-self: end;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  #view-overview > .dashboard-grid,
  #view-overview > .overview-main-grid,
  #view-overview > .dashboard-extra-grid {
    display: contents;
  }

  #view-overview [data-dashboard-topic].dashboard-topic-visible {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    border: 1px solid rgba(93, 63, 211, 0.12);
    border-radius: 22px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.74);
    box-shadow: none;
  }

  body.dark-mode #view-overview [data-dashboard-topic].dashboard-topic-visible {
    border-color: rgba(157, 130, 255, 0.22);
    background: #161020;
  }

  #view-overview [data-dashboard-topic="health"].dashboard-topic-visible {
    grid-column: 1 / span 8 !important;
    grid-row: 1 / span 3;
  }

  #view-overview [data-dashboard-topic="revenue"].dashboard-topic-visible {
    grid-column: 9 / span 4 !important;
    grid-row: 1 / span 3;
  }

  #view-overview [data-dashboard-topic="visitors"].dashboard-topic-visible {
    grid-column: 9 / span 4 !important;
    grid-row: 4 / span 2;
  }

  #view-overview [data-dashboard-topic="email"].dashboard-topic-visible {
    grid-column: 1 / span 8 !important;
    grid-row: 4 / span 4;
  }

  #view-overview [data-dashboard-topic="payments"].dashboard-topic-visible {
    grid-column: 9 / span 4 !important;
    grid-row: 6 / span 3;
  }

  #view-overview [data-dashboard-topic="calendar"].dashboard-topic-visible {
    grid-column: 9 / span 4 !important;
    grid-row: 9 / span 4;
  }

  #view-overview .dashboard-replies-panel,
  #view-overview .dashboard-integrations-panel {
    display: none !important;
  }

  #view-overview [data-dashboard-topic="contacts"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="webinar"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="forms"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="newsletter"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="settings"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="users"].dashboard-topic-visible {
    grid-column: span 2 !important;
    grid-row: span 1;
    justify-content: center;
  }

  .dashboard-reply-controls {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .dashboard-reply-detail {
    padding: 10px;
  }

  .dashboard-reply-entry {
    min-height: 38px;
    margin-top: 8px;
    border-radius: 14px;
  }

  .payment-pie-wrap {
    display: grid;
    grid-template-columns: 0.6fr 1fr;
    align-items: center;
    gap: 12px;
  }

  .payment-pie {
    width: min(158px, 100%);
  }

  .payment-pie-legend button {
    color: var(--ink);
    background: var(--soft);
  }

  .dashboard-calendar-panel .panel-header {
    margin: 0 0 8px;
  }

  .dashboard-calendar {
    min-height: 0;
  }

  .dashboard-calendar-grid {
    height: 100%;
  }

  .dashboard-calendar-day {
    aspect-ratio: auto;
    min-height: 41px;
    overflow: hidden;
  }

  body.dark-mode .payment-graph-panel,
  body.dark-mode .payment-table-panel,
  body.dark-mode .payment-card,
  body.dark-mode .payment-table-head,
  body.dark-mode .payment-table-controls label,
  body.dark-mode .payment-health-pill {
    color: var(--ink);
    background: #161020;
    border-color: rgba(157, 130, 255, 0.2);
  }

  body.dark-mode .payment-card,
  body.dark-mode .payment-table-head {
    background: #21182f;
  }
}

/* Final laptop board pass: permanent left pane, dense packing, plain status circles. */
@media all { /* v18: was min-width 761px */
  .shell,
  .shell.sidebar-collapsed {
    display: grid !important;
    grid-template-columns: 232px minmax(0, 1fr) !important;
    min-height: 100vh;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: #101827;
    box-shadow: none;
  }

  .sidebar,
  .shell.sidebar-collapsed .sidebar {
    position: relative;
    display: flex !important;
    grid-column: 1 / 2 !important;
    grid-row: 1 !important;
    width: auto !important;
    min-width: 0;
    max-width: none;
    height: auto;
    inset: auto !important;
    top: 0 !important;
    left: auto !important;
    right: auto !important;
    padding: 20px 14px !important;
    overflow: visible;
    border: 0;
    border-right: 1px solid rgba(214, 226, 242, 0.08);
    border-radius: 0;
    color: #dce5f3;
    background: #182433 !important;
    box-shadow: none;
    transform: none !important;
  }

  .mobile-menu-head,
  .menu-button,
  .shell.mobile-nav-open::before {
    display: none !important;
  }

  .sidebar .brand {
    margin-bottom: 10px;
  }

  .sidebar .brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    color: #182433;
    background: #e8eef8;
    font-size: 14px;
  }

  .sidebar .primary-action {
    min-height: 40px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #f7f9ff;
    background: rgba(255, 255, 255, 0.08);
    text-align: left;
  }

  .nav {
    gap: 4px;
  }

  .nav-item {
    grid-template-columns: 1fr;
    min-height: 38px;
    padding: 9px 11px;
    border-radius: 8px;
    color: rgba(225, 233, 246, 0.72);
    background: transparent;
    font-size: 13px;
  }

  .nav-icon {
    display: none;
  }

  .nav-item.active,
  .nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
  }

  .sidebar-footer {
    padding: 12px;
    color: #dce5f3;
    background: rgba(255, 255, 255, 0.07);
  }

  .main {
    grid-column: 2 / 3 !important;
    grid-row: 1 !important;
    margin-left: 0 !important;
    padding: 18px 20px 24px;
    background: #f7f8fb;
  }

  body.dark-mode .main {
    background: #0f0b18;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr);
    margin-bottom: 12px;
  }

  .topbar-tools {
    justify-content: end;
  }

  #view-overview.active {
    grid-auto-flow: dense;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-auto-rows: minmax(78px, auto);
    align-items: stretch;
    min-height: calc(100vh - 132px);
    gap: 12px;
    padding: 14px;
  }

  #view-overview [data-dashboard-topic].dashboard-topic-visible {
    grid-column: span 4 !important;
    grid-row: span 3 !important;
    min-height: 0;
  }

  #view-overview [data-dashboard-topic="health"].dashboard-topic-visible {
    grid-column: span 8 !important;
    grid-row: span 2 !important;
  }

  #view-overview [data-dashboard-topic="email"].dashboard-topic-visible {
    grid-column: span 8 !important;
    grid-row: span 6 !important;
  }

  #view-overview [data-dashboard-topic="payments"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="calendar"].dashboard-topic-visible {
    grid-column: span 4 !important;
    grid-row: span 4 !important;
  }

  #view-overview [data-dashboard-topic="contacts"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="webinar"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="forms"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="newsletter"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="settings"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="users"].dashboard-topic-visible {
    grid-column: span 3 !important;
    grid-row: span 2 !important;
  }

  .system-orb-grid {
    grid-template-columns: repeat(auto-fit, minmax(78px, 1fr));
    align-items: start;
  }

  .system-orb-circle,
  .system-orb.watch .system-orb-circle,
  .system-orb.open .system-orb-circle {
    width: 48px;
    background: #f4b223;
    box-shadow: none;
    border: 0;
  }

  .system-orb.ready .system-orb-circle {
    background: #18b97c;
  }

  .system-orb.issue .system-orb-circle {
    background: #e94f5a;
    box-shadow: none;
    animation: criticalFlatPulse 2.2s ease-in-out infinite;
  }

  .system-orb-circle i {
    display: none;
  }

  @keyframes criticalFlatPulse {
    0%,
    100% {
      opacity: 0.72;
      transform: scale(0.98);
    }
    50% {
      opacity: 1;
      transform: scale(1.05);
    }
  }

  .em-panel {
    overflow: hidden;
  }

  .em-panel .dashboard-module-head {
    flex: 0 0 auto;
    margin-bottom: 6px;
  }

  .em-panel .bar-chart,
  .em-panel .date-chart {
    display: block;
    flex: 1 1 auto;
    width: 100%;
    min-height: 320px;
    height: 100%;
  }

  .payment-pie-wrap {
    grid-template-columns: 0.82fr 1fr;
    gap: 14px;
    height: 100%;
  }

  .payment-total-grid {
    display: grid;
    gap: 8px;
    align-content: center;
  }

  .payment-total-grid button {
    display: grid;
    grid-template-columns: 11px minmax(34px, auto) minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 38px;
    border: 0;
    border-radius: 12px;
    padding: 8px 10px;
    color: var(--ink);
    background: var(--soft);
    text-align: left;
  }

  .payment-total-grid i {
    width: 11px;
    height: 11px;
    border-radius: 50%;
  }

  .payment-total-grid strong {
    font-size: 20px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
  }

  .payment-total-grid span {
    min-width: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .payment-pizza {
    width: min(220px, 100%);
    align-self: center;
    justify-self: center;
    box-shadow: none;
  }

  .payment-pizza span {
    display: none !important;
  }

  .payment-pie-legend {
    display: none;
  }
}

/* Final laptop v6 override: true end-of-file winner. */
@media all { /* v18: was min-width 761px */
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .shell,
  .shell.sidebar-collapsed {
    display: grid !important;
    grid-template-columns: 72px minmax(0, 1fr) !important;
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
  }

  .sidebar,
  .shell.sidebar-collapsed .sidebar {
    grid-column: 1 / 2 !important;
    grid-row: 1 !important;
    width: 72px !important;
    height: 100vh;
    padding: 14px 10px !important;
    gap: 10px;
    overflow: visible;
    background: #182433 !important;
    transition: width 180ms ease, box-shadow 180ms ease;
  }

  .sidebar .brand,
  .sidebar .primary-action,
  .sidebar-footer,
  .nav {
    display: none !important;
  }

  .mobile-menu-head {
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-height: 42px;
  }

  .mobile-menu-head strong,
  .mobile-menu-close {
    display: none;
  }

  .page-heading,
  .profile-button,
  .dashboard-command-bar,
  .dashboard-settings-dots,
  .shell.mobile-nav-open::before {
    display: none !important;
  }

  .menu-button {
    position: fixed;
    top: 18px;
    left: 18px;
    z-index: 85;
    display: grid !important;
    width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 8px;
    border: 0;
    border-radius: 12px;
    background: rgba(239, 236, 255, 0.96);
    box-shadow: 0 10px 28px rgba(16, 20, 35, 0.16);
  }

  .menu-button span {
    width: 100%;
    height: 2px;
    border-radius: 999px;
    background: #5d3fd3;
  }

  .shell.mobile-nav-open .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 84;
    width: 264px !important;
    padding: 18px 16px !important;
    overflow-y: auto;
    box-shadow: 24px 0 70px rgba(5, 6, 14, 0.38);
  }

  .shell.mobile-nav-open .mobile-menu-head {
    justify-content: space-between;
  }

  .shell.mobile-nav-open .mobile-menu-head strong,
  .shell.mobile-nav-open .mobile-menu-close {
    display: block;
  }

  .shell.mobile-nav-open .mobile-menu-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    color: #5d3fd3;
    background: #f4f1ff;
    font-size: 18px;
    font-weight: 950;
  }

  .shell.mobile-nav-open .sidebar .brand,
  .shell.mobile-nav-open .sidebar .primary-action,
  .shell.mobile-nav-open .sidebar-footer {
    display: flex !important;
  }

  .shell.mobile-nav-open .nav {
    display: grid !important;
  }

  .nav {
    gap: 6px;
    align-content: start;
    margin-top: 8px;
  }

  .nav-item {
    grid-template-columns: 28px 1fr;
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 10px;
    color: rgba(238, 244, 255, 0.82);
    font-size: 13px;
    font-weight: 800;
    text-align: left;
  }

  .nav-item.active,
  .nav-item:hover {
    color: #f8fbff;
    background: rgba(255, 255, 255, 0.1);
  }

  .nav-icon {
    display: block !important;
    width: 22px;
    color: rgba(238, 244, 255, 0.5);
    font-size: 10px;
  }

  .main {
    grid-column: 2 / 3 !important;
    grid-row: 1 !important;
    position: relative;
    width: 100% !important;
    max-width: none !important;
    height: 100vh;
    min-height: 0;
    margin: 0 !important;
    padding: 58px 14px 12px;
    overflow: auto;
    overscroll-behavior: contain;
  }

  .topbar {
    position: absolute;
    top: 12px;
    right: 18px;
    left: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-height: 34px;
    margin: 0;
    padding: 0;
    background: transparent !important;
  }

  .topbar-tools {
    grid-column: 1 / -1;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-height: 34px;
    flex-wrap: nowrap;
  }

  .quick-ui-toggles {
    order: 1;
    gap: 6px;
  }

  .quick-icon-button {
    width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    border-radius: 50%;
    font-size: 11px;
  }

  .search {
    order: 2;
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
    width: auto;
    max-width: 620px;
    position: relative;
  }

  .search::before {
    content: "⌕";
    position: absolute;
    right: 0;
    top: 0;
    z-index: 2;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    color: #5d3fd3;
    background: #efecff;
    font-size: 18px;
    font-weight: 950;
    pointer-events: none;
  }

  .search input {
    width: 34px;
    min-height: 34px;
    padding: 0 16px;
    border-radius: 999px;
    opacity: 0;
    color: var(--ink);
    background: #e8ebf2;
    transition: width 180ms ease, opacity 180ms ease, padding 180ms ease;
  }

  .search:focus-within input,
  .search input:not(:placeholder-shown) {
    width: min(560px, calc(100vw - 500px));
    padding: 8px 44px 8px 16px;
    opacity: 1;
  }

  .global-search-results {
    top: calc(100% + 8px);
    right: 0;
    width: min(560px, calc(100vw - 500px));
  }

  #view-overview.active {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: repeat(8, minmax(0, 1fr));
    grid-auto-flow: dense;
    grid-auto-rows: minmax(110px, 1fr);
    height: calc(100vh - 70px);
    min-height: 0;
    max-height: calc(100vh - 70px);
    gap: 6px;
    padding: 6px;
    overflow: hidden;
    border-radius: 18px;
  }

  .view.active:not(#view-overview) {
    height: calc(100vh - 70px);
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 28px;
  }

  #view-overview [data-dashboard-topic].dashboard-topic-visible {
    min-height: 0;
    padding: 11px 12px;
    border-radius: 16px;
    overflow: hidden;
  }

  #view-overview [data-dashboard-topic="health"].dashboard-topic-visible {
    grid-column: 1 / span 4 !important;
    grid-row: 1 / span 1 !important;
  }

  #view-overview [data-dashboard-topic="revenue"].dashboard-topic-visible {
    grid-column: 1 / span 4 !important;
    grid-row: 2 / span 3 !important;
  }

  #view-overview [data-dashboard-topic="visitors"].dashboard-topic-visible {
    grid-column: 5 / span 4 !important;
    grid-row: 1 / span 4 !important;
  }

  #view-overview [data-dashboard-topic="payments"].dashboard-topic-visible {
    grid-column: 9 / span 4 !important;
    grid-row: 1 / span 3 !important;
  }

  #view-overview [data-dashboard-topic="email"].dashboard-topic-visible {
    grid-column: 1 / span 8 !important;
    grid-row: 5 / span 4 !important;
  }

  #view-overview [data-dashboard-topic="calendar"].dashboard-topic-visible {
    grid-column: 9 / span 4 !important;
    grid-row: 4 / span 5 !important;
  }

  .dashboard-module-title {
    margin-bottom: 6px;
    font-size: clamp(15px, 1.1vw, 20px);
  }

  .em-panel .dashboard-module-title {
    font-size: clamp(16px, 1.15vw, 21px);
  }

  .system-orb-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
  }

  .system-orb {
    display: grid !important;
    grid-template-columns: 26px minmax(0, 1fr);
    align-items: center;
    justify-items: start;
    min-height: 46px;
    padding: 8px 9px;
    border-radius: 12px;
    background: rgba(245, 246, 251, 0.92);
    text-align: left;
  }

  .system-orb-circle,
  .system-orb.watch .system-orb-circle,
  .system-orb.open .system-orb-circle {
    width: 22px;
    height: 22px;
    box-shadow: none;
  }

  .system-orb-copy {
    display: grid;
    gap: 1px;
    min-width: 0;
  }

  .system-orb strong {
    max-width: 100%;
    color: var(--ink);
    font-size: 10px;
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .system-orb small {
    display: block;
    color: var(--muted);
    font-size: 9px;
    font-weight: 900;
    line-height: 1;
  }

  .ping-strip {
    display: none;
  }

  .board-line-chart {
    display: block;
    width: 100%;
    height: calc(100% - 24px);
    min-height: 120px;
  }

  .dashboard-mini-bars {
    position: relative;
    height: calc(100% - 24px);
    min-height: 145px;
  }

  .dashboard-chart-link {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    border: 0;
    color: inherit;
    background: transparent;
    text-align: inherit;
    cursor: pointer;
    border-radius: 12px;
  }

  .dashboard-chart-link:hover {
    background: rgba(93, 63, 211, 0.04);
  }

  .chart-shell {
    display: grid;
    grid-template-rows: 22px minmax(0, 1fr);
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  .chart-axis-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0;
  }

  .chart-tick {
    fill: var(--muted);
    font-size: 10px;
    font-weight: 800;
  }

  .chart-axis-label,
  .mini-axis {
    fill: var(--muted);
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
  }

  .mini-axis {
    position: absolute;
    pointer-events: none;
  }

  .mini-axis-x {
    right: 8px;
    bottom: 4px;
  }

  .mini-axis-y {
    top: 8px;
    left: 8px;
    transform: rotate(-90deg);
    transform-origin: left top;
  }

  .em-panel .bar-chart,
  .em-panel .date-chart {
    min-height: 0;
    height: 100%;
  }

  .em-panel .bar-chart {
    height: calc(100% - 26px);
    padding-top: 0;
  }

  .em-panel .chart-shell {
    grid-template-rows: 28px minmax(0, 1fr);
    height: 100%;
  }

  .em-panel .chart-axis-strip {
    padding: 0 2px;
    font-size: 12px;
  }

  .em-panel .email-chart-link {
    height: 100%;
    min-height: 0;
  }

  .em-panel .email-dashboard-chart {
    width: 100%;
    height: 100%;
    min-height: 250px;
  }

  .date-chart {
    width: 100%;
    height: 100%;
  }

  .payment-pie-wrap {
    grid-template-columns: 0.72fr 1fr;
    gap: 10px;
  }

  .payment-total-grid {
    gap: 6px;
  }

  .payment-total-grid button {
    min-height: 32px;
    padding: 6px 8px;
    border-radius: 10px;
  }

  .payment-pizza {
    width: min(190px, 100%);
  }

  .dashboard-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-auto-rows: minmax(44px, 1fr);
    height: calc(100% - 64px);
    gap: 5px;
    padding: 2px;
    border-radius: 14px;
    overflow: hidden;
  }

  .dashboard-calendar-day {
    min-height: 0;
    aspect-ratio: auto;
    padding: 7px 7px;
    border: 1px solid rgba(108, 91, 214, 0.14);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(247, 248, 252, 0.96);
    color: var(--ink);
    cursor: pointer;
    text-align: left;
    transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
  }

  .dashboard-calendar-day:hover,
  .dashboard-calendar-day:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(93, 63, 211, 0.4);
    background: #ffffff;
    outline: none;
  }

  .dashboard-calendar-day.empty-day small {
    color: rgba(31, 35, 50, 0.45);
  }

  .dashboard-calendar-title {
    padding: 6px 10px;
    border-radius: 12px;
  }

  .dashboard-calendar-title strong {
    font-size: 15px;
  }

  .dashboard-calendar-title span {
    font-size: 11px;
  }

  .dashboard-calendar-head {
    min-height: 22px;
    padding: 4px 2px;
    border-radius: 8px;
    background: rgba(93, 63, 211, 0.08);
    color: var(--muted);
    font-size: 10px;
    font-weight: 950;
    text-align: center;
  }

  .dashboard-calendar-day > strong {
    margin: 0;
    font-size: 13px;
    line-height: 1;
  }

  .dashboard-day-count {
    top: 3px;
    right: 3px;
    min-width: 15px;
    height: 15px;
    font-size: 9px;
  }

  .dashboard-calendar-day small {
    display: block;
    margin-top: 9px;
    max-width: 100%;
    color: var(--muted);
    font-size: 9px;
    font-weight: 900;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-day-colors {
    position: absolute;
    right: 4px;
    bottom: 4px;
    gap: 2px;
  }

  .appointment-color {
    width: 7px;
    height: 7px;
  }

  .dashboard-calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin: 4px 0 6px;
    font-size: 9px;
  }

  .calendar-panel-actions {
    justify-content: flex-start;
    margin-bottom: 5px;
  }

  #view-overview .dashboard-module-title {
    display: block;
    flex: 0 0 auto;
    min-height: 24px;
    margin: 0 0 8px;
    overflow: visible;
    color: var(--ink);
    font-size: clamp(18px, 1.18vw, 22px);
    font-weight: 950;
    line-height: 1.18;
    letter-spacing: 0;
    white-space: nowrap;
  }

  #view-overview .dashboard-module-head {
    align-items: flex-start;
    margin-bottom: 8px;
  }

  #view-overview .em-panel .dashboard-module-title {
    min-height: 26px;
    font-size: clamp(18px, 1.22vw, 23px);
    line-height: 1.16;
  }

  #view-overview .dashboard-revenue-panel .dashboard-module-title,
  #view-overview .payment-pie-panel .dashboard-module-title {
    min-height: 26px;
    margin-bottom: 10px;
  }

  #dashboard-revenue .board-module-toolbar {
    align-items: flex-start;
    margin-top: 0;
    margin-bottom: 8px;
  }

  #dashboard-revenue .board-module-toolbar strong {
    font-size: clamp(30px, 2.35vw, 42px);
    line-height: 0.9;
  }

  #view-overview .dashboard-revenue-panel .dashboard-chart-link {
    height: calc(100% - 110px);
    min-height: 118px;
  }

  #view-overview .dashboard-revenue-panel .chart-shell,
  #view-overview .dashboard-revenue-panel .board-line-chart {
    height: 100%;
    min-height: 118px;
  }

  #view-overview .dashboard-revenue-panel .chart-caption {
    margin-top: 4px;
  }

  #view-overview [data-dashboard-topic="health"].dashboard-topic-visible .dashboard-module-title {
    min-height: 20px;
    margin-bottom: 5px;
    font-size: clamp(15px, 1vw, 18px);
  }

  #view-overview [data-dashboard-topic="health"].dashboard-topic-visible .system-orb-grid {
    gap: 6px;
  }

  #view-overview [data-dashboard-topic="health"].dashboard-topic-visible .system-orb {
    min-height: 34px;
    padding: 5px 7px;
  }

  .system-orb[aria-disabled="true"] {
    cursor: default;
    pointer-events: none;
  }

  body.dark-mode .sidebar,
  body.dark-mode .shell.sidebar-collapsed .sidebar {
    background: #121d2b !important;
  }

  .quick-ui-toggles {
    position: fixed;
    top: 3px;
    right: 18px;
    z-index: 88;
    display: flex !important;
    justify-content: flex-end;
  }

  .quick-icon-button {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    color: #f7f3ff;
    background: #241a38;
    box-shadow: inset 0 0 0 1px rgba(157, 130, 255, 0.22), 0 14px 34px rgba(6, 8, 18, 0.22);
  }

  body:not(.dark-mode) .quick-icon-button {
    color: #3a2e7d;
    background: #f0ecff;
  }

  .menu-button {
    top: 4px;
    left: 19px;
    z-index: 87;
    background: #263548;
    box-shadow: inset 0 0 0 1px rgba(238, 244, 255, 0.12), 0 14px 34px rgba(6, 8, 18, 0.24);
  }

  .menu-button span {
    background: #f7f3ff;
  }

  body:not(.dark-mode) .menu-button {
    background: #172437;
  }

  .dashboard-home-button {
    position: fixed;
    top: 3px;
    left: 66px;
    z-index: 87;
    min-height: 34px;
    padding: 0 13px;
    border: 0;
    border-radius: 12px;
    color: #f7f3ff;
    background: #263548;
    font-size: 14px;
    font-weight: 950;
    box-shadow: inset 0 0 0 1px rgba(238, 244, 255, 0.12), 0 14px 34px rgba(6, 8, 18, 0.22);
  }

  body:not(.dark-mode) .dashboard-home-button {
    color: #f7f3ff;
    background: #172437;
  }

  .shell.mobile-nav-open .sidebar {
    width: 276px !important;
    padding: 18px 16px 14px !important;
    gap: 12px;
  }

  .shell.mobile-nav-open .mobile-menu-head {
    min-height: 42px;
    margin-bottom: 2px;
  }

  .shell.mobile-nav-open .mobile-menu-close,
  #close-drawer {
    display: grid !important;
    place-items: center;
    color: #4f3cc4;
    background: #f4f1ff;
    box-shadow: inset 0 0 0 1px rgba(93, 63, 211, 0.14);
  }

  .shell.mobile-nav-open .brand {
    display: none !important;
  }

  .brand,
  .brand-mark {
    display: none !important;
  }

  .shell.mobile-nav-open .sidebar .primary-action {
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 14px;
    text-align: center;
  }

  .shell.mobile-nav-open .nav {
    display: grid !important;
    gap: 6px;
    grid-auto-rows: max-content;
    align-content: start;
    margin-top: 0;
  }

  .shell.mobile-nav-open .nav-item {
    grid-template-columns: 30px 1fr;
    min-height: 39px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.05;
  }

  .shell.mobile-nav-open .nav-icon {
    width: 24px;
    font-size: 10px;
  }

  .drawer-card .panel-header {
    position: sticky;
    top: 0;
    z-index: 4;
    padding: 0 156px 12px 0;
    background: inherit;
  }

  .drawer-window-actions {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .drawer-dashboard-button {
    min-height: 40px;
    padding: 0 12px;
    border: 0;
    border-radius: 12px;
    color: #4f3cc4;
    background: #f4f1ff;
    font-size: 13px;
    font-weight: 950;
    box-shadow: inset 0 0 0 1px rgba(93, 63, 211, 0.14);
  }

  #close-drawer {
    position: static;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 20px;
    font-weight: 950;
  }

  .search {
    position: fixed;
    top: 3px;
    right: 108px;
    z-index: 110;
    width: 34px;
    max-width: none;
    justify-content: flex-end;
    transform: none;
  }

  .search::before {
    right: 0;
    width: 34px;
    height: 34px;
    background: rgba(240, 236, 255, 0.78);
    backdrop-filter: blur(12px);
    box-shadow: inset 0 0 0 1px rgba(93, 63, 211, 0.12), 0 14px 32px rgba(6, 8, 18, 0.12);
  }

  .search input {
    width: 34px;
    min-height: 34px;
    padding: 0 17px;
    border: 1px solid rgba(93, 63, 211, 0.2);
    background: rgba(232, 235, 242, 0.82);
    backdrop-filter: blur(14px);
    box-shadow: 0 18px 45px rgba(6, 8, 18, 0.14);
  }

  .search:focus-within input,
  .search input:not(:placeholder-shown) {
    width: min(520px, calc(100vw - 390px));
    padding: 8px 46px 8px 18px;
    opacity: 0.94;
  }

  .global-search-results {
    z-index: 111;
    top: calc(100% + 8px);
    right: 0;
    width: min(520px, calc(100vw - 390px));
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(16px);
  }

  body.dark-mode .search input,
  body.dark-mode .global-search-results {
    background: rgba(22, 16, 33, 0.9);
  }

  .calendar-panel-actions label {
    gap: 2px;
    font-size: 9px;
  }

  .calendar-panel-actions select {
    min-width: 150px;
    min-height: 28px;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 11px;
  }

  body.auth-pending .shell,
  body.signed-out .shell {
    display: none !important;
  }
}

/* =====================================================================
   SaaS polish v1 (2026-09-24): Payments + DB contacts.
   New `saas-` classes only, so none of the earlier override layers apply.
   Colours are tokens; body.dark-mode swaps every one of them.
   ===================================================================== */
body {
  --s-bg-card: #ffffff;
  --s-bg-subtle: #f7f7fa;
  --s-bg-hover: #f3f2f8;
  --s-border: #e7e6ee;
  --s-border-strong: #d8d6e2;
  --s-text: #16151f;
  --s-text-2: #5b5a6b;
  --s-text-3: #8a899a;
  --s-accent: #5d3fd3;
  --s-accent-hover: #4b31b8;
  --s-accent-soft: #efebfd;
  --s-bar: #6b4fe0;
  --s-bar-hover: #4b31b8;
  --s-shadow: 0 1px 2px rgba(22, 21, 31, 0.04), 0 1px 3px rgba(22, 21, 31, 0.06);
  --s-shadow-pop: 0 12px 32px rgba(22, 21, 31, 0.16);
  --s-paid-fg: #0f7a4b;   --s-paid-bg: #e3f6ec;   --s-paid-dot: #16a36a;
  --s-pending-fg: #9a5b00; --s-pending-bg: #fdf1d8; --s-pending-dot: #e59a0b;
  --s-failed-fg: #b42330; --s-failed-bg: #fde6e8;  --s-failed-dot: #df4d55;
  --s-idle-fg: #52525f;   --s-idle-bg: #eeeef3;    --s-idle-dot: #9a9aab;
  --s-up: #0f7a4b;
  --s-down: #b42330;
}

body.dark-mode {
  --s-bg-card: #17131f;
  --s-bg-subtle: #1e1929;
  --s-bg-hover: #231d31;
  --s-border: rgba(255, 255, 255, 0.09);
  --s-border-strong: rgba(255, 255, 255, 0.16);
  --s-text: #f3f0fa;
  --s-text-2: #b8b3c8;
  --s-text-3: #8c879e;
  --s-accent: #8b74f5;
  --s-accent-hover: #a08ef8;
  --s-accent-soft: rgba(139, 116, 245, 0.16);
  --s-bar: #8b74f5;
  --s-bar-hover: #b3a4fa;
  --s-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --s-shadow-pop: 0 14px 36px rgba(0, 0, 0, 0.5);
  --s-paid-fg: #5ee0a0;   --s-paid-bg: rgba(34, 197, 120, 0.14);   --s-paid-dot: #34d392;
  --s-pending-fg: #fbc463; --s-pending-bg: rgba(245, 166, 35, 0.15); --s-pending-dot: #f5a623;
  --s-failed-fg: #ff8f97; --s-failed-bg: rgba(239, 83, 95, 0.16);  --s-failed-dot: #ef535f;
  --s-idle-fg: #c3c1cf;   --s-idle-bg: rgba(160, 158, 180, 0.14);  --s-idle-dot: #8f8da3;
  --s-up: #5ee0a0;
  --s-down: #ff8f97;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

#view-payments.active,
#view-contacts.active {
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: var(--s-text);
  font-variant-numeric: tabular-nums;
}

@media all { /* v18: was min-width 761px */
  #view-payments.active,
  #view-contacts.active {
    overflow-y: auto;
    max-height: 100%;
    padding-bottom: 32px;
  }
}

/* Page head */
.saas-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.saas-page-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--s-text);
}
.saas-page-sub {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--s-text-2);
}
.saas-page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Buttons */
.saas-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--s-border-strong);
  border-radius: 8px;
  background: var(--s-bg-card);
  color: var(--s-text);
  font: 600 0.875rem/1 inherit;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--s-shadow);
  transition: background-color 120ms ease, border-color 120ms ease;
}
.saas-btn:hover { background: var(--s-bg-hover); }
.saas-btn:focus-visible,
.saas-segmented button:focus-visible,
.saas-tabs button:focus-visible,
.saas-table tbody tr:focus-visible {
  outline: 2px solid var(--s-accent);
  outline-offset: 2px;
}
.saas-btn-primary {
  background: var(--s-accent);
  border-color: var(--s-accent);
  color: #fff;
}
.saas-btn-primary:hover { background: var(--s-accent-hover); border-color: var(--s-accent-hover); }
.saas-btn[disabled],
.saas-btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.saas-btn-quiet { box-shadow: none; }

/* Segmented range control */
.saas-segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--s-border);
  border-radius: 9px;
  background: var(--s-bg-subtle);
}
.saas-segmented button {
  min-width: 44px;
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--s-text-2);
  font: 600 0.8rem/1 inherit;
  font-family: inherit;
  cursor: pointer;
}
.saas-segmented button[aria-pressed="true"] {
  background: var(--s-bg-card);
  color: var(--s-text);
  box-shadow: var(--s-shadow);
}

/* Health pill */
.saas-health {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--s-border);
  border-radius: 8px;
  background: var(--s-bg-card);
  color: var(--s-text-2);
  font-size: 0.82rem;
  font-weight: 600;
}
.saas-health i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--s-paid-dot);
  box-shadow: 0 0 0 3px var(--s-paid-bg);
}
.saas-health[data-state="issue"] i { background: var(--s-failed-dot); box-shadow: 0 0 0 3px var(--s-failed-bg); }

/* Cards */
.saas-card,
.saas-kpi {
  border: 1px solid var(--s-border);
  border-radius: 12px;
  background: var(--s-bg-card);
  box-shadow: var(--s-shadow);
}
.saas-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 0;
}
.saas-card-head h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--s-text);
}
.saas-card-sub {
  margin: 3px 0 0;
  font-size: 0.8rem;
  color: var(--s-text-3);
}
.saas-card-figure {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--s-text);
}

/* KPI row */
.saas-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.saas-kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
}
.saas-kpi-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--s-text-2);
}
.saas-kpi-value {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--s-text);
}
.saas-delta {
  font-size: 0.78rem;
  color: var(--s-text-3);
}
.saas-delta b { font-weight: 700; }
.saas-delta[data-trend="up"] b { color: var(--s-up); }
.saas-delta[data-trend="down"] b { color: var(--s-down); }

/* Charts */
.saas-chart-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 16px;
}
.saas-chart {
  position: relative;
  padding: 8px 12px 10px 4px;
}
.saas-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.saas-grid { stroke: var(--s-border); stroke-width: 1; }
.saas-axis { stroke: var(--s-border-strong); stroke-width: 1; }
.saas-tick { fill: var(--s-text-3); font-size: 11px; font-family: inherit; }
.saas-bar { fill: var(--s-bar); transition: fill 120ms ease; }
.saas-bar-hit { fill: transparent; }
.saas-bar-slot.is-active .saas-bar-hit { fill: var(--s-accent-soft); }
.saas-bar-slot.is-active .saas-bar { fill: var(--s-bar-hover); }
.saas-tooltip {
  position: absolute;
  transform: translateX(-50%);
  padding: 7px 10px;
  border-radius: 8px;
  background: #16151f;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--s-shadow-pop);
  z-index: 3;
}
body.dark-mode .saas-tooltip { background: #f3f0fa; color: #16151f; }
.saas-chart-empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  margin: 12px 20px 20px;
  border: 1px dashed var(--s-border-strong);
  border-radius: 10px;
  color: var(--s-text-3);
  font-size: 0.88rem;
}

.saas-donut-wrap {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: 18px 20px 20px;
}
.saas-donut { width: 140px; height: 140px; }
.saas-donut-track { fill: none; stroke: var(--s-bg-subtle); stroke-width: 16; }
.saas-donut-arc { fill: none; stroke-width: 16; }
.saas-donut-arc[data-tone="paid"] { stroke: var(--s-paid-dot); }
.saas-donut-arc[data-tone="pending"] { stroke: var(--s-pending-dot); }
.saas-donut-arc[data-tone="failed"] { stroke: var(--s-failed-dot); }
.saas-donut-arc[data-tone="idle"] { stroke: var(--s-idle-dot); }
.saas-donut-value { fill: var(--s-text); font-size: 24px; font-weight: 700; font-family: inherit; }
.saas-donut-label { fill: var(--s-text-3); font-size: 11px; font-weight: 600; font-family: inherit; }
.saas-legend {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.saas-legend li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  grid-template-areas: "dot name count" ". meta meta";
  align-items: center;
  column-gap: 8px;
  row-gap: 1px;
}
.saas-legend-dot { grid-area: dot; width: 10px; height: 10px; border-radius: 3px; }
.saas-legend-dot[data-tone="paid"] { background: var(--s-paid-dot); }
.saas-legend-dot[data-tone="pending"] { background: var(--s-pending-dot); }
.saas-legend-dot[data-tone="failed"] { background: var(--s-failed-dot); }
.saas-legend-dot[data-tone="idle"] { background: var(--s-idle-dot); }
.saas-legend-name { grid-area: name; font-size: 0.85rem; color: var(--s-text); }
.saas-legend li strong { grid-area: count; font-size: 0.9rem; color: var(--s-text); }
.saas-legend-meta { grid-area: meta; font-size: 0.76rem; color: var(--s-text-3); }

/* Status badge: the ONLY coloured element in a payment row */
.saas-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
}
.saas-badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.saas-badge[data-tone="paid"] { background: var(--s-paid-bg); color: var(--s-paid-fg); }
.saas-badge[data-tone="pending"] { background: var(--s-pending-bg); color: var(--s-pending-fg); }
.saas-badge[data-tone="failed"] { background: var(--s-failed-bg); color: var(--s-failed-fg); }
.saas-badge[data-tone="idle"] { background: var(--s-idle-bg); color: var(--s-idle-fg); }

/* Table card */
.saas-table-card { overflow: visible; }
.saas-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--s-border);
}
.saas-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.saas-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.saas-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--s-text-2);
  font: 600 0.84rem/1 inherit;
  font-family: inherit;
  cursor: pointer;
}
.saas-tabs button:hover { background: var(--s-bg-hover); color: var(--s-text); }
.saas-tabs button span {
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--s-bg-subtle);
  color: var(--s-text-3);
  font-size: 0.72rem;
  text-align: center;
}
.saas-tabs button[aria-selected="true"] {
  border-color: var(--s-border-strong);
  background: var(--s-bg-card);
  color: var(--s-text);
  box-shadow: var(--s-shadow);
}
.saas-tabs button[data-tone="paid"] span { background: var(--s-paid-bg); color: var(--s-paid-fg); }
.saas-tabs button[data-tone="pending"] span { background: var(--s-pending-bg); color: var(--s-pending-fg); }
.saas-tabs button[data-tone="failed"] span { background: var(--s-failed-bg); color: var(--s-failed-fg); }

.saas-search input,
.saas-select,
.saas-form-grid input {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--s-border-strong);
  border-radius: 8px;
  background: var(--s-bg-card);
  color: var(--s-text);
  font: 500 0.875rem/1.2 inherit;
  font-family: inherit;
  box-shadow: none;
}
.saas-search input { width: 240px; }
.saas-search-wide input { width: min(360px, 100%); }
.saas-search input:focus,
.saas-select:focus,
.saas-form-grid input:focus {
  outline: none;
  border-color: var(--s-accent);
  box-shadow: 0 0 0 3px var(--s-accent-soft);
}
.saas-search input::placeholder,
.saas-form-grid input::placeholder { color: var(--s-text-3); }

.saas-table-scroll {
  overflow-x: auto;
}
#view-payments .saas-table,
#view-contacts .saas-table {
  display: table;
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 0.875rem;
}
#view-payments .saas-table thead,
#view-contacts .saas-table thead { display: table-header-group; }
#view-payments .saas-table th,
#view-contacts .saas-table th {
  position: static;
  padding: 10px 16px;
  border-bottom: 1px solid var(--s-border);
  background: var(--s-bg-subtle);
  color: var(--s-text-3);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
#view-payments .saas-table td,
#view-contacts .saas-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--s-border);
  background: transparent;
  color: var(--s-text);
  vertical-align: middle;
  text-align: left;
}
#view-payments .saas-table tbody tr:last-child td,
#view-contacts .saas-table tbody tr:last-child td { border-bottom: 0; }
#view-payments .saas-table tbody tr,
#view-contacts .saas-table tbody tr { cursor: pointer; transition: background-color 100ms ease; }
#view-payments .saas-table tbody tr:hover td,
#view-contacts .saas-table tbody tr:hover td { background: var(--s-bg-hover); }
#view-payments .saas-table [data-col="amount"] { text-align: right; }
#view-payments .saas-table [data-col="date"] { white-space: nowrap; }
.saas-amount { font-weight: 650; color: var(--s-text); }
.saas-muted { color: var(--s-text-2); }
.saas-date { display: inline-flex; flex-direction: column; color: var(--s-text); }
.saas-date small { color: var(--s-text-3); font-size: 0.76rem; }
.saas-person { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.saas-person strong { display: block; font-weight: 600; color: var(--s-text); }
.saas-person small { display: block; color: var(--s-text-3); font-size: 0.78rem; }
.saas-avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--s-accent-soft);
  color: var(--s-accent);
  font-size: 0.72rem;
  font-weight: 700;
}
.saas-empty,
#view-contacts .saas-table .empty-state {
  padding: 40px 16px !important;
  color: var(--s-text-3) !important;
  text-align: center !important;
  cursor: default;
}
#view-contacts .saas-table td[data-col="name"] { font-weight: 600; }
#view-contacts .saas-table td[data-col="phone"],
#view-contacts .saas-table td[data-col="email"] { color: var(--s-text-2); }

/* Column menu inside new toolbars */
.saas-table-toolbar .column-menu summary {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--s-border-strong);
  border-radius: 8px;
  background: var(--s-bg-card);
  color: var(--s-text);
  font-size: 0.875rem;
  font-weight: 600;
}

/* Add-contact dialog */
.saas-dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--s-border);
  border-radius: 14px;
  background: var(--s-bg-card);
  color: var(--s-text);
  box-shadow: var(--s-shadow-pop);
}
.saas-dialog::backdrop { background: rgba(16, 12, 25, 0.45); backdrop-filter: blur(2px); }
.saas-dialog-head { padding: 20px 22px 4px; }
.saas-dialog-head h3 { margin: 0; font-size: 1.1rem; font-weight: 700; color: var(--s-text); }
.saas-dialog-head p { margin: 4px 0 0; font-size: 0.85rem; color: var(--s-text-2); }
.saas-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 16px 22px 4px;
}
.saas-form-grid label { display: grid; gap: 6px; }
.saas-form-grid label span { font-size: 0.8rem; font-weight: 600; color: var(--s-text-2); }
.saas-form-grid input { width: 100%; box-sizing: border-box; }
.saas-span-2 { grid-column: 1 / -1; }
.saas-form-error {
  min-height: 1.2em;
  margin: 6px 22px 0;
  font-size: 0.83rem;
  color: var(--s-failed-fg);
}
.saas-form-error[data-tone="success"] { color: var(--s-paid-fg); }
.saas-dialog-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--s-border);
  background: var(--s-bg-subtle);
  border-radius: 0 0 14px 14px;
}
.saas-dialog-foot > div { display: flex; gap: 8px; }
.saas-check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.83rem; color: var(--s-text-2); }
.saas-check input { accent-color: var(--s-accent); }

@media (max-width: 1120px) {
  .saas-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .saas-chart-row { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .saas-page-head { align-items: flex-start; }
  .saas-kpis { gap: 10px; }
  .saas-kpi { padding: 14px; }
  .saas-kpi-value { font-size: 1.3rem; }
  .saas-search input { width: 100%; }
  .saas-toolbar-right, .saas-search { width: 100%; }
  .saas-donut-wrap { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .saas-legend { width: 100%; }
  .saas-form-grid { grid-template-columns: minmax(0, 1fr); }
}
#view-payments .saas-select,
#view-payments .saas-search input,
#view-contacts .saas-search input {
  display: inline-block;
  width: auto;
  margin: 0;
}
#view-payments .saas-search input { width: 240px; }
#view-contacts .saas-search input { width: min(360px, 70vw); }
@media all { /* v18: was min-width 761px */
  .saas-toolbar-right { flex-wrap: nowrap; }
}
@media (max-width: 760px) {
  #view-payments .saas-search input,
  #view-contacts .saas-search input { width: 100%; }
}
#view-payments details.advanced-settings {
  border: 1px solid var(--s-border);
  border-radius: 12px;
  background: var(--s-bg-card);
  color: var(--s-text);
  box-shadow: var(--s-shadow);
  overflow: hidden;
}
#view-payments details.advanced-settings > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--s-bg-card);
  color: var(--s-text);
  cursor: pointer;
}
#view-payments details.advanced-settings > summary .eyebrow { color: var(--s-text-3); margin: 0; }
#view-payments details.advanced-settings > summary strong { color: var(--s-text); }
#clear-import[hidden] { display: none !important; }
.saas-check input[type="checkbox"] {
  width: 16px; height: 16px; min-height: 0; min-width: 0;
  margin: 0; padding: 0; flex: 0 0 16px;
  box-shadow: none;
}
.saas-check span { white-space: nowrap; }
.saas-dialog-foot > div { margin-left: auto; }
/* Mobile top bar: the page title sat in a 14px grid track and wrapped one letter per line. */
@media (max-width: 760px) {
  .topbar .page-heading { grid-column: 1 / 3; min-width: 0; }
  .topbar .page-heading h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* ---- SaaS polish v2: overview charts share the Payments page style ---- */
body {
  --s-series-a: #6b4fe0;
  --s-series-b: #0e9f6e;
  --s-series-c: #e59a0b;
  --s-series-d: #df4d55;
}
body.dark-mode {
  --s-series-a: #8b74f5;
  --s-series-b: #34d392;
  --s-series-c: #f5a623;
  --s-series-d: #ef535f;
}
#dashboard-revenue,
#dashboard-visitors,
#bar-chart,
#payment-pie {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 6px;
  color: var(--s-text);
}
.saas-chart-button {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.saas-chart-host {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 120px;
}
.saas-chart-host .saas-chart { position: absolute; inset: 0; padding: 0; }
.saas-chart-host .saas-chart svg { width: 100%; height: 100%; }
.saas-mini-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.saas-mini-head .saas-card-sub { margin: 0; }
.saas-mini-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.saas-mini-stats div {
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  border: 1px solid var(--s-border);
  border-radius: 8px;
  background: var(--s-bg-subtle);
}
.saas-mini-stats strong { font-size: 1.15rem; font-weight: 700; color: var(--s-text); }
.saas-mini-stats span { font-size: 0.74rem; color: var(--s-text-3); }
.saas-line { fill: none; stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.saas-line-area { stroke: none; opacity: 0.12; }
.saas-line[data-series="a"] { stroke: var(--s-series-a); } .saas-line-area[data-series="a"] { fill: var(--s-series-a); }
.saas-line[data-series="b"] { stroke: var(--s-series-b); } .saas-line-area[data-series="b"] { fill: var(--s-series-b); }
.saas-line[data-series="c"] { stroke: var(--s-series-c); } .saas-line-area[data-series="c"] { fill: var(--s-series-c); }
.saas-line[data-series="d"] { stroke: var(--s-series-d); } .saas-line-area[data-series="d"] { fill: var(--s-series-d); }
.saas-crosshair { stroke: transparent; stroke-width: 1; }
.saas-bar-slot.is-active .saas-crosshair { stroke: var(--s-border-strong); }
.saas-bar-slot .saas-line-hit { fill: transparent; }
.saas-inline-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-left: auto; }
.saas-inline-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 0.76rem; color: var(--s-text-2); }
.saas-inline-legend i { width: 10px; height: 3px; border-radius: 2px; }
.saas-inline-legend i[data-series="a"] { background: var(--s-series-a); }
.saas-inline-legend i[data-series="b"] { background: var(--s-series-b); }
.saas-inline-legend i[data-series="c"] { background: var(--s-series-c); }
.saas-inline-legend i[data-series="d"] { background: var(--s-series-d); }
.saas-chart-empty.small { min-height: 100px; margin: 4px 0 0; flex: 1 1 auto; }
#payment-pie .saas-donut-wrap { padding: 4px 0 0; grid-template-columns: 120px minmax(0, 1fr); gap: 14px; }
#payment-pie .saas-donut { width: 120px; height: 120px; }
#payment-pie .saas-card-sub { margin: 0; }
.saas-stack[data-series="a"] { fill: var(--s-series-a); }
.saas-stack[data-series="b"] { fill: var(--s-series-b); }
.saas-stack[data-series="c"] { fill: var(--s-series-c); }
.saas-stack[data-series="d"] { fill: var(--s-series-d); }
.saas-bar-slot.is-active .saas-stack { filter: brightness(1.12); }
.saas-inline-legend i { width: 9px; height: 9px; border-radius: 2px; }
#dashboard-visitors .saas-inline-legend { margin-left: 0; }

/* ---- v03: Columns menu is a floating popover, never pushes the page ---- */
.saas-colmenu { position: relative; }
.saas-colmenu > summary { list-style: none; gap: 8px; }
.saas-colmenu > summary::-webkit-details-marker { display: none; }
.saas-colmenu-caret {
  width: 7px; height: 7px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 120ms ease;
}
.saas-colmenu[open] .saas-colmenu-caret { transform: translateY(2px) rotate(-135deg); }
.saas-colmenu-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  width: 260px;
  max-height: min(420px, 60vh);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--s-border);
  border-radius: 10px;
  background: var(--s-bg-card);
  box-shadow: var(--s-shadow-pop);
}
.saas-colmenu-title {
  margin: 4px 8px 6px;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--s-text-3);
}
.saas-colmenu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 4px 2px 8px;
  border-radius: 6px;
}
.saas-colmenu-row:hover { background: var(--s-bg-hover); }
.saas-colmenu-row label {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--s-text);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
}
.saas-colmenu-row input[type="checkbox"] {
  width: 16px; height: 16px; min-height: 0; min-width: 0;
  margin: 0; padding: 0; flex: 0 0 16px;
  accent-color: var(--s-accent);
  box-shadow: none;
}
.saas-colmenu-move { display: inline-flex; gap: 2px; opacity: 0.55; }
.saas-colmenu-row:hover .saas-colmenu-move { opacity: 1; }
.saas-colmenu-move button {
  width: 24px; height: 24px; min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--s-text-2);
  font-size: 0.8rem;
  cursor: pointer;
}
.saas-colmenu-move button:hover:not(:disabled) { background: var(--s-bg-subtle); color: var(--s-accent); }
.saas-colmenu-move button:disabled { opacity: 0.3; cursor: default; }
.saas-table-card, .saas-table-toolbar { overflow: visible; }
/* v03 line charts */
.saas-line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.saas-line-fill { stroke: none; }
.saas-grad-top[data-series="a"] { stop-color: var(--s-series-a); stop-opacity: 0.28; }
.saas-grad-bottom[data-series="a"] { stop-color: var(--s-series-a); stop-opacity: 0; }
.saas-line-dot { opacity: 0; stroke: var(--s-bg-card); stroke-width: 2; }
.saas-line-dot[data-series="a"] { fill: var(--s-series-a); }
.saas-line-dot[data-series="b"] { fill: var(--s-series-b); }
.saas-line-dot[data-series="c"] { fill: var(--s-series-c); }
.saas-line-dot[data-series="d"] { fill: var(--s-series-d); }
.saas-line-slot.is-active .saas-line-dot { opacity: 1; }
.saas-line-slot.is-active .saas-bar-hit { fill: transparent; }
.saas-line-slot.is-active .saas-crosshair { stroke: var(--s-border-strong); stroke-dasharray: 3 3; }
.saas-inline-legend i { width: 12px; height: 3px; border-radius: 2px; }
/* v03 page bar (X + Save) */
.saas-view-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 6px;
}
.saas-view-actions[hidden] { display: none !important; }
.saas-view-actions .saas-btn { min-height: 34px; }
.saas-view-actions .saas-btn[hidden] { display: none; }
.saas-dirty-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--s-pending-fg);
  white-space: nowrap;
}
.saas-dirty-note::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--s-pending-dot); }
.saas-dirty-note[hidden] { display: none; }
.saas-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px; min-height: 0;
  padding: 0;
  border: 1px solid var(--s-border-strong);
  border-radius: 8px;
  background: var(--s-bg-card);
  color: var(--s-text-2);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--s-shadow);
}
.saas-icon-btn:hover { background: var(--s-bg-hover); color: var(--s-text); }
.saas-icon-btn:focus-visible { outline: 2px solid var(--s-accent); outline-offset: 2px; }
.saas-dialog-small { width: min(440px, calc(100vw - 32px)); }
.saas-dialog-small .saas-dialog-head { padding-bottom: 12px; }
.saas-dialog-small .saas-dialog-foot { margin-top: 4px; }
/* v03 add-contact form: more fields, scrolls inside the dialog */
#add-contact-dialog { width: min(600px, calc(100vw - 32px)); }
#add-contact-form { display: flex; flex-direction: column; max-height: min(86vh, 820px); }
#add-contact-form .saas-form-grid { overflow-y: auto; }
.saas-form-grid select {
  width: 100%;
  min-height: 36px;
  box-sizing: border-box;
  margin: 0;
}
.saas-check-row { display: flex; flex-wrap: wrap; gap: 10px 24px; padding-top: 2px; }
.saas-check-row .saas-check { display: inline-flex; grid-template-columns: none; }
.saas-form-grid .saas-check span { font-size: 0.85rem; font-weight: 500; color: var(--s-text); }
@media (max-width: 760px) {
  .saas-dirty-note { display: none; }
}
@media all { /* v18: was min-width 761px */
  .saas-view-actions {
    position: fixed;
    top: 3px;
    right: 156px;
    z-index: 88;
    margin: 0;
  }
}
@media (max-width: 760px) {
  .saas-view-actions { grid-column: 1 / -1; justify-content: flex-end; }
}
@media (max-width: 760px) {
  body.dark-mode .main { background: transparent !important; }
  .saas-view-actions #view-save:disabled { display: none; }
}
@media (max-width: 760px) {
  .saas-view-actions { grid-column: auto; justify-self: end; margin: 0; }
}

/* ===== v04 ===== */
/* One headline style for every panel/card title, on every page */
#view-overview .dashboard-module-title,
#view-overview .panel > h2,
.saas-card-head h3,
.view .panel-header h2,
.saas-notify-head h3 {
  margin: 0 0 8px !important;
  font-family: inherit !important;
  font-size: 1rem !important;
  font-weight: 650 !important;
  line-height: 1.3 !important;
  letter-spacing: -0.01em !important;
  text-transform: none !important;
  color: var(--s-text) !important;
}
.saas-card-head h3 { margin-bottom: 0 !important; }
.saas-page-title { font-size: 1.5rem !important; font-weight: 700 !important; }

/* Page head sits inside each page; Save + X live at its right edge */
.view > .saas-page-head { margin-bottom: 16px; }
#view-payments > .saas-page-head,
#view-contacts > .saas-page-head,
#view-webinar > .saas-page-head { margin-bottom: 0; }
.saas-page-actions { justify-content: flex-end; }
.saas-page-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 4px;
  padding-left: 12px;
  border-left: 1px solid var(--s-border);
}
.saas-page-bar .saas-btn[disabled] { opacity: 0.45; }
.saas-page-bar [hidden] { display: none !important; }
.saas-legacy-save { display: none !important; }
/* Section save buttons are replaced by the single "Save changes" in the page head */
#view-settings [data-save-profile-settings],
#view-settings [data-profile-save-status],
#save-calendar,
#stripe-settings,
#save-newsletter-draft { display: none !important; }

/* Advanced settings strip: themed on every page */
.view details.advanced-settings {
  border: 1px solid var(--s-border);
  border-radius: 12px;
  background: var(--s-bg-card);
  color: var(--s-text);
  box-shadow: var(--s-shadow);
  overflow: hidden;
}
.view details.advanced-settings > summary {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background: var(--s-bg-card);
  color: var(--s-text);
  cursor: pointer;
}
.view details.advanced-settings > summary .eyebrow { color: var(--s-text-3); margin: 0; }
.view details.advanced-settings > summary strong { color: var(--s-text); }

/* Webinar page */
#view-webinar.active {
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: var(--s-text);
  font-variant-numeric: tabular-nums;
}
@media all { /* v18: was min-width 761px */
  #view-webinar.active { overflow-y: auto; max-height: 100%; padding-bottom: 32px; }
}
.saas-chart-fixed { position: relative; height: 240px; margin: 8px 12px 14px 4px; }
.saas-chart-fixed .saas-chart { position: absolute; inset: 0; padding: 0; }
.saas-chart-fixed .saas-chart svg { width: 100%; height: 100%; }
#view-webinar .saas-card-head { align-items: center; }
#view-webinar .saas-table { display: table; width: 100%; border-collapse: collapse; font-size: 0.875rem; }
#view-webinar .saas-table thead { display: table-header-group; }
#view-webinar .saas-table th {
  padding: 10px 16px;
  border-bottom: 1px solid var(--s-border);
  background: var(--s-bg-subtle);
  color: var(--s-text-3);
  font-size: 0.72rem; font-weight: 650; letter-spacing: 0.04em;
  text-align: left; text-transform: uppercase; white-space: nowrap;
}
#view-webinar .saas-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--s-border);
  background: transparent;
  color: var(--s-text);
  vertical-align: middle;
}
#view-webinar .saas-table tbody tr { cursor: pointer; }
#view-webinar .saas-table tbody tr:hover td { background: var(--s-bg-hover); }
#view-webinar .saas-table tbody tr:last-child td { border-bottom: 0; }
#view-webinar .saas-select, #view-webinar .saas-search input { display: inline-block; width: auto; margin: 0; }
#view-webinar .saas-search input { width: 220px; }

/* Notification bell + panel */
.saas-bell { position: relative; display: inline-grid; place-items: center; }
.saas-bell svg { display: block; }
.saas-bell-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--s-failed-dot);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--s-bg-card);
}
.saas-bell-badge[hidden] { display: none; }
.saas-notify {
  position: fixed;
  top: 62px;
  right: 16px;
  z-index: 140;
  display: flex;
  flex-direction: column;
  width: min(400px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 90px));
  border: 1px solid var(--s-border);
  border-radius: 12px;
  background: var(--s-bg-card);
  color: var(--s-text);
  box-shadow: var(--s-shadow-pop);
  overflow: hidden;
}
.saas-notify[hidden] { display: none; }
.saas-notify-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 14px 16px 8px;
}
.saas-notify-head h3 { margin: 0 !important; }
.saas-link-btn {
  padding: 4px 6px;
  border: 0;
  background: none;
  color: var(--s-accent);
  font: 600 0.8rem/1 inherit;
  font-family: inherit;
  cursor: pointer;
  border-radius: 6px;
}
.saas-link-btn:hover { background: var(--s-accent-soft); }
.saas-notify-tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 0 12px 10px; border-bottom: 1px solid var(--s-border); }
.saas-notify-tabs button {
  min-height: 28px; padding: 0 10px;
  border: 1px solid transparent; border-radius: 999px;
  background: transparent; color: var(--s-text-2);
  font: 600 0.78rem/1 inherit; font-family: inherit; cursor: pointer;
}
.saas-notify-tabs button[aria-selected="true"] { background: var(--s-accent-soft); color: var(--s-accent); }
.saas-notify-list { overflow-y: auto; padding: 4px 0; }
.saas-notify-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border: 0;
  background: transparent;
  color: var(--s-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.saas-notify-item:hover, .saas-notify-item:focus-visible { background: var(--s-bg-hover); outline: none; }
.saas-notify-item.is-new { background: var(--s-accent-soft); }
.saas-notify-item.is-new:hover { background: var(--s-bg-hover); }
.saas-notify-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.saas-notify-body strong { font-size: 0.86rem; font-weight: 650; }
.saas-notify-body span { font-size: 0.8rem; color: var(--s-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saas-notify-item time { font-size: 0.74rem; color: var(--s-text-3); white-space: nowrap; padding-top: 2px; }
.saas-notify-empty { margin: 0; padding: 28px 16px; color: var(--s-text-3); text-align: center; font-size: 0.86rem; }
.saas-notify-icon {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--s-accent-soft); color: var(--s-accent);
}
.saas-notify-icon[data-tone="paid"] { background: var(--s-paid-bg); color: var(--s-paid-fg); }
.saas-notify-icon[data-tone="pending"] { background: var(--s-pending-bg); color: var(--s-pending-fg); }
.saas-notify-icon[data-tone="failed"] { background: var(--s-failed-bg); color: var(--s-failed-fg); }
.saas-notify-icon[data-tone="idle"] { background: var(--s-idle-bg); color: var(--s-idle-fg); }

/* Event detail inside the drawer */
.saas-event-detail { display: flex; flex-direction: column; gap: 16px; color: var(--s-text); }
.saas-event-summary { display: flex; align-items: center; gap: 12px; }
.saas-event-summary div { display: flex; flex-direction: column; }
.saas-event-summary strong { font-size: 1rem; }
.saas-event-summary span { font-size: 0.82rem; color: var(--s-text-3); }
.saas-dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 10px 18px;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--s-border);
  border-radius: 10px;
  background: var(--s-bg-subtle);
}
.saas-dl dt { font-size: 0.8rem; font-weight: 600; color: var(--s-text-3); }
.saas-dl dd { margin: 0; font-size: 0.88rem; color: var(--s-text); overflow-wrap: anywhere; }
.saas-event-links { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 760px) {
  .saas-notify { top: 56px; right: 8px; left: 8px; width: auto; }
  .saas-page-bar { border-left: 0; padding-left: 0; margin-left: auto; }
  #view-webinar .saas-search input { width: 100%; }
}
/* bell joins the fixed quick toggles, so the search button moves one slot left */
@media all { /* v18: was min-width 761px */
  .topbar .search { right: 150px !important; }
  .saas-bell { width: 34px; height: 34px; }
}
#view-webinar .saas-person small { white-space: nowrap; }
#view-webinar td:first-child { min-width: 240px; }
#close-drawer.saas-icon-btn { width: 34px; height: 34px; min-width: 0; padding: 0; font-size: 0.95rem; font-weight: 500; color: var(--s-text-2); background: var(--s-bg-card); border: 1px solid var(--s-border-strong); border-radius: 8px; }
/* v05: one dot / one value per hover on line charts */
.saas-line-slot.is-active .saas-line-dot { opacity: 0; }
.saas-line-slot.is-active .saas-line-dot.is-hit { opacity: 1; }
/* Responses stat boxes carry their line colour (replaces the legend) */
.saas-mini-stats div[data-series] { position: relative; padding-left: 14px; }
.saas-mini-stats div[data-series]::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 4px; border-radius: 0 3px 3px 0;
}
.saas-mini-stats div[data-series="a"]::before { background: var(--s-series-a); }
.saas-mini-stats div[data-series="b"]::before { background: var(--s-series-b); }
.saas-mini-stats div[data-series="c"]::before { background: var(--s-series-c); }
/* Email campaign totals as coloured rings */
.saas-rings { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; padding: 2px 0 4px; }
.saas-ring {
  display: grid;
  grid-template-columns: 52px auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
}
.saas-ring svg { grid-row: 1 / 3; width: 52px; height: 52px; }
.saas-ring-track { fill: none; stroke: var(--s-bg-subtle); stroke-width: 5; }
.saas-ring-value { fill: none; stroke-width: 5; stroke-linecap: round; }
.saas-ring[data-series="a"] .saas-ring-value { stroke: var(--s-series-a); }
.saas-ring[data-series="b"] .saas-ring-value { stroke: var(--s-series-b); }
.saas-ring[data-series="d"] .saas-ring-value { stroke: var(--s-series-d); }
.saas-ring strong { font-size: 1.25rem; font-weight: 700; line-height: 1.1; color: var(--s-text); align-self: end; }
.saas-ring span { font-size: 0.78rem; color: var(--s-text-3); align-self: start; }
.saas-ring[data-series="a"] strong { color: var(--s-series-a); }
.saas-ring[data-series="b"] strong { color: var(--s-series-b); }
.saas-ring[data-series="d"] strong { color: var(--s-series-d); }

/* ===== v06: gradient ground, glass windows, sidebar, health boxes, scrollable dashboard ===== */
body {
  --s-glass: rgba(255, 255, 255, 0.74);
  --s-glass-strong: rgba(255, 255, 255, 0.86);
  --s-glass-border: rgba(255, 255, 255, 0.7);
  --s-glass-edge: rgba(93, 63, 211, 0.12);
  --s-backdrop: rgba(30, 22, 60, 0.18);
}
body.dark-mode {
  --s-glass: rgba(24, 19, 34, 0.72);
  --s-glass-strong: rgba(24, 19, 34, 0.84);
  --s-glass-border: rgba(255, 255, 255, 0.10);
  --s-glass-edge: rgba(139, 116, 245, 0.22);
  --s-backdrop: rgba(4, 2, 12, 0.35);
}

/* 2. Faded gradient behind the whole app, in the brand colours of each theme */
html { background: #f5f3fb; }
html:has(body.dark-mode) { background: #0e0b16; }
body:not(.dark-mode) {
  background:
    radial-gradient(1100px 620px at 8% -10%, rgba(139, 116, 245, 0.20), transparent 60%),
    radial-gradient(900px 560px at 100% 0%, rgba(36, 163, 216, 0.13), transparent 60%),
    radial-gradient(900px 700px at 60% 110%, rgba(23, 168, 113, 0.08), transparent 60%),
    linear-gradient(180deg, #f7f5fd 0%, #f3f2f9 100%) !important;
  background-attachment: fixed !important;
}
body.dark-mode {
  background:
    radial-gradient(1100px 620px at 8% -10%, rgba(139, 116, 245, 0.24), transparent 60%),
    radial-gradient(900px 560px at 100% 0%, rgba(36, 163, 216, 0.12), transparent 60%),
    radial-gradient(900px 700px at 60% 110%, rgba(52, 211, 146, 0.07), transparent 60%),
    linear-gradient(180deg, #120e1c 0%, #0d0a15 100%) !important;
  background-attachment: fixed !important;
}
.shell, .shell.sidebar-collapsed, .main, body.dark-mode .main, body.dark-mode .shell { background: transparent !important; }
#view-overview.active, body.dark-mode #view-overview.active { background: transparent !important; }

/* 1. Every window that opens is a little see-through (frosted glass) */
.saas-dialog,
.saas-notify,
.saas-colmenu-pop,
.drawer-card,
body.dark-mode .drawer-card {
  background: var(--s-glass) !important;
  border: 1px solid var(--s-glass-border) !important;
  box-shadow: 0 0 0 1px var(--s-glass-edge), var(--s-shadow-pop) !important;
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  backdrop-filter: blur(22px) saturate(1.5);
}
.saas-dialog::backdrop { background: var(--s-backdrop); backdrop-filter: blur(3px); }
.drawer.open { background: var(--s-backdrop) !important; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.saas-dialog-foot { background: transparent !important; border-top-color: var(--s-border) !important; }
.drawer-card .saas-dl { background: color-mix(in srgb, var(--s-bg-subtle) 70%, transparent); }

/* 6. Sidebar menu: glass in both themes, readable in light mode */
.sidebar,
body.dark-mode .sidebar {
  background: var(--s-glass-strong) !important;
  color: var(--s-text) !important;
  border-right: 1px solid var(--s-glass-border) !important;
  box-shadow: 0 0 0 1px var(--s-glass-edge), 0 24px 60px rgba(20, 12, 50, 0.22) !important;
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  backdrop-filter: blur(24px) saturate(1.5);
}
.sidebar .mobile-menu-head strong { color: var(--s-text) !important; }
.sidebar .nav-item,
body.dark-mode .sidebar .nav-item {
  background: transparent !important;
  color: var(--s-text-2) !important;
  border-radius: 8px !important;
}
.sidebar .nav-item .nav-icon { color: var(--s-text-3) !important; background: transparent !important; }
.sidebar .nav-item:hover,
.sidebar .nav-item.active { background: var(--s-accent-soft) !important; color: var(--s-accent) !important; }
.sidebar .nav-item.active .nav-icon { color: var(--s-accent) !important; }
.sidebar .primary-action,
body.dark-mode .sidebar .primary-action {
  background: var(--s-accent) !important;
  color: #fff !important;
  border: 0 !important;
  box-shadow: 0 6px 18px rgba(93, 63, 211, 0.28) !important;
}
.sidebar .mobile-menu-close.saas-icon-btn {
  width: 34px; height: 34px; min-width: 0; padding: 0;
  background: var(--s-bg-card) !important; color: var(--s-text-2) !important;
  border: 1px solid var(--s-border-strong) !important; border-radius: 8px !important;
  font-size: 0.95rem; font-weight: 500;
}
.sidebar .sidebar-footer,
body.dark-mode .sidebar .sidebar-footer {
  display: block !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  min-height: 0 !important;
}
.saas-sidebar-user {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--s-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--s-bg-card) 70%, transparent);
  color: var(--s-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.saas-sidebar-user .saas-avatar { width: 34px; height: 34px; flex-basis: 34px; }
.saas-sidebar-user-text { display: flex; flex-direction: column; min-width: 0; }
.saas-sidebar-user-text strong { font-size: 0.88rem; font-weight: 650; color: var(--s-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saas-sidebar-user-text small { font-size: 0.75rem; color: var(--s-text-3); }
.saas-sidebar-logout { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 600; color: var(--s-failed-fg); }
.saas-sidebar-user:hover { border-color: var(--s-failed-dot); background: var(--s-failed-bg); }

/* 3 + 4. System health = the same boxes as Responses, readable in both themes */
.saas-health-stats { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
.saas-mini-stats > div,
.saas-health-box {
  background: var(--s-bg-subtle) !important;
  border: 1px solid var(--s-border) !important;
  color: var(--s-text) !important;
}
.saas-health-box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 8px 10px 8px 14px;
  border-radius: 8px;
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-width: 0;
}
.saas-health-box:hover { background: var(--s-bg-hover) !important; }
.saas-health-box::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 4px; border-radius: 0 3px 3px 0; background: var(--s-idle-dot);
}
.saas-health-box[data-state="ready"]::before { background: var(--s-paid-dot); }
.saas-health-box[data-state="issue"]::before { background: var(--s-failed-dot); }
.saas-health-box[data-state="watch"]::before { background: var(--s-pending-dot); }
.saas-health-box strong { font-size: 1.15rem; font-weight: 700; color: var(--s-text); }
.saas-health-box[data-state="ready"] strong { color: var(--s-paid-fg); }
.saas-health-box[data-state="issue"] strong { color: var(--s-failed-fg); }
.saas-health-box[data-state="watch"] strong { color: var(--s-pending-fg); }
.saas-health-box span { font-size: 0.74rem; color: var(--s-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.saas-mini-stats span { color: var(--s-text-2) !important; }
.saas-mini-stats strong { color: var(--s-text) !important; }

/* Dashboard shortcut panels (extra topics) in the same box style */
.dashboard-shortcut,
body.dark-mode .dashboard-shortcut {
  display: flex !important;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 12px 14px !important;
  border: 1px solid var(--s-border) !important;
  border-radius: 10px !important;
  background: var(--s-bg-subtle) !important;
  color: var(--s-text) !important;
  text-align: left;
  cursor: pointer;
}
.dashboard-shortcut strong { font-size: 1rem; color: var(--s-text) !important; }
.dashboard-shortcut span { font-size: 0.82rem; color: var(--s-text-2) !important; }
.dashboard-shortcut:hover { background: var(--s-bg-hover) !important; }

/* Dashboard panels themselves stay solid-ish over the gradient */
#view-overview .panel,
body.dark-mode #view-overview .panel {
  background: color-mix(in srgb, var(--s-bg-card) 88%, transparent) !important;
  border: 1px solid var(--s-border) !important;
  color: var(--s-text) !important;
}

/* 5. More than 6 topics: same row height as before, the dashboard scrolls instead of squeezing */
@media all { /* v18: was min-width 761px */
  #view-overview.active.dashboard-extended {
    --row-h: calc((100vh - 70px - 12px - 42px) / 8);
    grid-template-rows: repeat(8, var(--row-h)) !important;
    grid-auto-rows: var(--row-h) !important;
    height: auto !important;
    max-height: calc(100vh - 70px) !important;
    overflow-y: auto !important;
  }
  #view-overview.dashboard-extended [data-dashboard-topic="contacts"].dashboard-topic-visible,
  #view-overview.dashboard-extended [data-dashboard-topic="webinar"].dashboard-topic-visible,
  #view-overview.dashboard-extended [data-dashboard-topic="forms"].dashboard-topic-visible,
  #view-overview.dashboard-extended [data-dashboard-topic="newsletter"].dashboard-topic-visible,
  #view-overview.dashboard-extended [data-dashboard-topic="users"].dashboard-topic-visible {
    grid-column: span 3 !important;
    grid-row: span 2 !important;
  }
  #view-overview.dashboard-extended [data-dashboard-topic="replies"].dashboard-topic-visible,
  #view-overview.dashboard-extended [data-dashboard-topic="integrations"].dashboard-topic-visible {
    grid-column: span 6 !important;
    grid-row: span 3 !important;
  }
}
.sidebar .saas-sidebar-user .saas-avatar { color: var(--s-accent) !important; background: var(--s-accent-soft) !important; font-size: 0.78rem !important; }
.sidebar .saas-sidebar-user .saas-sidebar-logout,
.sidebar .saas-sidebar-user .saas-sidebar-logout span { color: var(--s-failed-fg) !important; font-size: 0.8rem !important; opacity: 1 !important; }
.sidebar .saas-sidebar-user-text strong { color: var(--s-text) !important; }
.sidebar .saas-sidebar-user-text small { color: var(--s-text-3) !important; }
/* a bit more see-through, the blur keeps the text readable */
body { --s-glass-strong: rgba(255, 255, 255, 0.62); }
body.dark-mode { --s-glass-strong: rgba(22, 17, 32, 0.62); }
#view-overview .dashboard-shortcut-panel.dashboard-topic-visible { display: flex !important; flex-direction: column; justify-content: flex-start !important; gap: 8px; }

/* ===== v07: soft ambient ground, no hard frames, glassy cards on every page ===== */
body {
  --s-card-glass: rgba(255, 255, 255, 0.70);
  --s-card-edge: rgba(110, 90, 150, 0.10);
  --s-head-glass: rgba(255, 255, 255, 0.45);
}
body.dark-mode {
  --s-card-glass: rgba(26, 20, 38, 0.62);
  --s-card-edge: rgba(255, 255, 255, 0.06);
  --s-head-glass: rgba(255, 255, 255, 0.03);
}

/* Ground: big, very soft colour clouds. Light = warm beige/peach + a hint of lavender; dark = violet + ambient amber/teal */
html { background: #faf6f0; }
html:has(body.dark-mode) { background: #0e0b15; }
body:not(.dark-mode) {
  background:
    radial-gradient(70vw 60vh at 0% 0%, rgba(255, 190, 140, 0.30), transparent 70%),
    radial-gradient(60vw 55vh at 100% 5%, rgba(196, 176, 255, 0.24), transparent 70%),
    radial-gradient(70vw 60vh at 85% 100%, rgba(245, 214, 170, 0.34), transparent 72%),
    radial-gradient(55vw 50vh at 10% 95%, rgba(255, 214, 190, 0.22), transparent 70%),
    #faf6f0 !important;
  background-attachment: fixed !important;
}
body.dark-mode {
  background:
    radial-gradient(70vw 60vh at 0% 0%, rgba(124, 92, 255, 0.30), transparent 70%),
    radial-gradient(60vw 55vh at 100% 0%, rgba(190, 80, 200, 0.14), transparent 70%),
    radial-gradient(70vw 60vh at 90% 100%, rgba(40, 170, 200, 0.10), transparent 72%),
    radial-gradient(55vw 50vh at 5% 100%, rgba(255, 150, 70, 0.10), transparent 70%),
    #0e0b15 !important;
  background-attachment: fixed !important;
}

/* No frames around the page area, the top bar or the pages themselves */
#view-overview.active,
body.dark-mode #view-overview.active,
.view.active,
body.dark-mode .view.active,
.topbar,
body.dark-mode .topbar,
.table-wrap,
body.dark-mode .table-wrap,
.saas-table-scroll {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
.topbar::after, .topbar::before { display: none !important; }

/* Cards/panels on every page: soft glass that lets the ambient colour through, feather-light edge */
.saas-card,
.saas-kpi,
.view .panel,
#view-overview .panel,
body.dark-mode #view-overview .panel,
body.dark-mode .view .panel,
.view details.advanced-settings,
.view details.advanced-settings > summary {
  background: var(--s-card-glass) !important;
  border: 1px solid var(--s-card-edge) !important;
  box-shadow: 0 1px 2px rgba(40, 20, 80, 0.04), 0 8px 28px rgba(40, 20, 80, 0.05) !important;
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
}
.view details.advanced-settings > summary { border: 0 !important; box-shadow: none !important; backdrop-filter: none; background: transparent !important; }
body.dark-mode .saas-card,
body.dark-mode .saas-kpi { box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25) !important; }
/* Inner separators and table heads softened to match */
#view-payments .saas-table th,
#view-contacts .saas-table th,
#view-webinar .saas-table th { background: var(--s-head-glass) !important; border-bottom-color: var(--s-card-edge) !important; }
#view-payments .saas-table td,
#view-contacts .saas-table td,
#view-webinar .saas-table td,
.saas-table-toolbar { border-bottom-color: var(--s-card-edge) !important; }
.saas-mini-stats > div,
.saas-health-box,
.dashboard-shortcut,
body.dark-mode .dashboard-shortcut { background: var(--s-head-glass) !important; border-color: var(--s-card-edge) !important; }

/* X: smaller and half a centimetre in from the edge, so it never sits on the page scrollbar */
.saas-page-bar [data-view-close] {
  width: 28px !important;
  height: 28px !important;
  margin-right: 18px;
  font-size: 0.82rem;
  border-radius: 7px;
}

/* ===== v08: Tara in the same look, both themes ===== */
body {
  --tara-grad: linear-gradient(135deg, #ffb07a 0%, #e98bbd 48%, #7c5cff 100%);
  --tara-glow: 0 10px 28px rgba(233, 139, 120, 0.35), 0 4px 12px rgba(124, 92, 255, 0.25);
  --tara-bubble: rgba(255, 255, 255, 0.78);
}
body.dark-mode {
  --tara-grad: linear-gradient(135deg, #8b74f5 0%, #b35ad8 55%, #ff9a5c 100%);
  --tara-glow: 0 10px 32px rgba(139, 116, 245, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --tara-bubble: rgba(255, 255, 255, 0.06);
}

/* Minimised launcher: one gradient disc, no square frame */
.tara-widget.minimized,
body.dark-mode .tara-widget.minimized {
  width: 58px !important;
  height: 58px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  overflow: visible !important;
}
.tara-widget.minimized header,
body.dark-mode .tara-widget.minimized header {
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
}
.tara-widget.minimized .tara-face,
body.dark-mode .tara-widget.minimized .tara-face {
  width: 58px !important;
  height: 58px !important;
  border: 2px solid rgba(255, 255, 255, 0.85) !important;
  border-radius: 50% !important;
  background: var(--tara-grad) !important;
  color: #fff !important;
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.01em;
  box-shadow: var(--tara-glow) !important;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
body.dark-mode .tara-widget.minimized .tara-face { border-color: rgba(255, 255, 255, 0.18) !important; }
.tara-widget.minimized .tara-face:hover { transform: translateY(-2px) scale(1.04); }
.tara-widget.minimized .tara-face:focus-visible { outline: 2px solid var(--s-accent); outline-offset: 3px; }

/* Open chat: frosted window like every other window */
.tara-widget:not(.minimized),
body.dark-mode .tara-widget:not(.minimized) {
  border: 1px solid var(--s-glass-border) !important;
  border-radius: 16px !important;
  background: var(--s-glass) !important;
  box-shadow: 0 0 0 1px var(--s-glass-edge), var(--s-shadow-pop) !important;
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  backdrop-filter: blur(22px) saturate(1.5);
  overflow: hidden !important;
  color: var(--s-text) !important;
}
.tara-widget:not(.minimized) header,
body.dark-mode .tara-widget:not(.minimized) header {
  background: var(--tara-grad) !important;
  color: #fff !important;
  border: 0 !important;
}
.tara-widget:not(.minimized) header strong,
.tara-widget:not(.minimized) header span { color: #fff !important; }
.tara-widget:not(.minimized) header span { opacity: 0.85; }
.tara-widget:not(.minimized) .tara-face,
body.dark-mode .tara-widget:not(.minimized) .tara-face {
  background: rgba(255, 255, 255, 0.92) !important;
  color: #7c5cff !important;
  border: 0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
}
body.dark-mode .tara-widget:not(.minimized) .tara-face { background: rgba(20, 14, 32, 0.85) !important; color: #c9bcff !important; }
#minimize-tara,
body.dark-mode #minimize-tara {
  display: inline-grid; place-items: center;
  width: 28px !important; height: 28px !important;
  padding: 0 !important;
  border: 1px solid rgba(255, 255, 255, 0.45) !important;
  border-radius: 7px !important;
  background: rgba(255, 255, 255, 0.18) !important;
  color: #fff !important;
}
#minimize-tara:hover { background: rgba(255, 255, 255, 0.3) !important; }
.tara-widget .tara-body,
.tara-widget .tara-messages,
body.dark-mode .tara-widget .tara-body,
body.dark-mode .tara-widget .tara-messages { background: transparent !important; }
.tara-widget .tara-messages .message,
body.dark-mode .tara-widget .tara-messages .message {
  background: var(--tara-bubble) !important;
  color: var(--s-text) !important;
  border: 1px solid var(--s-card-edge) !important;
  border-radius: 12px 12px 12px 4px !important;
  box-shadow: none !important;
}
.tara-widget .tara-messages .message.user,
body.dark-mode .tara-widget .tara-messages .message.user {
  background: var(--tara-grad) !important;
  color: #fff !important;
  border: 0 !important;
  border-radius: 12px 12px 4px 12px !important;
}
.tara-widget #tara-form,
body.dark-mode .tara-widget #tara-form {
  background: transparent !important;
  border-top: 1px solid var(--s-card-edge) !important;
}
.tara-widget #tara-input,
body.dark-mode .tara-widget #tara-input {
  background: var(--tara-bubble) !important;
  color: var(--s-text) !important;
  border: 1px solid var(--s-border-strong) !important;
  border-radius: 10px !important;
}
.tara-widget #tara-input::placeholder { color: var(--s-text-3) !important; }
.tara-widget #tara-input:focus { outline: none; border-color: var(--s-accent) !important; box-shadow: 0 0 0 3px var(--s-accent-soft) !important; }
.tara-widget #tara-form button[type="submit"],
body.dark-mode .tara-widget #tara-form button[type="submit"] {
  background: var(--tara-grad) !important;
  color: #fff !important;
  border: 0 !important;
  border-radius: 10px !important;
  box-shadow: none !important;
}
.tara-resize-handle { background: transparent !important; }

/* ===== v09: tinted tiles, aligned top buttons, page controls sized to the X ===== */
/* Tile = soft tint of its own colour; alpha-based so it reads well in light and dark */
.saas-tile {
  --tone: var(--s-accent);
  position: relative;
  border-radius: 12px !important;
  border: 1px solid color-mix(in srgb, var(--tone) 22%, transparent) !important;
  background: linear-gradient(140deg, color-mix(in srgb, var(--tone) 16%, transparent) 0%, color-mix(in srgb, var(--tone) 5%, transparent) 100%) !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset !important;
  overflow: hidden;
}
body.dark-mode .saas-tile { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset !important; }
.saas-tile::before { display: none !important; }
.saas-tile[data-series="a"] { --tone: var(--s-series-a); }
.saas-tile[data-series="b"] { --tone: var(--s-series-b); }
.saas-tile[data-series="c"] { --tone: var(--s-series-c); }
.saas-tile[data-state="ready"] { --tone: var(--s-paid-dot); }
.saas-tile[data-state="issue"] { --tone: var(--s-failed-dot); }
.saas-tile[data-state="watch"] { --tone: var(--s-pending-dot); }
.saas-tile[data-state="open"] { --tone: var(--s-idle-dot); }

/* Responses tiles: number + label with a colour dot */
.saas-mini-stats.saas-tiles > .saas-tile { padding: 9px 12px !important; }
.saas-mini-stats.saas-tiles > .saas-tile strong { font-size: 1.2rem !important; }
.saas-mini-stats.saas-tiles > .saas-tile span { display: inline-flex; align-items: center; gap: 6px; }
.saas-mini-stats.saas-tiles > .saas-tile span::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tone); flex: 0 0 7px;
}

/* System health tiles: compact, name on top, status pill below; fits the one-row panel */
.saas-health-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.saas-health-tile {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  height: 46px;
  padding: 0 10px;
  cursor: default;
}
.saas-tile-name {
  font-size: 0.76rem;
  font-weight: 650;
  color: var(--s-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.saas-tile-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  color: color-mix(in srgb, var(--tone) 75%, var(--s-text));
}
.saas-tile-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 20%, transparent); }
#view-overview .dashboard-health-panel.dashboard-topic-visible { overflow: visible !important; }

/* Dashboard shortcut boxes in the same tile look */
.dashboard-shortcut,
body.dark-mode .dashboard-shortcut {
  border-radius: 12px !important;
  border: 1px solid color-mix(in srgb, var(--s-accent) 22%, transparent) !important;
  background: linear-gradient(140deg, color-mix(in srgb, var(--s-accent) 14%, transparent), color-mix(in srgb, var(--s-accent) 4%, transparent)) !important;
}

/* Top-right: search sits on the same line and in the same style as bell / DE / theme */
@media all { /* v18: was min-width 761px */
  .topbar .search { top: -5px !important; }
}
.quick-icon-button,
body.dark-mode .quick-icon-button,
.topbar #global-search:not(:focus),
body.dark-mode .topbar #global-search:not(:focus) {
  background-color: var(--s-glass) !important;
  border: 1px solid var(--s-glass-border) !important;
  box-shadow: 0 0 0 1px var(--s-glass-edge), 0 4px 14px rgba(40, 20, 80, 0.10) !important;
  color: var(--s-accent) !important;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

/* Page head controls: same 28px height as the X */
.saas-page-actions .saas-btn,
.saas-page-actions .saas-health,
.saas-page-actions [data-view-save] {
  min-height: 28px !important;
  height: 28px !important;
  padding: 0 11px !important;
  font-size: 0.8rem !important;
  border-radius: 7px !important;
}
.saas-page-actions .saas-segmented { padding: 2px !important; border-radius: 8px !important; }
.saas-page-actions .saas-segmented button {
  min-height: 22px !important;
  height: 22px !important;
  min-width: 34px !important;
  padding: 0 8px !important;
  font-size: 0.76rem !important;
  border-radius: 5px !important;
}
.saas-page-actions .tag { min-height: 28px; display: inline-flex; align-items: center; font-size: 0.76rem; }
/* the visible search circle is the label's ::before icon: give it the same glass as its neighbours */
.topbar .search::before,
body.dark-mode .topbar .search::before {
  background: var(--s-glass) !important;
  border: 1px solid var(--s-glass-border) !important;
  box-shadow: 0 0 0 1px var(--s-glass-edge), 0 4px 14px rgba(40, 20, 80, 0.10) !important;
  color: var(--s-accent) !important;
  box-sizing: border-box;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.quick-icon-button, body.dark-mode .quick-icon-button { color: var(--s-text) !important; }
.topbar .search::before { color: var(--s-text) !important; }
.saas-mini-stats > div.saas-tile,
body.dark-mode .saas-mini-stats > div.saas-tile {
  border: 1px solid color-mix(in srgb, var(--tone) 22%, transparent) !important;
  background: linear-gradient(140deg, color-mix(in srgb, var(--tone) 16%, transparent) 0%, color-mix(in srgb, var(--tone) 5%, transparent) 100%) !important;
}

/* ===== v10 ===== */
/* 2. System health: one-line tiles (dot + name), pulsing like a siren */
.saas-health-tile {
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  height: auto !important;
  min-height: 32px;
  padding: 7px 10px !important;
  animation: saas-siren 2.4s ease-in-out infinite;
}
.saas-health-tile:nth-child(2) { animation-delay: 0.3s; }
.saas-health-tile:nth-child(3) { animation-delay: 0.6s; }
.saas-health-tile:nth-child(4) { animation-delay: 0.9s; }
.saas-tile-dot {
  flex: 0 0 9px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--tone);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 22%, transparent);
  animation: saas-siren-dot 2.4s ease-in-out infinite;
  animation-delay: inherit;
}
.saas-health-tile .saas-tile-name { font-size: 0.82rem; }
@keyframes saas-siren {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--tone) 0%, transparent), 0 1px 0 rgba(255,255,255,0.3) inset; }
  50% { box-shadow: 0 0 16px 2px color-mix(in srgb, var(--tone) 45%, transparent), 0 1px 0 rgba(255,255,255,0.3) inset; }
}
@keyframes saas-siren-dot {
  0%, 100% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--tone) 18%, transparent); }
  50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--tone) 35%, transparent), 0 0 10px 2px var(--tone); }
}
.saas-health-tile.saas-tile { overflow: visible !important; }
#view-overview .dashboard-health-panel .saas-health-tiles { padding: 2px; }

/* 4. Tara launcher: glows up, fades, glows again */
.tara-widget.minimized .tara-face { animation: tara-siren 2.6s ease-in-out infinite; }
@keyframes tara-siren {
  0%, 100% { box-shadow: 0 4px 12px rgba(124, 92, 255, 0.18), 0 0 0 0 rgba(233, 139, 150, 0); }
  50% { box-shadow: 0 8px 26px rgba(124, 92, 255, 0.45), 0 0 0 10px rgba(233, 139, 150, 0.18), 0 0 30px 6px rgba(255, 150, 110, 0.35); }
}
body.dark-mode .tara-widget.minimized .tara-face { animation-name: tara-siren-dark; }
@keyframes tara-siren-dark {
  0%, 100% { box-shadow: 0 4px 14px rgba(139, 116, 245, 0.25), 0 0 0 0 rgba(179, 90, 216, 0); }
  50% { box-shadow: 0 8px 30px rgba(139, 116, 245, 0.6), 0 0 0 10px rgba(179, 90, 216, 0.22), 0 0 34px 8px rgba(139, 116, 245, 0.45); }
}
@media (prefers-reduced-motion: reduce) {
  .saas-health-tile, .saas-tile-dot, .tara-widget.minimized .tara-face { animation: none !important; }
}

/* 3. Scrollbar always visible, in its own lane beside the cards, above the content */
/* Chrome/Safari use the ::-webkit-scrollbar rules below (classic, always visible); the standard
   properties would switch Chrome back to overlay scrollbars, so they are for Firefox only. */
@supports not selector(::-webkit-scrollbar) {
  .view, #view-overview.active, .saas-notify-list, .tara-messages, .drawer-card, .saas-colmenu-pop, #add-contact-form .saas-form-grid {
    scrollbar-width: auto;
    scrollbar-color: color-mix(in srgb, var(--s-accent) 55%, transparent) transparent;
  }
}
.view::-webkit-scrollbar, #view-overview.active::-webkit-scrollbar, .saas-notify-list::-webkit-scrollbar, .tara-messages::-webkit-scrollbar, .drawer-card::-webkit-scrollbar, .saas-colmenu-pop::-webkit-scrollbar, #add-contact-form .saas-form-grid::-webkit-scrollbar { width: 10px; height: 10px; }
.view::-webkit-scrollbar-track, #view-overview.active::-webkit-scrollbar-track, .saas-notify-list::-webkit-scrollbar-track, .tara-messages::-webkit-scrollbar-track, .drawer-card::-webkit-scrollbar-track, .saas-colmenu-pop::-webkit-scrollbar-track, #add-contact-form .saas-form-grid::-webkit-scrollbar-track { background: transparent; }
.view::-webkit-scrollbar-thumb, #view-overview.active::-webkit-scrollbar-thumb, .saas-notify-list::-webkit-scrollbar-thumb, .tara-messages::-webkit-scrollbar-thumb, .drawer-card::-webkit-scrollbar-thumb, .saas-colmenu-pop::-webkit-scrollbar-thumb, #add-contact-form .saas-form-grid::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--s-accent) 50%, transparent);
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}
.view::-webkit-scrollbar-thumb:hover, #view-overview.active::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--s-accent) 75%, transparent); }
.view.active:not(#view-overview) { scrollbar-gutter: stable; padding-right: 6px !important; }

/* 1. Search button: same 6px gap to the bell as between bell, DE and theme */
@media all { /* v18: was min-width 761px */
  .topbar .search { right: 138px !important; }
}
.saas-health-tile { padding: 7px 8px !important; gap: 6px !important; }
.saas-health-tiles { gap: 6px !important; }
.saas-health-tile .saas-tile-name { font-size: clamp(0.72rem, 0.85vw, 0.82rem); }

/* ===== v11 ===== */
/* Calendar: fills its panel, month navigation, no clipped weeks */
#view-overview .dashboard-calendar-panel.dashboard-topic-visible { display: flex !important; flex-direction: column; }
#view-overview .dashboard-calendar-panel .panel-header { flex: 0 0 auto; margin: 0 0 6px !important; }
#dashboard-calendar { flex: 1 1 auto; min-height: 0; display: flex; }
.saas-cal { display: flex; flex-direction: column; gap: 8px; width: 100%; min-height: 0; color: var(--s-text); }
.saas-cal-head { display: flex; align-items: center; gap: 6px; }
.saas-cal-head strong { font-size: 0.95rem; font-weight: 650; min-width: 0; text-transform: capitalize; }
.saas-cal-nav, .saas-cal-today {
  display: inline-grid; place-items: center;
  height: 28px; min-width: 28px; padding: 0 8px;
  border: 1px solid var(--s-card-edge); border-radius: 7px;
  background: var(--s-head-glass); color: var(--s-text);
  font: 600 0.9rem/1 inherit; font-family: inherit; cursor: pointer;
}
.saas-cal-today { font-size: 0.76rem; }
.saas-cal-nav:hover, .saas-cal-today:hover { background: var(--s-accent-soft); color: var(--s-accent); }
.saas-cal-total { margin-left: auto; font-size: 0.76rem; color: var(--s-text-3); white-space: nowrap; }
.saas-cal-legend { display: flex; flex-wrap: wrap; gap: 3px 12px; }
.saas-cal-legend span { display: inline-flex; align-items: center; gap: 5px; font-size: 0.72rem; font-weight: 600; color: var(--s-text-2); }
.saas-cal-legend i, .saas-cal-dots i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.saas-cal-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: auto repeat(var(--weeks), minmax(0, 1fr));
  gap: 4px;
}
.saas-cal-wd { font-size: 0.68rem; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--s-text-3); text-align: center; padding-bottom: 2px; }
.saas-cal-day {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 0; padding: 4px 6px;
  border: 1px solid var(--s-card-edge); border-radius: 8px;
  background: var(--s-head-glass);
  color: var(--s-text); font: inherit; text-align: left;
}
.saas-cal-day.is-blank { background: transparent; border-color: transparent; }
.saas-cal-num { font-size: 0.8rem; font-weight: 650; }
.saas-cal-day.is-today { border-color: var(--s-accent); box-shadow: 0 0 0 1px var(--s-accent) inset; }
.saas-cal-day.is-today .saas-cal-num { color: var(--s-accent); }
.saas-cal-day.has-items { cursor: pointer; background: color-mix(in srgb, var(--s-accent) 10%, transparent); border-color: color-mix(in srgb, var(--s-accent) 28%, transparent); }
.saas-cal-day.has-items:hover { background: color-mix(in srgb, var(--s-accent) 18%, transparent); }
.saas-cal-count {
  position: absolute; top: 4px; right: 5px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--s-accent); color: #fff;
  font-size: 0.66rem; font-weight: 700; line-height: 16px; text-align: center;
}
.saas-cal-dots { display: flex; gap: 3px; flex-wrap: wrap; }

/* System health: always fits the one-row panel; smaller, slower glow */
#view-overview .dashboard-health-panel.dashboard-topic-visible { display: flex !important; flex-direction: column; }
#view-overview .dashboard-health-panel .dashboard-module-title { flex: 0 0 auto; }
#dashboard-health { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; }
.saas-health-tiles { width: 100%; padding: 0 !important; }
.saas-health-tile { min-height: 0 !important; height: clamp(26px, 100%, 36px) !important; padding: 0 8px !important; box-sizing: border-box; }
.saas-health-tile, .saas-tile-dot { animation-duration: 4s !important; }
.saas-tile-dot { flex-basis: 8px; width: 8px; height: 8px; }
@keyframes saas-siren {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--tone) 0%, transparent), 0 1px 0 rgba(255,255,255,0.3) inset; }
  50% { box-shadow: 0 0 7px 0 color-mix(in srgb, var(--tone) 35%, transparent), 0 1px 0 rgba(255,255,255,0.3) inset; }
}
@keyframes saas-siren-dot {
  0%, 100% { box-shadow: 0 0 0 1px color-mix(in srgb, var(--tone) 15%, transparent); }
  50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 28%, transparent), 0 0 5px 1px var(--tone); }
}

/* Hover information bubble */
.saas-hint {
  position: fixed; z-index: 400;
  max-width: 280px;
  display: flex; flex-direction: column; gap: 3px;
  padding: 9px 12px;
  border: 1px solid var(--s-glass-border);
  border-radius: 10px;
  background: var(--s-glass-strong, var(--s-glass));
  color: var(--s-text);
  box-shadow: 0 0 0 1px var(--s-glass-edge), var(--s-shadow-pop);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  pointer-events: none;
  font-size: 0.8rem;
  line-height: 1.35;
}
.saas-hint[hidden] { display: none; }
.saas-hint strong { font-size: 0.84rem; font-weight: 650; }
.saas-hint span { color: var(--s-text-2); }
body.dark-mode .saas-hint { background: rgba(28, 22, 40, 0.9); }
body:not(.dark-mode) .saas-hint { background: rgba(255, 255, 255, 0.92); }

/* Drawer detail chart in the dashboard style */
.foreground-chart,
body.dark-mode .foreground-chart {
  padding: 14px 16px 10px !important;
  border: 1px solid var(--s-card-edge) !important;
  border-radius: 12px !important;
  background: var(--s-card-glass) !important;
  box-shadow: none !important;
}
.saas-drawer-chart { display: flex; flex-direction: column; gap: 8px; }
.saas-drawer-chart .saas-inline-legend { margin-left: 0; }
.saas-drawer-chart .saas-chart { padding: 0; }
.saas-drawer-chart .saas-chart svg { width: 100% !important; height: auto !important; }
.drawer-card .chart-axis-note { display: none !important; }

/* ===== v12 ===== */
/* Hover info: a little see-through */
body.dark-mode .saas-hint { background: rgba(28, 22, 40, 0.72) !important; }
body:not(.dark-mode) .saas-hint { background: rgba(255, 255, 255, 0.72) !important; }
.saas-hint { -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4); }

/* System health: taller first dashboard row so the boxes are never cut off */
@media all { /* v18: was min-width 761px */
  #view-overview.active { grid-template-rows: minmax(0, 1.5fr) repeat(7, minmax(0, 1fr)) !important; }
  #view-overview.active.dashboard-extended { grid-template-rows: calc(var(--row-h) * 1.5) repeat(7, var(--row-h)) !important; }
}
.saas-health-tile { height: 38px !important; min-height: 38px !important; }
#dashboard-health { align-items: flex-start; padding-top: 2px; }
#view-overview .dashboard-health-panel.dashboard-topic-visible { overflow: visible !important; }

/* Tara: brighter, bigger glow */
@keyframes tara-siren {
  0%, 100% { box-shadow: 0 4px 14px rgba(124, 92, 255, 0.25), 0 0 0 0 rgba(233, 139, 150, 0); }
  50% { box-shadow: 0 10px 34px rgba(124, 92, 255, 0.7), 0 0 0 16px rgba(233, 139, 150, 0.22), 0 0 56px 18px rgba(255, 150, 110, 0.55); }
}
@keyframes tara-siren-dark {
  0%, 100% { box-shadow: 0 4px 16px rgba(139, 116, 245, 0.35), 0 0 0 0 rgba(179, 90, 216, 0); }
  50% { box-shadow: 0 10px 38px rgba(139, 116, 245, 0.85), 0 0 0 16px rgba(179, 90, 216, 0.28), 0 0 60px 20px rgba(139, 116, 245, 0.65); }
}

/* ===== v13: Users page, compact permission matrix ===== */
#view-users .users-table { display: block; padding: 0; }
.saas-users-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; color: var(--s-text); }
.saas-users-table th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--s-card-edge);
  background: var(--s-head-glass);
  color: var(--s-text-3);
  font-size: 0.7rem; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase;
  text-align: left; white-space: nowrap;
}
.saas-users-table td { padding: 10px 12px; border-bottom: 1px solid var(--s-card-edge); vertical-align: middle; }
.saas-users-table tbody tr:last-child td { border-bottom: 0; }
.saas-users-table tbody tr:hover td { background: var(--s-bg-hover); }
.saas-users-table th.saas-users-cell, .saas-users-table td.saas-users-cell { text-align: center; width: 1%; }
.saas-users-table .saas-person small { white-space: nowrap; }
/* Small switch */
.saas-switch { position: relative; display: inline-block; width: 30px; height: 17px; cursor: pointer; vertical-align: middle; }
.saas-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; }
.saas-switch span {
  position: absolute; inset: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--s-text-3) 35%, transparent);
  transition: background-color 140ms ease;
}
.saas-switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 13px; height: 13px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 140ms ease;
}
.saas-switch input:checked + span { background: var(--s-paid-dot); }
.saas-switch input:checked + span::after { transform: translateX(13px); }
.saas-switch input:focus-visible + span { outline: 2px solid var(--s-accent); outline-offset: 2px; }
.saas-switch.is-locked { cursor: not-allowed; opacity: 0.55; }
.saas-switch input:disabled { cursor: not-allowed; }
.saas-users-table { table-layout: auto; }
.saas-users-table th.saas-users-cell, .saas-users-table td.saas-users-cell { width: auto; min-width: 76px; padding-left: 6px; padding-right: 6px; }
.saas-users-table th:first-child, .saas-users-table td:first-child { width: 220px; min-width: 200px; }
.saas-users-table th.saas-users-cell { font-size: 0.66rem; letter-spacing: 0.02em; }
#view-users [data-left-view-filters] { display: none !important; }

/* ===== v14: user accounts ===== */
.saas-users-actions { white-space: nowrap; }
.saas-icon-action {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; margin: 0 2px; padding: 0;
  border: 1px solid var(--s-card-edge); border-radius: 7px;
  background: var(--s-head-glass); color: var(--s-text-2);
  cursor: pointer;
}
.saas-icon-action:hover { background: var(--s-accent-soft); color: var(--s-accent); }
.saas-icon-action.is-danger:hover { background: var(--s-failed-bg); color: var(--s-failed-fg); border-color: color-mix(in srgb, var(--s-failed-dot) 40%, transparent); }
.saas-btn-danger { background: var(--s-failed-dot) !important; border-color: var(--s-failed-dot) !important; color: #fff !important; }
.saas-btn-danger:hover { filter: brightness(1.08); }
#user-dialog { width: min(560px, calc(100vw - 32px)); }
.saas-password-row { display: flex; gap: 6px; align-items: center; }
.saas-password-row input { flex: 1 1 auto; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.saas-password-row .saas-btn { flex: 0 0 auto; min-height: 36px; box-shadow: none; }
.saas-field-note { font-size: 0.76rem; color: var(--s-text-3); }
.saas-area-picks { margin: 0; padding: 10px 12px; border: 1px solid var(--s-card-edge); border-radius: 10px; }
.saas-area-picks[hidden] { display: none; }
.saas-area-picks legend { padding: 0 4px; font-size: 0.8rem; font-weight: 600; color: var(--s-text-2); }
#user-area-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 12px; margin-bottom: 8px; }
.saas-area-picks .saas-check { display: inline-flex !important; }
@media (max-width: 760px) { #user-area-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ===== v15: calendar page, contact groups, question dialog ===== */
.view [data-left-view-filters] { display: none !important; }

/* Calendar page */
#view-calendar.active { display: flex; flex-direction: column; gap: 16px; color: var(--s-text); }
.saas-calpage { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.saas-calpage-side { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.saas-calpage-side-head { display: flex; flex-direction: column; gap: 8px; }
.saas-calpage-side h3 { margin: 0; font-size: 0.9rem; font-weight: 650; color: var(--s-text); }
.saas-calpage-side .saas-btn { min-height: 30px; font-size: 0.8rem; }
.saas-calpage-list, .saas-calpage-upcoming { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.saas-calpage-list li { display: flex; align-items: center; gap: 6px; }
.saas-calpage-cal { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; padding: 5px 6px; border-radius: 7px; cursor: pointer; font-size: 0.84rem; }
.saas-calpage-cal:hover { background: var(--s-bg-hover); }
.saas-calpage-cal input { width: 15px; height: 15px; margin: 0; accent-color: var(--ev); flex: 0 0 15px; }
.saas-calpage-cal i { width: 10px; height: 10px; border-radius: 3px; background: var(--ev); flex: 0 0 10px; }
.saas-calpage-cal span { display: flex; flex-direction: column; min-width: 0; }
.saas-calpage-cal small { font-size: 0.7rem; color: var(--s-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saas-calpage-up-title { margin-top: 6px !important; }
.saas-calpage-upcoming li { display: flex; gap: 8px; align-items: flex-start; font-size: 0.8rem; }
.saas-calpage-upcoming li i { width: 4px; align-self: stretch; border-radius: 2px; background: var(--ev); flex: 0 0 4px; }
.saas-calpage-upcoming li span { display: flex; flex-direction: column; min-width: 0; }
.saas-calpage-upcoming strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saas-calpage-upcoming small, .saas-calpage-empty { color: var(--s-text-3); font-size: 0.74rem; }
.saas-calpage-main { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.saas-calpage-toolbar { display: flex; align-items: center; gap: 6px; }
.saas-calpage-toolbar strong { font-size: 1.05rem; font-weight: 650; margin-left: 6px; text-transform: capitalize; }
.saas-calpage-status { margin-left: auto; font-size: 0.76rem; color: var(--s-text-3); }
.saas-calpage-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: minmax(88px, auto); gap: 4px; }
.saas-calpage-grid .saas-calpage-wd { height: auto; font-size: 0.7rem; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--s-text-3); text-align: center; padding: 2px 0; }
.saas-calpage-grid > .saas-calpage-wd { grid-row: 1; min-height: 0; }
.saas-calpage-day {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  padding: 4px 5px; border: 1px solid var(--s-card-edge); border-radius: 8px;
  background: var(--s-head-glass); cursor: pointer;
}
.saas-calpage-day:hover { border-color: color-mix(in srgb, var(--s-accent) 30%, transparent); }
.saas-calpage-day.is-other { opacity: 0.45; }
.saas-calpage-day.is-today { border-color: var(--s-accent); box-shadow: 0 0 0 1px var(--s-accent) inset; }
.saas-calpage-num { font-size: 0.78rem; font-weight: 650; color: var(--s-text); }
.saas-calpage-day.is-today .saas-calpage-num { color: var(--s-accent); }
.saas-calpage-event {
  display: flex; align-items: center; gap: 5px; width: 100%; min-width: 0;
  padding: 2px 5px; border: 0; border-radius: 5px;
  background: color-mix(in srgb, var(--ev) 16%, transparent);
  color: var(--s-text); font: 500 0.72rem/1.3 inherit; font-family: inherit; text-align: left; cursor: pointer;
}
.saas-calpage-event:hover { background: color-mix(in srgb, var(--ev) 28%, transparent); }
.saas-calpage-event i { width: 6px; height: 6px; border-radius: 50%; background: var(--ev); flex: 0 0 6px; }
.saas-calpage-event span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saas-calpage-more { border: 0; background: none; padding: 0 5px; color: var(--s-accent); font: 600 0.7rem/1.3 inherit; font-family: inherit; text-align: left; cursor: pointer; }
.saas-calpage-detail { display: flex; gap: 10px; padding: 10px 12px; border: 1px solid var(--s-card-edge); border-radius: 10px; background: var(--s-head-glass); }
.saas-calpage-detail i { width: 4px; border-radius: 2px; background: var(--ev); flex: 0 0 4px; }
.saas-calpage-detail div { display: flex; flex-direction: column; gap: 2px; }
.saas-calpage-detail span { font-size: 0.82rem; color: var(--s-text-2); }
.saas-color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.saas-color-swatch { position: relative; width: 26px; height: 26px; cursor: pointer; }
.saas-color-swatch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.saas-color-swatch span { position: absolute; inset: 0; border-radius: 50%; background: var(--ev); box-shadow: 0 0 0 2px var(--s-bg-card); }
.saas-color-swatch input:checked + span { box-shadow: 0 0 0 2px var(--s-bg-card), 0 0 0 4px var(--ev); }
.saas-help { font-size: 0.8rem; color: var(--s-text-2); }
.saas-help summary { cursor: pointer; font-weight: 600; color: var(--s-accent); }
.saas-help ol { margin: 6px 0; padding-left: 18px; }
.saas-help p { margin: 4px 0 0; color: var(--s-text-3); }
@media (max-width: 1000px) { .saas-calpage { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .saas-calpage-grid { grid-auto-rows: minmax(58px, auto); } .saas-calpage-event span { display: none; } }

/* Contact selection + groups */
.saas-check-col { width: 34px; padding-right: 0 !important; }
.saas-row-check { width: 16px; height: 16px; margin: 0; accent-color: var(--s-accent); cursor: pointer; }
#view-contacts .saas-table tbody tr.is-selected td { background: color-mix(in srgb, var(--s-accent) 8%, transparent); }
.saas-selection-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 16px; border-bottom: 1px solid var(--s-card-edge);
  background: color-mix(in srgb, var(--s-accent) 8%, transparent);
}
.saas-selection-bar[hidden] { display: none; }
.saas-selection-bar strong { font-size: 0.85rem; margin-right: 4px; }
.saas-selection-bar .saas-select, #contact-group-filter { width: auto; min-height: 32px; margin: 0; }
.saas-group-item { display: flex; align-items: center; gap: 4px; }
.saas-group-item .newsletter-group { flex: 1 1 auto; }
.saas-group-actions { display: inline-flex; gap: 2px; }
#ask-dialog .saas-form-grid { padding-top: 4px; }
#ask-input[hidden] { display: none; }
#ask-input { width: 100%; min-height: 36px; padding: 0 12px; border: 1px solid var(--s-border-strong); border-radius: 8px; background: var(--s-bg-card); color: var(--s-text); font: inherit; box-sizing: border-box; }
.saas-calpage-grid { grid-template-rows: auto; grid-auto-rows: minmax(84px, auto); }
#calendar-card[hidden] { display: none !important; }
.saas-calpage-event { font-size: 0.7rem; }

/* ===== v16: manual appointments + Google account ===== */
.saas-google-box { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--s-card-edge); }
.saas-google-box:empty { display: none; }
.saas-google-note { margin: 0; font-size: 0.76rem; color: var(--s-text-3); line-height: 1.4; }
.saas-google-note.is-error { color: var(--s-failed-fg); }
.saas-google-account { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 600; color: var(--s-text-2); }
.saas-google-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--s-paid-dot); box-shadow: 0 0 0 3px var(--s-paid-bg); }
.saas-google-box .saas-btn { min-height: 30px; font-size: 0.8rem; }
.saas-google-box .saas-link-btn { align-self: flex-start; color: var(--s-failed-fg); }
.saas-day-new { align-self: flex-start; min-height: 32px; }
.saas-calpage-detail { position: relative; }
.saas-detail-edit { position: absolute; top: 8px; right: 8px; }
.saas-google-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--s-paid-bg); color: var(--s-paid-fg); font-size: 0.68rem; font-weight: 650; vertical-align: middle; }
.saas-calpage-status.is-error { color: var(--s-failed-fg); }
.saas-calpage-status:not(:empty):not(.is-error) { color: var(--s-paid-fg); font-weight: 600; }
#appointment-dialog { width: min(600px, calc(100vw - 32px)); }
#appointment-form { display: flex; flex-direction: column; max-height: min(88vh, 860px); }
#appointment-form .saas-form-grid { overflow-y: auto; }
.saas-form-grid textarea { width: 100%; box-sizing: border-box; padding: 8px 12px; border: 1px solid var(--s-border-strong); border-radius: 8px; background: var(--s-bg-card); color: var(--s-text); font: inherit; resize: vertical; }
.saas-form-grid textarea:focus { outline: none; border-color: var(--s-accent); box-shadow: 0 0 0 3px var(--s-accent-soft); }
#appointment-form .saas-dialog-foot > .saas-btn-danger[hidden] + div { margin-left: auto; }
.saas-calpage-side-head { flex-direction: column; }
.saas-btn[hidden] { display: none !important; }
.saas-google-box .saas-link-btn { font-size: 0.78rem !important; padding: 2px 0; }

/* ===== v17: admin setup card ===== */
.saas-admin-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; margin-top: 16px; color: var(--s-text); }
.saas-admin-card[hidden] { display: none; }
.saas-admin-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.saas-admin-head h3 { margin: 0; font-size: 1rem; font-weight: 650; }
.saas-admin-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 0.86rem; line-height: 1.45; color: var(--s-text-2); }
.saas-copy-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.saas-copy-row code {
  padding: 6px 10px; border: 1px solid var(--s-card-edge); border-radius: 7px;
  background: var(--s-head-glass); color: var(--s-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; user-select: all; overflow-wrap: anywhere;
}
.saas-copy-row .saas-btn { min-height: 30px; font-size: 0.78rem; box-shadow: none; }
.saas-setup-link { align-self: flex-start; font-size: 0.78rem !important; padding: 2px 0; }

/* ===================================================================
   v18: tablets and phones.
   The desktop design above now applies at every width; this layer only
   re-arranges it for touch screens. Compact = up to 1099px (tablets,
   landscape phones); phone = up to 760px.
   =================================================================== */
:root { --m-bar: 56px; --m-safe-top: env(safe-area-inset-top, 0px); --m-safe-bottom: env(safe-area-inset-bottom, 0px); --m-gutter: 16px; }
@media (max-width: 1099px) {
  html, body {
    height: auto !important;
    min-height: 100%;
    overflow-x: hidden !important;
    overflow-y: visible !important;
  }
  body { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
  .shell, .shell.sidebar-collapsed {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 100dvh !important;
    overflow: visible !important;
  }

  /* Menu: slides in from the left, full height, over a dimmed page */
  .sidebar, .shell.sidebar-collapsed .sidebar, .shell.mobile-nav-open .sidebar {
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    z-index: 150 !important;
    display: flex !important;
    flex-direction: column;
    width: min(300px, 86vw) !important;
    height: 100dvh !important;
    max-height: none !important;
    padding: calc(14px + var(--m-safe-top)) 14px calc(14px + var(--m-safe-bottom)) !important;
    gap: 12px;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    border-radius: 0 20px 20px 0 !important;
    opacity: 1 !important;
    transform: translateX(-104%) !important;
    visibility: hidden;
    pointer-events: none;
    transition: transform 220ms cubic-bezier(.2,.8,.2,1), visibility 0s linear 220ms !important;
  }
  .shell.mobile-nav-open .sidebar {
    transform: none !important;
    visibility: visible;
    pointer-events: auto;
    transition: transform 220ms cubic-bezier(.2,.8,.2,1), visibility 0s !important;
    box-shadow: 24px 0 70px rgba(5, 6, 14, 0.38) !important;
  }
  .sidebar .nav, .shell.mobile-nav-open .sidebar .nav { display: grid !important; gap: 4px; margin-top: 4px; }
  .sidebar .primary-action, .sidebar-footer { display: flex !important; }
  .sidebar-footer { margin-top: auto; }
  .mobile-menu-head { display: flex !important; justify-content: space-between !important; align-items: center; min-height: 44px; }
  .mobile-menu-head strong, .mobile-menu-close { display: block !important; }
  .mobile-menu-close { width: 40px !important; height: 40px !important; }
  .sidebar .nav-item { min-height: 48px !important; padding: 10px 12px !important; font-size: 15px !important; }
  .sidebar .primary-action { min-height: 46px; justify-content: center; }
  .shell.mobile-nav-open::before {
    display: block !important;
    position: fixed;
    inset: 0;
    z-index: 149;
    background: rgba(12, 9, 22, 0.42);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    content: "";
  }
  body.mobile-nav-lock { overflow: hidden !important; }

  /* Page area: the whole page scrolls (no scroll box inside a scroll box) */
  .main {
    position: static !important;
    width: 100% !important;
    height: auto !important;
    min-height: 100dvh;
    margin: 0 !important;
    padding: calc(var(--m-bar) + var(--m-safe-top) + 12px) var(--m-gutter) calc(96px + var(--m-safe-bottom)) !important;
    overflow: visible !important;
  }
  .view.active, .view.active:not(#view-overview) {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    scrollbar-gutter: auto !important;
  }

  /* Top bar: one glass strip, all controls 40px touch targets */
  .topbar {
    position: fixed !important;
    inset: 0 0 auto 0 !important;
    z-index: 90 !important;
    display: block !important;
    height: calc(var(--m-bar) + var(--m-safe-top)) !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: var(--s-glass-strong, rgba(255,255,255,.62)) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    backdrop-filter: blur(18px) saturate(1.3);
    border-bottom: 1px solid var(--s-card-edge, rgba(110, 90, 150, 0.10)) !important;
  }
  .menu-button {
    position: fixed !important;
    top: calc(var(--m-safe-top) + 8px) !important;
    left: 12px !important;
    z-index: 95 !important;
    display: grid !important;
    width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 11px 10px !important;
    border-radius: 12px !important;
  }
  .dashboard-home-button {
    position: fixed !important;
    top: calc(var(--m-safe-top) + 8px) !important;
    left: 60px !important;
    z-index: 95 !important;
    min-height: 40px !important;
    height: 40px;
    padding: 0 14px !important;
    border-radius: 12px !important;
  }
  .quick-ui-toggles {
    position: fixed !important;
    top: calc(var(--m-safe-top) + 8px) !important;
    right: 12px !important;
    z-index: 95 !important;
    gap: 6px !important;
  }
  .quick-icon-button { width: 40px !important; min-width: 40px !important; height: 40px !important; min-height: 40px !important; }
  .topbar .search {
    position: fixed !important;
    top: calc(var(--m-safe-top) + 8px) !important;
    right: 150px !important;
    z-index: 96 !important;
    width: 40px !important;
    height: 40px;
  }
  .topbar .search::before { width: 40px !important; height: 40px !important; }
  .topbar .search input { width: 40px !important; min-height: 40px !important; height: 40px; }
  .topbar .search:focus-within input,
  .topbar .search input:not(:placeholder-shown) {
    position: fixed;
    top: calc(var(--m-safe-top) + 8px);
    left: 12px;
    right: 12px;
    width: auto !important;
    font-size: 16px !important;
    padding: 8px 16px !important;
    opacity: 1 !important;
  }
  .topbar .search:focus-within::before, .topbar .search:has(input:not(:placeholder-shown))::before { opacity: 0; }
  .topbar .global-search-results {
    position: fixed !important;
    top: calc(var(--m-safe-top) + var(--m-bar) + 4px) !important;
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    max-height: calc(100dvh - var(--m-bar) - var(--m-safe-top) - 24px);
    overflow-y: auto;
  }
  .page-heading, .profile-button { display: none !important; }

  /* Dashboard: panels flow top to bottom instead of one fixed screen */
  #view-overview.active, #view-overview.active.dashboard-extended {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: none !important;
    grid-auto-rows: auto !important;
    grid-auto-flow: row dense !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    gap: 12px !important;
    padding: 0 !important;
  }
  #view-overview [data-dashboard-topic].dashboard-topic-visible {
    grid-column: auto !important;
    grid-row: auto !important;
    min-height: 0;
    padding: 14px !important;
    overflow: hidden;
  }
  #view-overview [data-dashboard-topic="health"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="email"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="replies"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="integrations"].dashboard-topic-visible { grid-column: 1 / -1 !important; }
  #view-overview .dashboard-health-panel.dashboard-topic-visible { overflow: visible !important; }
}

/* Phones */
@media (max-width: 760px) {
  :root { --m-gutter: 12px; }
  #view-overview.active, #view-overview.active.dashboard-extended { grid-template-columns: minmax(0, 1fr) !important; }
  #view-overview [data-dashboard-topic].dashboard-topic-visible { grid-column: 1 / -1 !important; }
}
@media (max-width: 380px) {
  .quick-icon-button { width: 36px !important; min-width: 36px !important; height: 36px !important; min-height: 36px !important; }
  .quick-ui-toggles { gap: 4px !important; top: calc(var(--m-safe-top) + 10px) !important; }
  .topbar .search { right: 132px !important; top: calc(var(--m-safe-top) + 10px) !important; width: 36px !important; }
  .topbar .search::before, .topbar .search input { width: 36px !important; height: 36px !important; min-height: 36px !important; }
  .dashboard-home-button { padding: 0 10px !important; font-size: 13px !important; }
}
@media (max-width: 1099px) {
  .topbar .search { margin: 0 !important; }
  /* dashboard calendar: real week rows instead of squeezing into a fixed box */
  #view-overview .dashboard-calendar-panel .dashboard-calendar,
  #dashboard-calendar { overflow: visible !important; height: auto !important; }
  #dashboard-calendar .saas-cal-grid { grid-template-rows: auto repeat(var(--weeks), minmax(44px, auto)) !important; flex: 0 0 auto; }
  #view-overview .dashboard-calendar-panel.dashboard-topic-visible { overflow: visible !important; }
}
@media (max-width: 760px) {
  .saas-health-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .saas-health-tile { height: 40px !important; min-height: 40px !important; }
  .saas-health-tile .saas-tile-name { font-size: 0.85rem !important; }
  .saas-mini-stats { gap: 6px; }
  .saas-mini-stats div { padding: 8px !important; }
  .saas-mini-stats span { font-size: 0.72rem !important; line-height: 1.25; overflow-wrap: normal; hyphens: auto; }
  .saas-rings { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px !important; }
  .saas-ring { grid-template-columns: 1fr !important; justify-items: center; text-align: center; row-gap: 4px; }
  .saas-ring svg { grid-row: auto !important; width: 48px !important; height: 48px !important; }
}

/* ---- v18 compact: menu glass, page heads, touch sizes ---- */
@media (max-width: 1099px) {
  .sidebar, body.dark-mode .sidebar { background: color-mix(in srgb, var(--s-bg-card) 94%, transparent) !important; }
  .view > .saas-page-head { position: relative; gap: 12px; margin-bottom: 14px; align-items: flex-start; }
  .saas-page-head > div:first-child { min-width: 0; flex: 1 1 220px; padding-right: 52px; }
  .saas-page-title { font-size: 1.35rem; }
  .saas-page-actions { flex: 1 1 100%; justify-content: flex-start !important; gap: 8px; }
  /* the X stays top-right of every page */
  .saas-page-bar { position: absolute; top: 0; right: 0; margin: 0 !important; padding: 0 !important; border: 0 !important; gap: 8px; }
  .saas-page-bar [data-view-close] { width: 40px !important; height: 40px !important; min-height: 40px !important; }
  .saas-dirty-note { display: none !important; }
  /* unsaved changes: a big Save button at the bottom of the screen, above everything but Tara */
  .saas-page-bar [data-view-save] { display: none !important; }
  .saas-page-bar [data-view-save]:not(:disabled) {
    display: inline-flex !important;
    position: fixed;
    left: var(--m-gutter);
    right: 88px;
    bottom: calc(18px + var(--m-safe-bottom));
    z-index: 70;
    height: 50px !important;
    min-height: 50px !important;
    font-size: 1rem !important;
    border-radius: 14px !important;
    box-shadow: 0 12px 30px rgba(93, 63, 211, 0.35) !important;
  }
  .saas-page-actions .saas-btn,
  .saas-page-actions .saas-health,
  .saas-table-toolbar .saas-btn,
  .saas-toolbar-right .saas-btn,
  .saas-colmenu > summary.saas-btn {
    min-height: 40px !important;
    height: 40px !important;
    padding: 0 14px !important;
    font-size: 0.88rem !important;
    border-radius: 10px !important;
  }
  .saas-page-actions .saas-segmented button { min-height: 34px !important; height: 34px !important; min-width: 44px !important; font-size: 0.85rem !important; }
  .saas-select, .view select, .view input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]) { min-height: 40px; }
  .saas-table-toolbar { padding: 12px !important; gap: 10px !important; }
  .saas-toolbar-right { flex: 1 1 100%; flex-wrap: wrap !important; }
  .saas-toolbar-right .saas-search, .saas-table-toolbar .saas-search-wide { flex: 1 1 100%; width: 100% !important; }
  .saas-toolbar-right .saas-search input, .saas-table-toolbar .saas-search input { width: 100% !important; }
  .saas-toolbar-right > select, .saas-toolbar-right > .saas-select { flex: 1 1 140px; min-width: 0; }
  /* status tabs scroll sideways with the finger instead of wrapping into 3 rows */
  .saas-tabs { flex-wrap: nowrap !important; overflow-x: auto; max-width: 100%; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .saas-tabs::-webkit-scrollbar { display: none; }
  .saas-tabs button { flex: 0 0 auto; min-height: 38px !important; white-space: nowrap; }
  .saas-selection-bar { flex-wrap: wrap; gap: 8px; }
  .saas-selection-bar .saas-select { flex: 1 1 140px; }
  .saas-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .saas-chart-row { grid-template-columns: minmax(0, 1fr) !important; }
  /* column picker: stays on screen */
  .saas-colmenu-pop { max-width: calc(100vw - 24px); }
}
/* iOS zooms into any field under 16px: never let that happen */
@media (pointer: coarse), (max-width: 760px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea { font-size: 16px !important; }
}

/* ---- v18 phone: tables become cards ---- */
@media (max-width: 760px) {
  .view .saas-table-scroll { overflow: visible !important; }
  .view .saas-table, #view-payments .saas-table, #view-contacts .saas-table, #view-webinar .saas-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  .view .saas-table thead { display: none !important; }
  .view .saas-table tbody { display: grid !important; gap: 0; }
  .view .saas-table tbody tr {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--s-border);
  }
  .view .saas-table tbody tr:last-child { border-bottom: 0; }
  .view .saas-table tbody td,
  #view-payments .saas-table td, #view-contacts .saas-table td, #view-webinar .saas-table td {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0 !important;
    padding: 3px 0 !important;
    border: 0 !important;
    text-align: right;
    font-size: 0.9rem;
    overflow-wrap: anywhere;
  }
  .view .saas-table tbody td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 auto;
    max-width: 45%;
    color: var(--s-text-3);
    font-size: 0.76rem;
    font-weight: 600;
    text-align: left;
    text-transform: none;
  }
  /* first real column = the card title */
  .view .saas-table tbody td.m-title { justify-content: flex-start; text-align: left; padding-bottom: 6px !important; font-size: 0.95rem; }
  .view .saas-table tbody td.m-title::before { display: none; }
  .view .saas-table tbody td.saas-empty, .view .saas-table tbody td.empty-state { justify-content: center; text-align: center; padding: 18px 0 !important; }
  .view .saas-table tbody td.saas-empty::before, .view .saas-table tbody td.empty-state::before { display: none; }
  .view .saas-table .saas-person { min-width: 0; }
  .view .saas-table .saas-person > span:last-child { min-width: 0; text-align: left; }
  .view .saas-table .saas-person small { display: block !important; overflow-wrap: anywhere; }
  .view .saas-table .saas-date small { display: inline; margin-left: 6px; }
  #view-webinar td:first-child { min-width: 0 !important; }
  /* contacts: checkbox on the left of the card */
  #view-contacts .saas-table tbody tr { position: relative; padding-left: 52px; }
  #view-contacts .saas-table tbody td.saas-check-col { position: absolute; top: 10px; left: 8px; width: 40px; height: 40px; justify-content: center; padding: 0 !important; }
  #view-contacts .saas-table tbody tr:has(td.empty-state) { padding-left: 14px; }
  .saas-row-check { width: 22px !important; height: 22px !important; }
  /* a "select all" row replaces the hidden table head */
  #view-contacts .saas-table thead { display: block !important; }
  #view-contacts .saas-table thead tr { display: flex !important; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--s-border); }
  #view-contacts .saas-table thead th:not(.saas-check-col) { display: none !important; }
  #view-contacts .saas-table thead th.saas-check-col { display: flex !important; align-items: center; gap: 10px; padding: 0 !important; border: 0 !important; background: transparent !important; text-transform: none; letter-spacing: 0; font-size: 0.85rem; color: var(--s-text-2); }
  #view-contacts .saas-table thead th.saas-check-col::after { content: attr(data-label); font-weight: 600; }
  /* users: one card per user, switches in two columns */
  .saas-users-table tbody tr { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; column-gap: 14px !important; row-gap: 6px !important; }
  .saas-users-table tbody td.m-title, .saas-users-table tbody td.saas-users-actions { grid-column: 1 / -1; }
  .saas-users-table tbody td.saas-users-cell { justify-content: space-between; }
  .saas-users-table tbody td.saas-users-actions { justify-content: flex-end; gap: 8px; padding-top: 6px !important; }
  .saas-users-table tbody td.saas-users-actions::before { display: none; }
  .saas-users-table .saas-icon-action { width: 40px !important; height: 40px !important; }
}

/* ---- v18: dialogs, detail window, notifications, column menu, Tara ---- */
@media (max-width: 1099px) {
  .drawer { padding: 16px !important; }
  .drawer-card { max-height: calc(100dvh - 32px) !important; padding: 18px !important; overscroll-behavior: contain; }
  .saas-notify {
    top: calc(var(--m-safe-top) + var(--m-bar) + 6px) !important;
    right: 12px !important;
    max-height: calc(100dvh - var(--m-bar) - var(--m-safe-top) - 24px) !important;
  }
  .saas-dialog { max-height: calc(100dvh - 32px); }
  .saas-dialog > form, .saas-dialog[open] { overscroll-behavior: contain; }
  /* Tara: bubble bottom-right, opens as a panel under the top bar */
  .tara-widget.minimized { top: auto !important; left: auto !important; right: 14px !important; bottom: calc(14px + var(--m-safe-bottom)) !important; }
  .tara-widget:not(.minimized) {
    top: calc(var(--m-safe-top) + var(--m-bar) + 8px) !important;
    right: 12px !important;
    bottom: calc(12px + var(--m-safe-bottom)) !important;
    left: auto !important;
    width: min(420px, calc(100vw - 24px)) !important;
    min-width: 0 !important;
    height: auto !important;
    z-index: 130 !important;
  }
  .tara-resize-handle { display: none !important; }
}
@media (max-width: 760px) {
  /* dialogs slide up from the bottom and scroll inside; buttons stay visible */
  .saas-dialog {
    width: 100vw !important;
    max-width: 100vw !important;
    max-height: calc(100dvh - var(--m-safe-top) - 12px) !important;
    margin: auto 0 0 !important;
    border-radius: 20px 20px 0 0 !important;
    border-bottom: 0 !important;
  }
  .saas-dialog[open] { display: flex; flex-direction: column; overflow: hidden; }
  .saas-dialog > form { display: flex; flex-direction: column; min-height: 0; max-height: inherit; flex: 1 1 auto; overflow: hidden; }
  .saas-dialog .saas-form-grid { flex: 1 1 auto; min-height: 0; overflow-y: auto; max-height: none !important; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .saas-dialog-head { padding: 18px 18px 6px !important; }
  .saas-dialog .saas-form-grid { padding-left: 18px !important; padding-right: 18px !important; }
  .saas-dialog-foot {
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 18px calc(12px + var(--m-safe-bottom)) !important;
  }
  .saas-dialog-foot > div { display: flex; gap: 8px; flex: 1 1 auto; justify-content: flex-end; }
  .saas-dialog-foot .saas-btn { min-height: 46px; flex: 1 1 0; font-size: 0.95rem; }
  .saas-dialog-foot > .saas-check { flex: 1 1 100%; }
  .saas-dialog-foot > span:empty { display: none; }
  .saas-dialog-small .saas-form-grid { padding-bottom: 8px; }
  .saas-form-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .saas-form-grid .saas-span-2 { grid-column: 1 !important; }
  .saas-password-row { flex-wrap: wrap; }
  .saas-password-row input { flex: 1 1 100%; }
  .saas-password-row .saas-btn { flex: 1 1 0; min-height: 42px; }
  /* detail window: a sheet from the bottom */
  .drawer { padding: 0 !important; align-items: flex-end !important; }
  .drawer-card {
    width: 100% !important;
    max-height: calc(100dvh - var(--m-safe-top) - 12px) !important;
    border-radius: 20px 20px 0 0 !important;
    padding: 16px 14px calc(18px + var(--m-safe-bottom)) !important;
  }
  .drawer-card > .panel-header { position: sticky; top: -16px; z-index: 2; margin: -16px -14px 12px !important; padding: 14px 14px 10px !important; background: inherit; border-radius: 20px 20px 0 0; }
  .drawer-window-actions .saas-icon-btn { width: 40px !important; height: 40px !important; }
  .drawer-dashboard-button { min-height: 40px; }
  .saas-notify { left: 8px !important; right: 8px !important; width: auto !important; }
  .saas-colmenu[open] > .saas-colmenu-pop {
    position: fixed !important;
    top: auto !important;
    left: 8px !important;
    right: 8px !important;
    bottom: calc(8px + var(--m-safe-bottom)) !important;
    width: auto !important;
    max-width: none !important;
    max-height: 70dvh !important;
    z-index: 160 !important;
    border-radius: 16px !important;
    box-shadow: 0 -10px 60px rgba(10, 6, 25, 0.35) !important;
  }
  .saas-colmenu-row { min-height: 44px; }
  /* Tara open = full screen */
  .tara-widget:not(.minimized) {
    inset: 0 !important;
    width: 100% !important;
    max-width: none !important;
    border-radius: 0 !important;
    padding-top: var(--m-safe-top);
    padding-bottom: var(--m-safe-bottom);
    z-index: 170 !important;
  }
  .tara-widget:not(.minimized) header #minimize-tara { width: 40px; height: 40px; }
  #tara-form { gap: 8px; padding: 10px 12px !important; }
  #tara-form button { min-height: 44px; }
}
@media (max-height: 520px) and (max-width: 1099px) {
  /* landscape phones: dialogs and panels use the full height */
  .saas-dialog { max-height: calc(100dvh - 12px) !important; }
  .drawer { padding: 6px !important; }
  .drawer-card { max-height: calc(100dvh - 12px) !important; }
}

/* ---- v18: nothing scrolls behind an open menu / detail window / Tara ---- */
@media (max-width: 1099px) {
  html:has(.shell.mobile-nav-open), html:has(.drawer.open), html:has(dialog[open]) { overflow: hidden !important; }
  html:has(.shell.mobile-nav-open) body, html:has(.drawer.open) body, html:has(dialog[open]) body { overflow: hidden !important; }
  .saas-cal-today { white-space: nowrap; }
  .saas-cal-head { flex-wrap: wrap; row-gap: 6px; }
  .saas-cal-nav, .saas-cal-today { height: 36px !important; min-width: 36px !important; }
}
@media (max-width: 760px) {
  html:has(.tara-widget:not(.minimized)), html:has(.tara-widget:not(.minimized)) body { overflow: hidden !important; }
}

/* ---- v18: Calendar page ---- */
@media (max-width: 1099px) {
  .saas-calpage { grid-template-columns: minmax(0, 1fr) !important; }
  .saas-calpage-main { order: 1; }
  .saas-calpage-side { order: 2; }
  .saas-calpage-toolbar { flex-wrap: wrap; row-gap: 8px; }
  .saas-calpage-toolbar .saas-cal-nav, .saas-calpage-toolbar .saas-cal-today { height: 40px !important; min-width: 40px !important; font-size: 1rem; }
  .saas-calpage-toolbar strong { flex: 1 1 auto; }
  .saas-calpage-side-head { flex-direction: row !important; flex-wrap: wrap; align-items: center; }
  .saas-calpage-side-head .saas-btn { flex: 1 1 160px; min-height: 44px !important; font-size: 0.9rem !important; }
  /* the two calendar buttons go above the month, the calendar list + upcoming below it */
  .saas-calpage-side, body.dark-mode .saas-calpage-side { display: contents !important; }
  .saas-calpage-side-head { order: 0; }
  .saas-calpage-side-body {
    order: 2;
    padding: 14px;
    border-radius: 14px;
    background: var(--s-card-glass);
    border: 1px solid var(--s-card-edge);
    box-shadow: 0 1px 2px rgba(40, 20, 80, 0.04), 0 8px 28px rgba(40, 20, 80, 0.05);
    -webkit-backdrop-filter: blur(14px) saturate(1.3);
    backdrop-filter: blur(14px) saturate(1.3);
  }
  .saas-calpage-cal { min-height: 44px; font-size: 0.92rem !important; }
  .saas-calpage-cal input { width: 20px !important; height: 20px !important; flex-basis: 20px !important; }
}
@media (max-width: 760px) {
  /* the two main calendar buttons sit above the month */
  .saas-calpage { gap: 12px !important; }
  .saas-calpage-grid { gap: 3px !important; grid-auto-rows: minmax(54px, auto) !important; }
  .saas-calpage-day { padding: 4px 3px !important; min-width: 0; cursor: pointer; }
  .saas-calpage-num { font-size: 0.8rem; }
  .saas-calpage-event { padding: 0 !important; min-height: 0; background: transparent !important; justify-content: flex-start; }
  .saas-calpage-event span { display: none !important; }
  .saas-calpage-event i { width: 8px !important; height: 8px !important; }
  .saas-calpage-day { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
  .saas-calpage-day .saas-calpage-event { display: inline-flex; width: auto; }
  .saas-calpage-more { font-size: 0.66rem !important; padding: 0 !important; }
  .saas-calpage-wd { font-size: 0.68rem; text-align: center; }
}

/* ---- v18: every width ---- */
.saas-calpage-side-body { display: flex; flex-direction: column; gap: 10px; }
/* the newsletter contact search is a normal field, not the floating top-bar search button */
.newsletter-contact-picker .search.inline-search {
  position: static !important;
  display: grid !important;
  gap: 6px;
  width: 100% !important;
  max-width: none !important;
  margin: 0 0 12px !important;
  transform: none !important;
}
.newsletter-contact-picker .search.inline-search::before { display: none !important; }
.newsletter-contact-picker .search.inline-search span { display: block; font-size: 0.8rem; font-weight: 600; color: var(--s-text-2); }
.newsletter-contact-picker .search.inline-search input {
  position: static !important;
  width: 100% !important;
  min-height: 40px;
  padding: 8px 12px !important;
  opacity: 1 !important;
  border-radius: 10px !important;
}

/* ---- v18 touch sizes for small icon buttons, copy buttons, links ---- */
@media (max-width: 1099px) {
  .saas-icon-action { width: 40px !important; height: 40px !important; border-radius: 10px !important; }
  .saas-copy-row .saas-btn { min-height: 40px !important; padding: 0 16px !important; }
  .saas-copy-row code { flex: 1 1 100%; overflow-wrap: anywhere; }
  .saas-setup-link, .saas-link-btn { display: inline-flex; align-items: center; min-height: 40px; }
  .newsletter-group-actions .ghost-button, .newsletter-group-actions .tag { min-height: 40px; }
}
@media (max-width: 760px) {
  /* bigger switches on phones */
  .saas-switch { width: 44px !important; height: 26px !important; }
  .saas-switch span::after { width: 20px !important; height: 20px !important; top: 3px !important; left: 3px !important; }
  .saas-switch input:checked + span::after { transform: translateX(18px) !important; }
  .saas-users-table tbody td.saas-users-cell { min-height: 40px; }
  .newsletter-upload-row { grid-template-columns: minmax(0, 1fr) !important; }
  .newsletter-contact-list { max-height: 55dvh !important; }
  .newsletter-groups { max-height: none !important; overflow: visible !important; }
}
/* checkbox column: only as wide as the box (it took half the table before) */
.saas-table th.saas-check-col, .saas-table td.saas-check-col { width: 1% !important; min-width: 44px; white-space: nowrap; padding-right: 4px !important; }

@media (max-width: 1099px) {
  #view-overview.active { align-items: start !important; }
  .saas-mini-stats span { word-break: normal !important; overflow-wrap: normal !important; -webkit-hyphens: auto; hyphens: auto; }
  /* switches: a bigger invisible tap area around the small pill */
  .saas-switch::before { content: ""; position: absolute; inset: -10px -8px; }
}
/* Users on tablets: one card per user (the 11-column matrix does not fit a portrait tablet) */
@media (min-width: 761px) and (max-width: 1099px) {
  #view-users .saas-table-scroll { overflow: visible !important; }
  .saas-users-table { display: block !important; width: 100% !important; }
  .saas-users-table thead { display: none !important; }
  .saas-users-table tbody { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
  .saas-users-table tbody tr {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 14px;
    row-gap: 6px;
    align-content: start;
    padding: 14px 16px;
    border-bottom: 1px solid var(--s-border);
  }
  .saas-users-table tbody tr:nth-child(odd) { border-right: 1px solid var(--s-border); }
  .saas-users-table tbody td {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: auto !important;
    min-width: 0 !important;
    padding: 4px 0 !important;
    border: 0 !important;
  }
  .saas-users-table tbody td[data-label]::before { content: attr(data-label); color: var(--s-text-3); font-size: 0.78rem; font-weight: 600; }
  .saas-users-table tbody td.m-title, .saas-users-table tbody td.saas-users-actions { grid-column: 1 / -1; }
  .saas-users-table tbody td.m-title { padding-bottom: 8px !important; }
  .saas-users-table tbody td.saas-users-actions { justify-content: flex-end; gap: 8px; }
  .saas-users-table tbody td.saas-users-actions::before { display: none; }
  .saas-switch { width: 40px !important; height: 24px !important; }
  .saas-switch span::after { width: 18px !important; height: 18px !important; top: 3px !important; left: 3px !important; }
  .saas-switch input:checked + span::after { transform: translateX(16px) !important; }
}
/* Dashboard payments panel: donut + legend at the top of the panel */
@media (max-width: 1099px) {
  #view-overview .payment-pie-panel .payment-pie-wrap, #payment-pie { justify-content: flex-start !important; align-items: center; height: auto !important; }
}

/* column menu on phones: a bottom sheet over a dimmed page. A glass card (backdrop-filter) would trap the
   fixed sheet inside itself, so the card drops its blur while the menu is open. */
@media (max-width: 760px) {
  .saas-card:has(.saas-colmenu[open]), .view .panel:has(.saas-colmenu[open]) { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; transform: none !important; filter: none !important; }
  .saas-colmenu[open]::before { content: ""; position: fixed; inset: 0; z-index: 159; background: rgba(12, 9, 22, 0.38); }
}
@media (max-width: 1099px) {
  /* Tara: no desktop shrink, no size animation on touch screens */
  .tara-widget, .tara-widget.minimized { transform: none !important; transition: none !important; }
}
@media (max-width: 760px) {
  .tara-widget:not(.minimized), body.dark-mode .tara-widget:not(.minimized) {
    background: var(--s-bg-card) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    border: 0 !important;
  }
}
.saas-dialog-head h3:focus { outline: none; }

/* dim layer behind notifications / search results on touch screens (see watchTouchScrim) */
.m-scrim { display: none; }
@media (max-width: 1099px) {
  .m-scrim:not([hidden]) { display: block; position: fixed; inset: 0; background: rgba(12, 9, 22, 0.28); }
  .m-scrim[data-for="notify"] { z-index: 139; }
  .m-scrim[data-for="search"] { z-index: 89; }
}

/* ---- v18: long (German) words never split in the middle ---- */
.saas-card-figure { white-space: nowrap; }
@media (max-width: 760px) {
  .saas-users-table tbody td.saas-users-cell::before { max-width: none !important; flex: 1 1 auto; overflow-wrap: normal; word-break: normal; }
  .dashboard-topic-picker label span { overflow-wrap: normal !important; word-break: normal !important; -webkit-hyphens: auto; hyphens: auto; }
  /* Responses tiles: one line each (number + label) so "Webinar-Anmeldungen" fits */
  .saas-mini-stats { grid-template-columns: minmax(0, 1fr) !important; }
  .saas-mini-stats > div { flex-direction: row !important; align-items: center; justify-content: flex-start; gap: 10px; padding: 8px 12px !important; }
  .saas-mini-stats strong { min-width: 34px; font-size: 1.2rem !important; }
  .saas-mini-stats span { font-size: 0.85rem !important; }
  /* calendar: "+3" instead of "+3 more" in the small day cells */
  .saas-calpage-more { font-size: 0 !important; line-height: 1; }
  .saas-calpage-more::after { content: attr(data-more); font-size: 0.68rem; font-weight: 700; color: var(--s-accent); }
  .dashboard-module-head { flex-wrap: wrap; row-gap: 6px; }
}
@media (max-width: 360px) {
  .saas-users-table tbody tr { grid-template-columns: minmax(0, 1fr) !important; }
  .dashboard-topic-picker { grid-template-columns: minmax(0, 1fr) !important; }
  .dashboard-module-head .dashboard-inline-filter { flex: 1 1 100%; justify-content: space-between; transform: none !important; }
}
@media (max-width: 1099px) {
  /* leave room under the search results to tap away */
  .topbar .global-search-results { max-height: min(62dvh, calc(100dvh - var(--m-bar) - var(--m-safe-top) - 110px)) !important; overscroll-behavior: contain; }
}
/* landscape phones: use the width (two columns) */
@media (max-width: 760px) and (min-width: 560px) and (orientation: landscape) {
  #view-overview.active, #view-overview.active.dashboard-extended { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  #view-overview [data-dashboard-topic].dashboard-topic-visible { grid-column: auto !important; }
  #view-overview [data-dashboard-topic="health"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="email"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="replies"].dashboard-topic-visible,
  #view-overview [data-dashboard-topic="integrations"].dashboard-topic-visible { grid-column: 1 / -1 !important; }
  .saas-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .saas-mini-stats { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}
@media (max-height: 520px) and (max-width: 1099px) {
  .sidebar .nav-item { min-height: 40px !important; padding: 8px 12px !important; }
}
/* big tablets in landscape keep the desktop layout, but every control gets a finger-sized target */
@media (min-width: 1100px) and (pointer: coarse) {
  .saas-page-actions .saas-btn, .saas-page-actions [data-view-save], .saas-page-bar [data-view-close],
  .saas-table-toolbar .saas-btn, .saas-colmenu > summary.saas-btn { min-height: 36px !important; height: 36px !important; }
  .saas-page-bar [data-view-close] { width: 36px !important; }
  .saas-page-actions .saas-segmented button { min-height: 32px !important; height: 32px !important; }
  .saas-icon-action { width: 36px !important; height: 36px !important; }
  .saas-cal-nav, .saas-cal-today { height: 34px !important; min-width: 34px !important; }
  .saas-tabs button { min-height: 36px !important; }
  .saas-switch { width: 38px !important; height: 22px !important; }
  .saas-switch span::after { width: 16px !important; height: 16px !important; top: 3px !important; left: 3px !important; }
  .saas-switch input:checked + span::after { transform: translateX(16px) !important; }
  .saas-switch::before { content: ""; position: absolute; inset: -8px -6px; }
  .tara-resize-handle { display: none !important; }
}
/* a sideways finger drag over a chart reads its values; up/down still scrolls the page */
@media (pointer: coarse) { [data-saas-chart] { touch-action: pan-y; } }

/* ---- v18: notch / rounded corners in landscape, no double-tap zoom on controls ---- */
:root { --m-safe-left: env(safe-area-inset-left, 0px); --m-safe-right: env(safe-area-inset-right, 0px); }
@media (max-width: 1099px) {
  .main { padding-left: calc(var(--m-gutter) + var(--m-safe-left)) !important; padding-right: calc(var(--m-gutter) + var(--m-safe-right)) !important; }
  .menu-button { left: calc(12px + var(--m-safe-left)) !important; }
  .dashboard-home-button { left: calc(60px + var(--m-safe-left)) !important; }
  .quick-ui-toggles { right: calc(12px + var(--m-safe-right)) !important; }
  .topbar .search { right: calc(150px + var(--m-safe-right)) !important; }
  .tara-widget.minimized { right: calc(14px + var(--m-safe-right)) !important; }
  .saas-page-bar [data-view-save]:not(:disabled) { left: calc(var(--m-gutter) + var(--m-safe-left)); right: calc(88px + var(--m-safe-right)); }
  button, a, summary, label, select, [role="tab"], input[type="checkbox"] { touch-action: manipulation; }
}
@media (max-width: 380px) {
  .topbar .search { right: calc(132px + var(--m-safe-right)) !important; }
}
@media (max-width: 1099px) {
  /* leave room under the notifications to tap away */
  .saas-notify { max-height: min(70dvh, calc(100dvh - var(--m-bar) - var(--m-safe-top) - 110px)) !important; }
  .saas-notify-list { overscroll-behavior: contain; }
}
@media (max-width: 760px) {
  .webinar-room-preview, .test-card-grid, .env-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .webinar-room-preview strong, .env-grid code { overflow-wrap: anywhere; }
  .stripe-actions { display: grid !important; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .stripe-actions button { min-height: 44px; }
}
/* smoother scrolling on phones/tablets: only the flat background sits behind the cards, so their blur is
   invisible but costs GPU time on every scroll frame. The top bar and menu keep theirs. */
@media (max-width: 1099px) {
  .saas-card, .saas-kpi, .view .panel, #view-overview .panel, body.dark-mode #view-overview .panel, body.dark-mode .view .panel,
  .view details.advanced-settings, .saas-calpage-side-body {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}
/* big touch tablets in the desktop layout: same clean "tap away to close" (the top bar sits at z-index 30 there) */
@media (pointer: coarse) and (min-width: 1100px) {
  .m-scrim:not([hidden]) { display: block; position: fixed; inset: 0; background: rgba(12, 9, 22, 0.18); }
  .m-scrim[data-for="notify"] { z-index: 139; }
  .m-scrim[data-for="search"] { z-index: 29; }
}

/* ---- v18: login (every width) ---- */
body.signed-out .tara-widget, body.signed-out .m-scrim { display: none !important; }
.login-card .primary-action,
body.dark-mode .login-card .primary-action {
  min-height: 48px;
  border: 0 !important;
  border-radius: 12px !important;
  background: var(--s-accent, #5d3fd3) !important;
  color: #fff !important;
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(93, 63, 211, 0.28) !important;
  cursor: pointer;
}
.login-card .primary-action:hover { filter: brightness(1.06); }
@media (max-width: 760px) {
  .login-screen { padding: calc(16px + var(--m-safe-top)) 16px calc(16px + var(--m-safe-bottom)) !important; align-items: flex-start !important; }
  .login-card { width: 100% !important; max-width: 420px; margin: 8vh auto 0 !important; padding: 24px 20px !important; }

  /* dialog buttons on narrow phones: main buttons side by side, a lone Cancel / Delete below */
  .saas-dialog-foot > div { order: 1; flex: 1 1 100%; }
  .saas-dialog-foot > .saas-btn { order: 2; flex: 1 1 100%; }
  .saas-dialog-foot > .saas-check { order: 0; }
  /* detail sheet header: the title gets the room (the top bar already has a Dashboard button) */
  .drawer-card .drawer-dashboard-button { display: none !important; }
  .drawer-card > .panel-header h2, #drawer-title { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; font-size: 1.1rem !important; line-height: 1.25; }
  .drawer-card > .panel-header { align-items: flex-start !important; gap: 10px; }
}
/* phone contact cards: the checkbox cell keeps its 40px tap area (the 1% column rule is for real tables) */
@media (max-width: 760px) {
  #view-contacts .saas-table tbody td.saas-check-col { width: 40px !important; min-width: 40px !important; }
}
/* big touch tablets (desktop layout): the remaining small controls */
@media (min-width: 1100px) and (pointer: coarse) {
  .saas-calpage-side .saas-btn, .saas-copy-row .saas-btn { min-height: 38px !important; }
  #view-overview .dashboard-calendar-panel select, .dashboard-inline-filter select { min-height: 36px !important; }
  .saas-setup-link, .saas-link-btn { display: inline-flex; align-items: center; min-height: 36px; }
}
/* users matrix on big touch tablets: German column names may wrap instead of pushing the table sideways */
@media (pointer: coarse), (max-width: 1279px) {
  .saas-users-table th.saas-users-cell { white-space: normal; overflow-wrap: normal; -webkit-hyphens: auto; hyphens: auto; }
  .saas-users-table th.saas-users-cell, .saas-users-table td.saas-users-cell { min-width: 58px; }
}
