/* MailHarbor — clean, light, corporate. */
:root {
  --mh-navy: #16365f;
  --mh-navy-2: #1f4e8c;
  --mh-teal: #0f8f82;
  --mh-teal-soft: #e6f5f3;
  --mh-bg: #f4f6f9;
  --mh-surface: #ffffff;
  --mh-border: #e2e7ee;
  --mh-text: #1b2430;
  --mh-muted: #5f6b7a;
  --mh-sidebar-w: 248px;

  --bs-primary: #1f4e8c;
  --bs-primary-rgb: 31, 78, 140;
  --bs-link-color: #1f4e8c;
  --bs-link-color-rgb: 31, 78, 140;
  --bs-link-hover-color: #16365f;
  --bs-body-bg: var(--mh-bg);
  --bs-body-color: var(--mh-text);
  --bs-border-color: var(--mh-border);
  --bs-body-font-family: Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-font-size: 0.925rem;
}

body { background: var(--mh-bg); }
.skip-link { position: absolute; z-index: 2000; background: #fff; padding: .5rem 1rem; }

.btn-primary { --bs-btn-bg: #1f4e8c; --bs-btn-border-color: #1f4e8c; --bs-btn-hover-bg: #16365f; --bs-btn-hover-border-color: #16365f; --bs-btn-active-bg: #12304f; }
.btn-outline-primary { --bs-btn-color: #1f4e8c; --bs-btn-border-color: #1f4e8c; --bs-btn-hover-bg: #1f4e8c; --bs-btn-hover-border-color: #1f4e8c; }
.btn-teal { --bs-btn-color: #fff; --bs-btn-bg: #0b7469; --bs-btn-border-color: #0b7469; --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #095c53; --bs-btn-hover-border-color: #095c53; --bs-btn-active-bg: #084f47; --bs-btn-disabled-bg: #0b7469; }
.form-control:focus, .form-select:focus, .btn:focus-visible, a:focus-visible {
  border-color: #6d97cc; box-shadow: 0 0 0 .2rem rgba(31, 78, 140, .25); outline: none;
}

/* Boot */
.boot-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* Layout */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--mh-sidebar-w); flex: 0 0 var(--mh-sidebar-w); background: var(--mh-surface);
  border-right: 1px solid var(--mh-border); position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.sidebar .brand { padding: 1.1rem 1.25rem .9rem; border-bottom: 1px solid var(--mh-border); }
.sidebar .brand img { height: 34px; width: auto; }
.sidebar .org { font-size: .75rem; color: var(--mh-muted); margin-top: .35rem; letter-spacing: .02em; }
.nav-section { padding: .9rem .75rem .25rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #5f6b7a; font-weight: 600; }
.side-nav a {
  display: flex; align-items: center; gap: .7rem; padding: .5rem .85rem; margin: .1rem .5rem; border-radius: .5rem;
  color: #384556; text-decoration: none; font-weight: 500;
}
.side-nav a i { font-size: 1.05rem; color: #7b8798; width: 1.2rem; text-align: center; }
.side-nav a:hover { background: #f1f4f8; color: var(--mh-navy); }
.side-nav a.active { background: #e8eff8; color: var(--mh-navy); }
.side-nav a.active i { color: var(--mh-navy-2); }
.side-nav .badge { margin-left: auto; }
.sidebar-footer { margin-top: auto; padding: .75rem 1rem 1rem; border-top: 1px solid var(--mh-border); font-size: .8rem; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; background: var(--mh-surface); border-bottom: 1px solid var(--mh-border); display: flex;
  align-items: center; padding: 0 1.5rem; gap: 1rem; position: sticky; top: 0; z-index: 100;
}
.topbar .page-title { font-weight: 600; font-size: 1.05rem; color: var(--mh-navy); margin: 0; }
.content { padding: 1.5rem; max-width: 1440px; width: 100%; }

@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: calc(-1 * var(--mh-sidebar-w)); z-index: 1040; transition: left .2s ease; box-shadow: none; }
  .sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.15); }
  .content { padding: 1rem; }
  .topbar { padding: 0 1rem; }
}

/* Cards */
.card { border: 1px solid var(--mh-border); border-radius: .75rem; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.card-header { background: transparent; border-bottom: 1px solid var(--mh-border); padding: .9rem 1.1rem; font-weight: 600; color: var(--mh-navy); }
.card-body { padding: 1.1rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.45rem; font-weight: 700; color: var(--mh-navy); margin: 0; }
.page-head p { color: var(--mh-muted); margin: .2rem 0 0; }

/* KPI tiles */
.kpi { padding: 1rem 1.1rem; height: 100%; display: block; text-decoration: none; color: inherit; }
.kpi:hover { border-color: #c8d3e2; }
.kpi .label { font-size: .78rem; color: var(--mh-muted); font-weight: 500; display: flex; align-items: center; gap: .4rem; }
.kpi .value { font-size: 1.65rem; font-weight: 700; color: var(--mh-text); line-height: 1.2; margin-top: .25rem; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .75rem; color: var(--mh-muted); }
.dot { width: .55rem; height: .55rem; border-radius: 50%; display: inline-block; flex: none; }

/* Status badges */
.status { display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; font-weight: 600; padding: .2rem .55rem; border-radius: 1rem; white-space: nowrap; border: 1px solid transparent; }
.status::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.s-active { color: #13734a; background: #e7f6ee; }
.s-unconfirmed { color: #44607f; background: #eaf0f7; }
.s-soft_bounced { color: #8a5a00; background: #fff4dc; }
.s-hard_bounced { color: #b42318; background: #fdeceb; }
.s-complaint { color: #8b1f5f; background: #fbe9f3; }
.s-unsubscribed { color: #5b6472; background: #eef0f3; }
.s-blocklisted { color: #2f3a48; background: #e4e7ec; }
.s-pending_review { color: #a2470d; background: #fff0e5; }
.s-inactive { color: #5b6472; background: #f1f2f4; }
.s-no_lists { color: #4f5a69; background: #f4f5f7; border-color: #e3e6ea; }
.bg-s-active { background: #1f9d63; } .bg-s-unconfirmed { background: #6c8fb8; } .bg-s-soft_bounced { background: #d9a21b; }
.bg-s-hard_bounced { background: #d64535; } .bg-s-complaint { background: #b23a7e; } .bg-s-unsubscribed { background: #8d96a3; }
.bg-s-blocklisted { background: #3d4756; } .bg-s-pending_review { background: #e07a2f; } .bg-s-inactive { background: #b5bcc6; }
.bg-s-no_lists { background: #cfd5dd; }

.camp-status { font-size: .72rem; font-weight: 600; text-transform: capitalize; padding: .18rem .5rem; border-radius: .35rem; background: #eef1f5; color: #46525f; }
.camp-status.running { background: #e6f5f3; color: #0b7469; }
.camp-status.finished { background: #e7f6ee; color: #13734a; }
.camp-status.scheduled { background: #eaf0f7; color: #1f4e8c; }
.camp-status.paused, .camp-status.cancelled { background: #fff4dc; color: #8a5a00; }

/* Tables */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .65rem .8rem; border-bottom-color: #edf0f4; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: #4f5a69; font-weight: 600; background: #f8fafc; white-space: nowrap; }
.table-hover tbody tr:hover { --bs-table-hover-bg: #f6f9fc; }
.table tbody tr.row-link { cursor: pointer; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--mh-navy); }
th.sorted { color: var(--mh-navy); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-email { font-weight: 500; color: var(--mh-text); word-break: break-all; }
.text-muted-2 { color: var(--mh-muted) !important; }

/* Filter bar */
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.filter-bar .form-control, .filter-bar .form-select { max-width: 220px; }
.filter-bar .search { min-width: 240px; max-width: 340px; }
.bulk-bar { background: #e8eff8; border: 1px solid #cddbec; border-radius: .6rem; padding: .5rem .75rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* Alerts */
.alert-item { display: flex; gap: .75rem; padding: .75rem 1rem; border-radius: .6rem; border: 1px solid; margin-bottom: .5rem; }
.alert-item.critical { background: #fdeceb; border-color: #f5c2bd; color: #7a1a12; }
.alert-item.warning { background: #fff7e6; border-color: #f4dba6; color: #6b4600; }
.alert-item.info { background: #eaf0f7; border-color: #c9d8ea; color: #1f3d63; }

/* Wizard */
.steps { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.25rem; padding: 0; list-style: none; }
.steps li { display: flex; align-items: center; gap: .5rem; padding: .45rem .9rem; border-radius: 2rem; background: #fff; border: 1px solid var(--mh-border); color: var(--mh-muted); font-weight: 500; font-size: .85rem; }
.steps li .n { width: 1.4rem; height: 1.4rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #eef1f5; font-size: .75rem; font-weight: 700; }
.steps li.current { border-color: var(--mh-navy-2); color: var(--mh-navy); }
.steps li.current .n { background: var(--mh-navy-2); color: #fff; }
.steps li.done .n { background: var(--mh-teal); color: #fff; }
.dropzone { border: 2px dashed #c4d0df; border-radius: .9rem; padding: 2.5rem 1rem; text-align: center; background: #fbfcfe; cursor: pointer; transition: all .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--mh-navy-2); background: #f2f7fd; }
.dropzone i { font-size: 2.5rem; color: var(--mh-navy-2); }
.class-tile { border: 1px solid var(--mh-border); border-radius: .6rem; padding: .7rem .9rem; background: #fff; }
.class-tile .n { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.class-tile.ok { border-left: 4px solid #1f9d63; }
.class-tile.neutral { border-left: 4px solid #8d96a3; }
.class-tile.bad { border-left: 4px solid #d64535; }

/* Bars */
.hbar { height: .55rem; background: #eef1f5; border-radius: 1rem; overflow: hidden; }
.hbar > span { display: block; height: 100%; background: var(--mh-navy-2); border-radius: 1rem; }
.stack-bar { display: flex; height: .8rem; border-radius: 1rem; overflow: hidden; background: #eef1f5; }
.stack-bar > span { display: block; height: 100%; }
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 200px; }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 .9rem 1.4rem; border-left: 2px solid #e3e8ef; margin-left: .4rem; }
.timeline li::before { content: ""; position: absolute; left: -.42rem; top: .2rem; width: .75rem; height: .75rem; border-radius: 50%; background: #fff; border: 2px solid var(--mh-navy-2); }
.timeline li:last-child { border-left-color: transparent; }
.timeline .t { font-size: .75rem; color: var(--mh-muted); }

/* Guides */
.guide-nav a { display: block; padding: .45rem .75rem; border-radius: .45rem; color: #384556; text-decoration: none; }
.guide-nav a:hover { background: #f1f4f8; }
.guide-nav a.active { background: #e8eff8; color: var(--mh-navy); font-weight: 600; }
.guide h2 { font-size: 1.3rem; color: var(--mh-navy); font-weight: 700; margin-bottom: .75rem; }
.guide h3 { font-size: 1.02rem; color: var(--mh-navy); font-weight: 600; margin-top: 1.5rem; }
.guide ol li, .guide ul li { margin-bottom: .35rem; }
.guide .tip { background: var(--mh-teal-soft); border-left: 4px solid var(--mh-teal); padding: .75rem 1rem; border-radius: .4rem; margin: 1rem 0; }
.guide .warn { background: #fff7e6; border-left: 4px solid #d9a21b; padding: .75rem 1rem; border-radius: .4rem; margin: 1rem 0; }
.guide code, .kbd { background: #eef1f5; padding: .1rem .35rem; border-radius: .3rem; font-size: .85em; color: #22303f; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-side { background: linear-gradient(160deg, #16365f 0%, #1f4e8c 60%, #0f8f82 130%); color: #fff; padding: 3.5rem; display: flex; flex-direction: column; justify-content: space-between; }
.login-side h2 { font-weight: 700; font-size: 1.9rem; max-width: 28rem; }
.login-side li { margin-bottom: .6rem; opacity: .92; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 2rem; background: #fff; }
.login-form form { width: 100%; max-width: 380px; }
@media (max-width: 860px) { .login-wrap { grid-template-columns: 1fr; } .login-side { display: none; } }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--mh-muted); }
.empty i { font-size: 2.2rem; color: #a5b1c2; display: block; margin-bottom: .5rem; }
.dl-grid { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; margin: 0; }
.dl-grid dt { color: var(--mh-muted); font-weight: 500; }
.dl-grid dd { margin: 0; word-break: break-word; }
.check-row { display: flex; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid #edf0f4; }
.check-row:last-child { border-bottom: 0; }
.check-row i { font-size: 1.15rem; }
.export-card .bi { font-size: 1.6rem; color: var(--mh-navy-2); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; }
.form-control, .form-select { background-color: #fff; }
.form-control:disabled, .form-select:disabled { background-color: #eef1f5; }

/* Accessibility (audit): AA contrast for Bootstrap utility colours used on light surfaces */
.text-danger { color: #b42318 !important; }
.btn-light.text-danger { color: #b42318 !important; }
.btn-outline-secondary { --bs-btn-color: #475467; --bs-btn-border-color: #98a2b3; --bs-btn-hover-bg: #475467; --bs-btn-hover-border-color: #475467; }
.alert-item .meta { font-size: .8rem; margin-top: .15rem; }
.pager-label { pointer-events: none; color: #344054 !important; background: #fff; border-color: #98a2b3 !important; }
.table-responsive:focus-visible { outline: 2px solid #6d97cc; outline-offset: 2px; }
.topbar .quick-search { max-width: 360px; }
.sidebar-backdrop { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(16, 24, 40, .35); z-index: 1035; display: none; }
.sidebar.open + .sidebar-backdrop { display: block; }
.badge-managed { background: #eaf0f7; color: #1f3d63; font-weight: 600; }

code { color: #22303f; background: #eef1f5; padding: .1rem .35rem; border-radius: .3rem; font-size: .85em; }

/* Programmatic focus target after navigation: no visible frame */
#main:focus { outline: none; }
.resolved-alerts summary { cursor: pointer; padding: .6rem 1rem; color: #475467; font-size: .85rem; }

/* Toasts below the top bar, clear of page footers and primary actions */
.toast-stack { z-index: 1090; max-width: 100vw; }

/* Campaign editor */
.list-pick { max-height: 220px; overflow-y: auto; }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: .25rem; padding: .5rem .75rem; background: #f8fafc; align-items: center; }
.editor-toolbar .sep { width: 1px; height: 1.4rem; background: var(--mh-border); margin: 0 .25rem; }
.editor-surface { min-height: 340px; padding: 1.25rem 1.5rem; outline: none; line-height: 1.6; font-size: 1rem; background: #fff; overflow-wrap: anywhere; }
.editor-surface:focus-visible { box-shadow: inset 0 0 0 2px #6d97cc; }
.editor-surface h2, .editor-surface h3 { color: var(--mh-navy); }
.editor-surface img { max-width: 100%; height: auto; }
.editor-code { min-height: 380px; border: 0; border-radius: 0; font-size: .85rem; }
.mh-align-center { text-align: center; }
.mh-align-right { text-align: right; }
.mh-button { background: #1f4e8c; color: #fff !important; padding: 10px 20px; border-radius: 6px; text-decoration: none; display: inline-block; }
.preview-card { position: sticky; top: 76px; }
.preview-frame-wrap { background: #eef1f5; padding: 12px; display: flex; justify-content: center; }
#preview { width: 100%; height: 640px; border: 1px solid var(--mh-border); border-radius: 6px; background: #fff; transition: width .2s; }
.camp-status.sending { background: #e6f5f3; color: #0b7469; }
.camp-status.sent { background: #e7f6ee; color: #13734a; }
.camp-status.draft { background: #eef1f5; color: #46525f; }

.mw-520 { max-width: 520px; }
.mw-200 { max-width: 200px; }

/* ---- Drag-and-drop email builder ---------------------------------------- */
.bb { display: grid; grid-template-columns: 150px minmax(0, 1fr) 300px; min-height: 560px; }
.bb-palette { border-right: 1px solid var(--mh-border); padding: .75rem; background: #f8fafc; display: flex; flex-direction: column; gap: .4rem; }
.bb-palette-inner { display: flex; flex-direction: column; gap: .4rem; }
/* Palette and settings stay in view while scrolling a long email (drag targets may be far down). */
@media (min-width: 992px) {
  .bb-palette-inner, .bb-props-inner { position: sticky; top: 72px; }
}
.bb-palette-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--mh-muted); font-weight: 600; margin-bottom: .1rem; }
.bb-tile { display: flex; align-items: center; gap: .5rem; padding: .5rem .6rem; border: 1px solid var(--mh-border); border-radius: .5rem; background: #fff; cursor: grab; font-size: .875rem; user-select: none; }
.bb-tile:hover { border-color: #9db6d6; box-shadow: 0 1px 3px rgba(22, 54, 95, .12); }
.bb-tile:focus-visible { outline: 2px solid var(--mh-navy-2); outline-offset: 2px; }
.bb-tile i { color: var(--mh-navy-2); font-size: 1.05rem; }
.bb-stage { display: flex; flex-direction: column; min-width: 0; background: #eef1f5; }
.bb-bar { display: flex; align-items: center; gap: .25rem; padding: .4rem .75rem; border-bottom: 1px solid var(--mh-border); background: #fff; }
.bb-canvas-wrap { flex: 1; padding: 1.25rem; overflow: auto; }
.bb-canvas { max-width: 600px; margin: 0 auto; background: #fff; border-radius: 8px; padding: 20px 28px; box-shadow: 0 1px 4px rgba(22, 54, 95, .08); font-family: Arial, Helvetica, sans-serif; color: #1b2430; }
.bb-list { min-height: 48px; }
.bb-block { position: relative; border: 1px dashed transparent; border-radius: 4px; margin: 2px -8px; padding: 0 8px; }
.bb-block:hover { border-color: #b8c7da; }
.bb-block.selected { border: 1px solid var(--mh-navy-2); box-shadow: 0 0 0 2px rgba(31, 78, 140, .15); }
.bb-block:focus-visible { outline: 2px solid var(--mh-navy-2); outline-offset: 1px; }
.bb-block.dragging { opacity: .35; }
.bb-tools { position: absolute; top: -13px; right: 6px; display: none; align-items: center; gap: 1px; background: var(--mh-navy-2); color: #fff; border-radius: 4px; padding: 1px 3px; font-size: .72rem; z-index: 3; }
.bb-block:hover > .bb-tools, .bb-block.selected > .bb-tools, .bb-block:focus-within > .bb-tools { display: flex; }
.bb-tools button { border: 0; background: transparent; color: #fff; padding: 1px 5px; line-height: 1.4; border-radius: 3px; }
.bb-tools button:hover, .bb-tools button:focus-visible { background: rgba(255, 255, 255, .2); }
.bb-handle { cursor: grab; padding: 0 3px; }
.bb-name { padding: 0 4px; font-weight: 600; }
.bb-edit { outline: none; overflow-wrap: anywhere; }
.bb-edit:focus { box-shadow: inset 0 -2px 0 rgba(31, 78, 140, .35); }
.bb-heading { margin: 0; line-height: 1.3; font-weight: bold; }
.bb-text { line-height: 1.6; min-height: 1.6em; }
.bb-text p { margin: 0 0 12px; }
.bb-text p:last-child { margin-bottom: 0; }
.bb-text a { color: #1f4e8c; }
.bb-button { padding: 12px 24px; font-weight: bold; font-size: 16px; line-height: 1.2; text-align: center; min-width: 4em; cursor: text; }
.bb-img { display: block; max-width: 100%; height: auto; }
.bb-placeholder { display: flex; align-items: center; justify-content: center; gap: .5rem; min-height: 120px; border: 2px dashed #c9d4e2; border-radius: 6px; color: var(--mh-muted); font-size: .875rem; text-align: center; padding: 1rem; background: #f8fafc; }
.bb-placeholder i { font-size: 1.5rem; }
.bb-divider { height: 0; }
.bb-spacer { background: repeating-linear-gradient(45deg, transparent 0 6px, rgba(22, 54, 95, .05) 6px 12px); }
.bb-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .78rem; white-space: pre-wrap; color: #44505f; background: #f6f8fa; border-radius: 4px; padding: .5rem; max-height: 160px; overflow: hidden; }
.bb-hint { font-size: .75rem; color: var(--mh-muted); margin-top: .25rem; font-family: var(--bs-body-font-family); }
.bb-cols { display: grid; }
.bb-col { border: 1px dashed #d6dee8; border-radius: 4px; padding: 4px 8px; min-height: 64px; }
.bb-empty { display: flex; align-items: center; justify-content: center; min-height: 64px; color: var(--mh-muted); font-size: .85rem; font-family: var(--bs-body-font-family); text-align: center; }
.bb-indicator { height: 4px; border-radius: 2px; background: var(--mh-teal); margin: 4px 0; box-shadow: 0 0 0 3px rgba(15, 143, 130, .18); }
.bb.is-dragging .bb-list { background: rgba(15, 143, 130, .04); }
.bb-props { border-left: 1px solid var(--mh-border); padding: .9rem; background: #fff; }
.bb-props-inner { max-height: calc(100vh - 90px); overflow-y: auto; }
.bb-props-head { display: flex; align-items: center; margin-bottom: .6rem; }
.bb-props-empty { color: var(--mh-muted); text-align: center; padding: 2rem .5rem; font-size: .9rem; }
.bb-props-empty i { font-size: 2rem; color: #9db6d6; }
.bb-html-src { min-height: 200px; font-size: .78rem; }
@media (max-width: 991.98px) {
  .bb { grid-template-columns: 1fr; }
  .bb-palette { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--mh-border); }
  .bb-palette-title { width: 100%; }
  .bb-props { border-left: 0; border-top: 1px solid var(--mh-border); }
  .bb-props-inner { max-height: none; }
  .bb-palette-inner { flex-direction: row; flex-wrap: wrap; }
  .bb-canvas-wrap { padding: .75rem; }
  .bb-canvas { padding: 16px; }
}
/* Template mode */
.bb-canvas.bb-canvas-page { background: transparent; box-shadow: none; padding: 8px; border-radius: 0; }
.bb-slot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem; min-height: 150px; border: 2px dashed #9db6d6; color: var(--mh-muted); text-align: center; font-family: var(--bs-body-font-family); }
.bb-slot i { font-size: 1.6rem; color: var(--mh-navy-2); }
.bb-slot strong { color: var(--mh-navy); }
.bb-footer { line-height: 1.5; }
.bb-tile.disabled { opacity: .45; cursor: not-allowed; }

/* Personalisation quick-click chips */
.tag-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.tag-bar-label { font-size: .78rem; font-weight: 600; color: var(--mh-muted); margin-right: .15rem; }
.tag-chip { display: inline-flex; align-items: center; gap: .3rem; border: 1px solid #b9d9d4; background: var(--mh-teal-soft); color: #0b5d55; border-radius: 999px; padding: .2rem .65rem; font-size: .8rem; font-weight: 500; line-height: 1.3; cursor: pointer; }
.tag-chip:hover { background: #d3eeea; border-color: var(--mh-teal); }
.tag-chip:focus-visible { outline: 2px solid var(--mh-navy-2); outline-offset: 2px; }
.tag-chip i { font-size: .85rem; }
.tag-bar-compact .tag-chip { padding: .15rem .55rem; }
.bb-tagrow { padding: .5rem .75rem; border-bottom: 1px solid var(--mh-border); background: #fbfcfd; }

/* Sample gallery */
.sample-card { display: flex; gap: .75rem; align-items: flex-start; height: 100%; padding: .75rem .9rem; border: 1px solid var(--mh-border); border-radius: .6rem; background: #fff; cursor: pointer; }
.sample-card > i { font-size: 1.4rem; color: var(--mh-navy-2); line-height: 1; margin-top: .1rem; }
.sample-card:hover { border-color: #9db6d6; }
.btn-check:checked + .sample-card { border-color: var(--mh-navy-2); box-shadow: 0 0 0 2px rgba(31, 78, 140, .2); background: #f5f8fc; }
.btn-check:focus-visible + .sample-card { outline: 2px solid var(--mh-navy-2); outline-offset: 2px; }

/* Product overview (brochure viewer) */
.overview-toc { display: flex; flex-wrap: wrap; gap: .35rem; }
.overview-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 1.25rem; }
.overview-page { margin: 0; scroll-margin-top: 76px; }
.overview-page img { display: block; width: 100%; height: auto; border-radius: 6px; box-shadow: 0 2px 10px rgba(22, 54, 95, .14); background: #fff; }
.overview-page figcaption { text-align: center; margin-top: .4rem; }
@media (max-width: 575.98px) { .overview-pages { grid-template-columns: 1fr; } }
.text-teal { color: #0b6b62; }

/* Image library */
.img-drop { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.1rem; border: 2px dashed #b8c7da; border-radius: .75rem; background: #fbfcfd; }
.img-drop i { color: var(--mh-navy-2); }
.img-drop.over { border-color: var(--mh-teal); background: var(--mh-teal-soft); }
.img-drop.busy { opacity: .6; pointer-events: none; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; }
.img-card { display: flex; flex-direction: column; border: 1px solid var(--mh-border); border-radius: .6rem; overflow: hidden; background: #fff; cursor: default; height: 100%; }
label.img-card { cursor: pointer; }
.img-thumb { display: flex; align-items: center; justify-content: center; height: 120px; background: repeating-conic-gradient(#f1f4f8 0% 25%, #ffffff 0% 50%) 50% / 16px 16px; }
.img-thumb img { max-width: 100%; max-height: 120px; object-fit: contain; }
.img-meta { display: flex; flex-direction: column; padding: .45rem .6rem; min-width: 0; }
.img-name { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-check:checked + .img-card { border-color: var(--mh-navy-2); box-shadow: 0 0 0 3px rgba(31, 78, 140, .25); }
.btn-check:focus-visible + .img-card { outline: 2px solid var(--mh-navy-2); outline-offset: 2px; }
.img-item { display: flex; flex-direction: column; gap: .35rem; }
.img-actions { display: flex; gap: .35rem; }
.img-actions .btn:first-child { flex: 1; }

/* Segments */
.seg-row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; padding: .45rem 0; border-bottom: 1px dashed var(--mh-border); }
.seg-row > * { flex: 1 1 150px; min-width: 0; }
.seg-row > datalist { display: none; }
.seg-row > button { flex: 0 0 auto; }
.seg-preview { position: sticky; top: 76px; }
/* Sign-up forms */
.form-preview { width: 100%; max-width: 480px; height: 560px; border: 0; background: #fff; border-radius: 8px; }

/* Collapsible option groups in the campaign editor (sender, tracking) */
.mh-details { border: 1px solid var(--bs-border-color, #dde3ea); border-radius: .5rem; padding: .55rem .85rem; }
.mh-details > summary { cursor: pointer; list-style-position: outside; }
.mh-details > summary:focus-visible { outline: 2px solid #1f4e8c; outline-offset: 2px; border-radius: .25rem; }
.mh-details[open] > summary { margin-bottom: .25rem; }

/* Settings → Email design preview */
.design-preview { width: 100%; height: 640px; border: 0; background: #f4f6f9; border-radius: .5rem; }

/* Report numbers that open the detail behind them */
a.kpi-link, a.kpi-link:hover { color: inherit; text-decoration: none; }
a.kpi-link:hover .value, a.num-link:hover { text-decoration: underline; }
a.num-link { color: inherit; font-weight: 600; text-decoration: none; }
.mw-320 { max-width: 320px; }

/* Inbox */
.inbox-views { gap: .25rem; flex-wrap: wrap; }
.inbox-views .nav-link { font-size: .85rem; }
.inbox-list { max-height: calc(100vh - 290px); overflow-y: auto; }
.inbox-item { border-left: 3px solid transparent; }
.inbox-item.active { background: #eef3fa; color: inherit; border-left-color: #1f4e8c; }
.inbox-item.unread .inbox-who { font-weight: 700; }
.inbox-who { min-width: 0; }
.dot-unread { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; background: #1f4e8c; margin-right: .4rem; vertical-align: middle; }
.inbox-thread { max-height: calc(100vh - 420px); min-height: 220px; overflow-y: auto; background: #f7f9fb; }
.inbox-msg { background: #fff; border: 1px solid #e3e8ef; border-radius: .6rem; padding: .75rem .9rem; margin-bottom: .75rem; max-width: 92%; }
.inbox-msg.out { margin-left: auto; background: #eef3fa; border-color: #c9d7ea; }
.inbox-msg.note { margin-left: auto; margin-right: auto; background: #fff8e1; border-color: #f1dca0; max-width: 100%; }
.inbox-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .95rem; }
.inbox-original { width: 100%; height: 420px; border: 1px solid #e3e8ef; border-radius: .4rem; background: #fff; }
.min-w-0 { min-width: 0; }
@media (max-width: 991.98px) { .inbox-list, .inbox-thread { max-height: none; } }
