/* ============================================================
   console.css — Console-specific components
   Requires: moonshot.css (design system base)
   ============================================================ */


/* ── Console Shell (body layout — sidebar + main) ────────────── */

.console-shell {
	display: flex;
	height: 100vh;
	overflow: hidden;
}

.console-shell>main {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.console-shell>main>.content-body {
	flex: 1;
	overflow-y: auto;
}

/* ── Service Rail (vertical icon strip — console 2-column sidebar) ── */

.service-rail__item {
	width: 100%;
	height: 50px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 0;
	color: var(--text-muted);
	text-decoration: none;
	position: relative;
	transition: background 150ms, color 150ms;
	border-left: 3px solid transparent;
	border-bottom: 1px solid var(--border);
}

.service-rail__item:hover {
	background: var(--surface-hover);
	color: var(--text);
}

.service-rail__item--active {
	color: var(--service-color, var(--accent));
	background: color-mix(in srgb, var(--service-color, var(--accent)) 12%, transparent);
	border-left-color: var(--service-color, var(--accent));
}

.service-rail__icon {
	width: 22px;
	height: 22px;
}

.service-rail__tooltip {
	display: none;
	position: absolute;
	left: calc(100% + 8px);
	top: 50%;
	transform: translateY(-50%);
	background: var(--text);
	color: var(--bg);
	padding: 4px 8px;
	border-radius: var(--radius-sm);
	font-size: 0.6875rem;
	white-space: nowrap;
	z-index: var(--z-modal);
	pointer-events: none;
}

.service-rail__item:hover .service-rail__tooltip {
	display: block;
}

/* ── Sidebar (console: 2-col — icon rail + nav) ───────────── */

.sidebar {
	width: calc(56px + 244px);
	flex-shrink: 0;
	background: var(--surface);
	border-right: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	position: sticky;
	top: 0;
	height: 100vh;
	overflow: hidden;
	z-index: var(--z-sidebar);
}

.sidebar__logo {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
	margin-top: 4px;
}

.sidebar__logo img {
	height: 48px;
	width: auto;
	max-width: none;
}

.sidebar__body {
	flex: 1;
	display: flex;
	overflow: hidden;
	min-height: 0;
}

.sidebar__body>aside {
	width: 56px;
	flex-shrink: 0;
	overflow-y: auto;
	border-right: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 0;
	margin: 0;
	padding: 0;
}

.sidebar__body>nav {
	flex: 1;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
	min-width: 0;
	margin: 0;
	padding: 0;
}

.sidebar>.sidebar__footer {
	flex-shrink: 0;
	padding: 12px;
	border-top: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* Reset list styling inside sidebar */
.sidebar nav ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.sidebar nav li {
	display: flex;
	padding: 0;
	margin: 0;
}

.sidebar nav a {
	padding: 0;
	margin: 0;
}

#nav-content {
	flex: 1;
	overflow-y: auto;
	min-height: 0;
}

.sidebar .nav__brand a {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
}

.sidebar .nav__brand img {
	height: 24px;
	width: auto;
}

/* Service header inside nav */
.sidebar .nav__service-header {
	display: flex;
	align-items: center;
	gap: 8px;
	height: 50px;
	padding: 0 16px;
	border-bottom: 1px solid var(--border);
	flex-shrink: 0;
}

.sidebar .nav__service-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	flex-shrink: 0;
}

.sidebar .nav__service-name {
	font-weight: 600;
	font-size: 0.8125rem;
	color: var(--text);
}

/* Nav menu items */
.sidebar .nav__menu {
	list-style: none;
	padding: 0 8px;
	margin: 0;
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 4px;
}

.sidebar .nav__item {
	margin: 0;
	width: 100%;
}

.sidebar .nav__section-label {
	display: block;
	width: 100%;
	text-align: left;
	font-size: 10px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--text-muted);
	padding: 16px 10px 6px;
	list-style: none;
}

.sidebar .nav__link {
	display: flex;
	flex: 1;
	align-items: center;
	gap: 10px;
	padding: 10px;
	font-size: 0.8125rem;
	color: var(--nav-text);
	text-decoration: none;
	border-radius: var(--radius);
	transition: background 150ms, color 150ms;
}

.sidebar .nav__link:hover {
	background: var(--nav-hover-bg);
	color: var(--nav-text-hover);
}

.sidebar .nav__link--active {
	background: var(--nav-active-bg);
	color: var(--nav-active-text);
	font-weight: 600;
}

.sidebar .nav__icon {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

/* Mobile service rail inside nav overlay */
.sidebar .nav__rail-mobile {
	display: none;
}

/* ── Content Header (Org & Cost Center selectors) ──────────── */

.content-header {
	height: 50px;
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	position: sticky;
	top: 0;
	z-index: var(--z-sticky);
}

.content-header__inner {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 1.5rem;
	padding: 0 2rem;
	height: 100%;
	font-size: 0.8125rem;
}

.content-header__group {
	display: flex;
	align-items: center;
	gap: 0.375rem;
	margin: 0;
}

.content-header__group label {
	font-size: 0.6875rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--text-muted);
	margin: 0;
	white-space: nowrap;
}

.content-header__group select {
	padding: 0.25rem 2rem 0.25rem 0.5rem;
	font-size: 0.8125rem;
	font-weight: 500;
	margin: 0;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	color: var(--text);
	cursor: pointer;
	line-height: 1.4;
}

.content-header__group span {
	font-weight: 500;
	color: var(--text);
	opacity: 0.85;
}

/* ── Preferences Menu (gear dropdown) ─────────────────────── */

.preferences-menu {
	position: relative;
	margin-left: auto;
}

.preferences-menu__trigger {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	margin: 0;
	background: transparent;
	border: 1px solid transparent;
	border-radius: var(--radius);
	color: var(--text-muted);
	cursor: pointer;
	transition: color 150ms, border-color 150ms;
}

.preferences-menu__trigger:hover {
	color: var(--text);
	border-color: var(--border);
	background: var(--surface-2);
}

.preferences-menu--open .preferences-menu__trigger {
	color: var(--text);
	border-color: var(--border);
	background: var(--surface-2);
}

.preferences-menu__dropdown {
	display: none;
	position: absolute;
	top: calc(100% + 6px);
	right: 0;
	min-width: 200px;
	padding: 12px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
	z-index: var(--z-overlay);
}

.preferences-menu--open .preferences-menu__dropdown {
	display: block;
}

.preferences-menu__section {
	margin-bottom: 10px;
}

.preferences-menu__section:last-child {
	margin-bottom: 0;
}

.preferences-menu__divider {
	height: 1px;
	background: var(--border);
	margin: 10px -12px;
}

.preferences-menu__logout {
	display: flex;
	align-items: center;
	gap: 6px;
	width: 100%;
	padding: 6px 8px;
	margin: 0;
	background: none;
	border: 1px solid transparent;
	border-radius: var(--radius);
	color: var(--text-muted);
	font-size: 0.75rem;
	font-weight: 500;
	cursor: pointer;
	transition: color 150ms, background 150ms;
}

.preferences-menu__logout:hover {
	color: var(--error);
	background: var(--error-bg);
}

.preferences-menu__label {
	display: block;
	font-size: 0.625rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--text-muted);
	margin-bottom: 6px;
}

/* ── Auth Page Preferences (lang + theme toggles) ────────── */

.auth-prefs {
	display: flex;
	justify-content: center;
	gap: 0.5rem;
	margin-top: 1rem;
}

.auth-prefs__group {
	display: flex;
	gap: 2px;
	background: var(--surface-2);
	border-radius: var(--radius);
	padding: 2px;
}

.auth-prefs__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	padding: 5px 10px;
	font-size: 0.6875rem;
	text-decoration: none;
	color: var(--text-muted);
	border-radius: calc(var(--radius) - 2px);
	transition: background 150ms;
}

.auth-prefs__btn:hover {
	background: var(--surface-hover);
}

.auth-prefs__btn--active {
	background: var(--surface);
	color: var(--text);
	font-weight: 500;
}

.auth-prefs__icon {
	width: 14px;
	height: 14px;
}

/* ── Content Body ─────────────────────────────────────────── */

.content-body {
	padding: 1.5rem max(2rem, calc((100% - 1480px) / 2));
	width: 100%;
}

/* Toast notifications now live in pkg/toast/assets/toast.css, shared with
   Control (docs/adr/022). */

/* ── Status Badges (campaign states) ──────────────────────── */

.status-badge {
	display: inline-flex;
	align-items: center;
	padding: 2px 10px;
	border-radius: var(--radius-full);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.03em;
	text-transform: uppercase;
}

.status-badge--draft {
	background: var(--surface-2);
	color: var(--text-muted);
	border: 1px solid var(--border);
}

.status-badge--sending {
	background: var(--warning-bg);
	color: var(--warning);
	border: 1px solid var(--warning-border);
}

.status-badge--sent,
.status-badge--completed {
	background: var(--success-bg);
	color: var(--success);
	border: 1px solid var(--success-border);
}

.status-badge--failed {
	background: var(--error-bg);
	color: var(--error);
	border: 1px solid var(--error-border);
}

.status-badge--scheduled {
	background: var(--info-bg);
	color: var(--info);
	border: 1px solid var(--info-border);
}

.status-badge--cancelled {
	background: var(--surface-2);
	color: var(--text-muted);
	border: 1px solid var(--border);
	text-decoration: line-through;
}

.status-badge--empty {
	background: var(--surface-2);
	color: var(--text-muted);
	border: 1px solid var(--border);
}

.status-badge--active {
	background: var(--success-bg);
	color: var(--success);
	border: 1px solid var(--success-border);
}

.status-badge--paused {
	background: var(--warning-bg);
	color: var(--warning);
	border: 1px solid var(--warning-border);
}

.status-badge--expired {
	background: var(--surface-2);
	color: var(--text-muted);
	border: 1px solid var(--border);
	text-decoration: line-through;
}

/* ── Trace Timeline ───────────────────────────────────────── */

.trace-timeline {
	position: relative;
	padding: 0;
}

.trace-timeline__item {
	position: relative;
	display: flex;
	gap: 16px;
	padding-bottom: 0;
	min-height: 56px;
}

.trace-timeline__item:last-child {
	min-height: auto;
}

.trace-timeline__rail {
	display: flex;
	flex-direction: column;
	align-items: center;
	flex-shrink: 0;
	width: 32px;
}

.trace-timeline__dot {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	border: 2px solid var(--border);
	background: var(--surface);
	flex-shrink: 0;
	margin-top: 4px;
	z-index: 1;
}

.trace-timeline__line {
	flex: 1;
	width: 2px;
	background: var(--border);
	margin-top: 4px;
}

.trace-timeline__item:last-child .trace-timeline__line {
	display: none;
}

.trace-timeline__dot--scheduled {
	background: var(--info);
	border-color: var(--info);
}

.trace-timeline__dot--queued {
	background: var(--border);
}

.trace-timeline__dot--accepted {
	background: var(--success-bg);
	border-color: var(--success);
}

.trace-timeline__dot--delivered {
	background: var(--success);
	border-color: var(--success);
}

.trace-timeline__dot--opened,
.trace-timeline__dot--clicked {
	background: var(--accent);
	border-color: var(--accent);
}

.trace-timeline__dot--failed {
	background: var(--error);
	border-color: var(--error);
}

.trace-timeline__content {
	flex: 1;
	padding-bottom: 20px;
	min-width: 0;
}

.trace-timeline__item:last-child .trace-timeline__content {
	padding-bottom: 0;
}

.trace-timeline__header {
	display: flex;
	align-items: center;
	gap: 10px;
}

.trace-timeline__time {
	font-size: 0.75rem;
	color: var(--text-muted);
}

.trace-timeline__error {
	margin: 6px 0 0;
	padding: 8px 12px;
	font-size: 0.8125rem;
	color: var(--error);
	background: var(--error-bg);
	border-radius: var(--radius);
	border-left: 3px solid var(--error);
}

/* ── Trace Detail Card ────────────────────────────────────── */

.trace-detail {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 20px;
	padding: 16px 20px;
}

.trace-detail__item small {
	display: block;
	font-size: 0.6875rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--text-muted);
	margin-bottom: 4px;
}

.trace-detail__item div {
	font-size: 0.875rem;
	font-weight: 500;
}

/* ── Empty State ──────────────────────────────────────────── */

.empty-state {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 72px 24px;
	text-align: center;
	gap: 16px;
}

.empty-state svg {
	width: 64px;
	height: 64px;
	color: var(--text-subtle);
	opacity: 0.5;
}

.empty-state p {
	font-size: 0.875rem;
	color: var(--text-muted);
	margin: 0;
}

.empty-state--sm {
	padding: 32px 24px;
}

/* ── Campaign Stats Grid ──────────────────────────────────── */

.campaign-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
	gap: 1px;
	padding: 16px;
}

.campaign-stats__item {
	text-align: center;
	padding: 12px 8px;
}

.campaign-stats__value {
	font-size: 26px;
	font-weight: 700;
	line-height: 1.2;
}

.campaign-stats__value--success {
	color: var(--success);
}

.campaign-stats__value--warning {
	color: var(--warning);
}

.campaign-stats__value--danger {
	color: var(--error);
}

.campaign-stats__value--info,
.campaign-stats__value--accent {
	color: var(--accent);
}

.campaign-stats__label {
	font-size: 0.6875rem;
	font-weight: 500;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin-top: 4px;
}

/* ── Detail List (dl grid) ────────────────────────────────── */

dl.detail-list {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 10px 16px;
	font-size: 0.8125rem;
	margin: 0;
}

dl.detail-list dt {
	color: var(--text-muted);
	font-weight: 500;
}

dl.detail-list dd {
	margin: 0;
	overflow-wrap: break-word;
	min-width: 0;
}

dialog .detail-list {
	margin: 0;
	font-size: 0.8125rem;
}

dialog .detail-list dt {
	font-weight: 500;
	color: var(--text-muted);
	font-size: 0.75rem;
}

dialog .detail-list dd {
	margin: 0 0 8px;
}

/* ── Code Pill / Block ────────────────────────────────────── */

.code-pill {
	display: inline-block;
	padding: 2px 8px;
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	font-family: var(--font-mono);
	font-size: 0.6875rem;
	color: var(--accent);
	word-break: break-all;
}

.code-block {
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 12px 16px;
	margin: 0;
	overflow-x: auto;
	font-size: 0.75rem;
	line-height: 1.5;
}

.code-block code {
	background: none;
	border: none;
	padding: 0;
	font-size: inherit;
	color: var(--text);
}

/* ── HTML Preview (iframe) ────────────────────────────────── */

.html-preview {
	background: #fff;
	border-radius: var(--radius);
	min-height: 120px;
	overflow: hidden;
}

.html-preview iframe {
	width: 100%;
	min-height: 500px;
	border: none;
	display: block;
	background: #fff;
}

/* ── File Upload Zone ─────────────────────────────────────── */

.file-upload-zone {
	position: relative;
	border: 2px dashed var(--border);
	border-radius: var(--radius);
	padding: 32px 24px;
	text-align: center;
	cursor: pointer;
	transition: border-color 150ms, background 150ms;
}

.file-upload-zone:hover,
.file-upload-zone--dragover {
	border-color: var(--accent);
	background: var(--accent-muted);
}

.file-upload-zone--success {
	border: none !important;
	padding: 0 !important;
	cursor: default !important;
	background: transparent !important;
}

.file-upload-label {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	cursor: pointer;
}

.file-upload-icon {
	width: 40px;
	height: 40px;
	color: var(--text-muted);
}

.file-upload-zone:hover .file-upload-icon {
	color: var(--accent);
}

.file-upload-cta {
	font-size: 0.875rem;
	font-weight: 600;
}

.file-upload-sub {
	font-size: 0.75rem;
	color: var(--text-muted);
}

.file-upload-input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
}

.upload-status {
	margin-top: 12px;
	padding: 8px 14px;
	border-radius: var(--radius);
	font-size: 0.8125rem;
	font-weight: 500;
}

/* ── Progress Bar ─────────────────────────────────────────── */

.progress-row {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin-bottom: 0.5rem;
}

.progress-row__label {
	flex: 0 0 100px;
	font-size: 0.8125rem;
	color: var(--text-muted);
}

.progress-bar {
	flex: 1;
	height: 8px;
	background: var(--border);
	border-radius: 4px;
	overflow: hidden;
}

.progress-bar__fill {
	height: 100%;
	border-radius: 4px;
	transition: width 0.4s ease;
}

.progress-bar__fill--primary {
	background: var(--accent);
}

.progress-bar__fill--success {
	background: var(--success);
}

.progress-bar__fill--info {
	background: var(--info);
}

.progress-bar__fill--danger {
	background: var(--error);
}

.progress-row__pct {
	flex: 0 0 40px;
	text-align: right;
	font-size: 0.8125rem;
	font-weight: 500;
}

/* ── Wizard Progress (stepper) ────────────────────────────── */

.wizard-progress {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0;
	margin-bottom: 2rem;
	padding: 0;
	counter-reset: step;
}

.wizard-progress__step {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 24px;
	font-size: 0.8125rem;
	font-weight: 500;
	color: var(--text-muted);
	text-decoration: none;
	border-bottom: 2px solid var(--border);
	transition: color 150ms, border-color 150ms;
}

.wizard-progress__step--active {
	color: var(--accent);
	border-bottom-color: var(--accent);
}

.wizard-progress__step--done {
	color: var(--success);
	border-bottom-color: var(--success);
}

.wizard-progress__number {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.75rem;
	font-weight: 600;
	background: var(--surface-2);
	border: 1px solid var(--border);
}

.wizard-progress__step--active .wizard-progress__number {
	background: var(--accent-muted);
	border-color: var(--accent);
	color: var(--accent);
}

.wizard-progress__step--done .wizard-progress__number {
	background: var(--success-bg);
	border-color: var(--success);
	color: var(--success);
}

.wizard-progress__check {
	width: 14px;
	height: 14px;
}

.wizard-progress__label {
	white-space: nowrap;
}

/* ── Filter Bar ───────────────────────────────────────────── */

.filter-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: flex-end;
	margin-bottom: 1rem;
}

.filter-bar select,
.filter-bar input,
.filter-bar button,
.filter-bar [role="button"] {
	width: auto;
	margin-bottom: 0;
	height: 2.125rem;
	padding: 0 12px;
	font-size: 0.8125rem;
	line-height: 2.125rem;
	box-sizing: border-box;
}

.filter-bar select {
	min-width: 140px;
	padding-right: 32px;
}

.filter-bar input[type="date"] {
	min-width: 130px;
}

.filter-bar .count {
	font-size: 0.75rem;
	color: var(--text-muted);
	margin-left: auto;
}

.filter-bar__field {
	display: flex;
	flex-direction: column;
	gap: 2px;
	margin-bottom: 0;
}

.filter-bar__field span {
	font-size: 0.6875rem;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--text-muted);
}

.filter-bar__field input {
	margin-bottom: 0;
}

/* ── Table Cards (figure wrapper) ─────────────────────────── */

main figure {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
	margin: 0 0 1.5rem;
	padding: 6px;
}

main figure table {
	margin-bottom: 0;
	border-collapse: separate;
	border-spacing: 0;
}

main figure table thead th {
	background: var(--surface-2);
	border-bottom: 2px solid var(--border);
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--text-muted);
}

main figure table td a {
	text-decoration: none;
	color: var(--text);
	font-weight: 500;
}

main figure table td a:hover {
	color: var(--accent);
}

main figure table tbody tr:last-child td {
	border-bottom: none;
}

/* ── Access Panel ─────────────────────────────────────────── */

.access-panel {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
	margin-top: 1.5rem;
}

.access-panel__header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 16px;
	background: var(--surface-2);
	border-bottom: 1px solid var(--border);
}

.access-panel__title {
	font-weight: 600;
	font-size: 1rem;
	margin: 0;
}

.access-panel__subtitle {
	font-size: 0.75rem;
	color: var(--text-muted);
	margin: 0;
}

.access-panel table {
	margin: 0;
}

.access-panel table thead th {
	background: color-mix(in srgb, var(--surface-2) 50%, transparent);
	border-bottom-width: 1px;
	font-size: 0.75rem;
	font-weight: 500;
	color: var(--text-muted);
}

.access-panel table td {
	font-size: 0.8125rem;
}

.access-panel table td .badge {
	font-size: 0.75rem;
}

.access-panel table td a {
	text-decoration: none;
	color: var(--text);
	font-weight: 500;
}

.access-panel table td a:hover {
	color: var(--accent);
}

.access-panel table tbody tr:last-child td {
	border-bottom: none;
}

.access-panel__empty {
	padding: 24px 16px;
	text-align: center;
	color: var(--text-muted);
	font-size: 0.8125rem;
}

.access-panel .pagination {
	margin: 0;
	padding: 10px 16px;
	border-top: 1px solid var(--border);
	background: color-mix(in srgb, var(--surface-2) 50%, transparent);
	font-size: 0.75rem;
}

.access-panel .filter-bar {
	padding: 12px 16px;
	margin-bottom: 0;
	border-bottom: 1px solid var(--border);
}

/* ── Dev API key dialog (create form + created state) ────────── */
.dev-key-dialog__article { max-width: 560px; }
.dev-key-form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.dev-key-form__services { margin-bottom: 12px; border: 0; padding: 0; }
.dev-key-form__services legend { padding: 0; }
.dev-key-form__services-hint { font-size: 0.8125rem; color: var(--text-muted); margin: 2px 0 8px; }
.dev-key-form__services-list { display: flex; flex-wrap: wrap; gap: 12px; }
.dev-key-form__service-label { display: flex; align-items: center; gap: 6px; font-weight: normal; cursor: pointer; }
.dev-key-form__service-label input[type="checkbox"] { width: auto; margin: 0; }
.dev-key-form__service-label span { text-transform: capitalize; }
.dev-key-form__actions { display: flex; gap: 8px; }
.dev-key-form__actions button { width: auto; white-space: nowrap; }

.dev-key-created__body { padding: var(--sp-4) var(--sp-5); display: flex; flex-direction: column; gap: 12px; }
.dev-key-created__body .alert { margin: 0; }
.dev-key-created__key-row { display: flex; align-items: center; gap: 8px; }
.dev-key-created__key-row .code-pill { flex: 1; font-size: 0.8125rem; user-select: all; word-break: break-all; }
.dev-key-created__key-row button { white-space: nowrap; }
.dev-key-created__actions { display: flex; justify-content: flex-end; }
.dev-key-created__actions button { width: auto; }

/* ── Tab nav (status tabs) ─────────────────────────────────── */
.tab-nav {
	display: flex;
	gap: 0;
	border-bottom: 1px solid var(--border);
	padding: 0 16px;
	overflow-x: auto;
	scrollbar-width: none;
}

.tab-nav::-webkit-scrollbar {
	display: none;
}

.tab-nav__item {
	display: inline-block;
	padding: 10px 14px;
	font-size: 0.85rem;
	color: var(--text-muted);
	text-decoration: none;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
	white-space: nowrap;
	transition: color 0.15s, border-color 0.15s;
}

.tab-nav__item:hover {
	color: var(--text);
}

.tab-nav__item--active {
	color: var(--accent);
	border-bottom-color: var(--accent);
	font-weight: 500;
}

.access-panel table td form {
	display: inline;
	margin: 0;
}

.access-panel table td button,
.access-panel table td [role="button"] {
	vertical-align: middle;
}

.access-panel form button[type="submit"],
.access-panel form .btn {
	width: auto;
}

/* ── Smart-links tables — unified visual refinements ──────── */

.access-panel table.responsive tbody tr:nth-child(even) {
	background: var(--surface-2);
}

.access-panel table.responsive td,
.access-panel table.responsive th {
	vertical-align: middle;
}

.access-panel table.responsive td:last-child,
.access-panel table.responsive th:last-child {
	text-align: center;
}

code.smartlinks-slug[data-copy] {
	cursor: pointer;
}

.sl-btn {
	position: relative;
}

.sl-btn::after {
	content: attr(data-tooltip);
	position: absolute;
	bottom: calc(100% + 5px);
	left: 50%;
	transform: translateX(-50%);
	background: #111;
	color: #fff;
	font-size: 0.7rem;
	line-height: 1;
	padding: 4px 8px;
	border-radius: 4px;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.12s;
	z-index: 100;
}

.sl-btn:hover::after {
	opacity: 1;
}

/* Style anchor tags as buttons when they have button classes */
a.sl-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--sp-2);
	padding: var(--sp-2) var(--sp-3);
	font-size: 14px;
	border: 1px solid transparent;
	border-radius: var(--radius);
	transition:
		background var(--duration) var(--ease),
		border-color var(--duration) var(--ease);
	text-decoration: none;
	cursor: pointer;
}

a.sl-btn.outline {
	background: transparent;
	border-color: var(--border-strong);
	color: var(--text);
}

a.sl-btn.outline:hover {
	background: var(--surface-hover);
	border-color: var(--border-strong);
	color: var(--text);
}

a.sl-btn.xs {
	padding: var(--sp-1) var(--sp-3);
	font-size: 13px;
	min-height: 32px;
}

/* ── Form Helpers ─────────────────────────────────────────── */

.form-actions {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
	margin-top: 1.5rem;
}

.form-actions button,
.form-actions [role="button"] {
	width: auto;
	min-width: 140px;
	text-align: center;
	margin-bottom: 0;
}

.form-group {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.form-group label {
	font-size: 0.8125rem;
	font-weight: 500;
	margin-bottom: 6px;
}

.form-group label span {
	font-weight: 400;
	color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
	margin-bottom: 4px;
}

.form-group small {
	display: block;
	font-size: 0.75rem;
	line-height: 1.4;
	color: var(--text-muted);
	margin: 0;
}

/* Button margin reset in panels/tables */
.access-panel button,
.access-panel [role="button"],
.page-header button,
.page-header [role="button"],
td button,
td [role="button"] {
	margin-bottom: 0;
}

/* ── Dashboard Extensions (beyond moonshot.css base) ──────── */

.dash-kpi__sub {
	display: block;
	font-size: 0.75rem;
	color: var(--text-muted);
	margin-top: 0.25rem;
}

.dash-kpi .text-ok {
	color: var(--success);
}

.dash-kpi .text-danger {
	color: var(--error);
}

.dash-volume {
	margin-bottom: 1.5rem;
}

.dash-volume summary {
	font-weight: 600;
	margin-bottom: 0.75rem;
}

.dash-stats-row {
	display: grid;
	grid-template-columns: repeat(8, 1fr);
	gap: 0.5rem;
	text-align: center;
}

.dash-stats-row>div {
	padding: 0.75rem 0.25rem;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
}

.dash-stats-row__val {
	display: block;
	font-size: 1.125rem;
	font-weight: 600;
	line-height: 1.2;
}

.dash-stats-row__label {
	display: block;
	font-size: 0.7rem;
	color: var(--text-muted);
	margin-top: 0.125rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.dash-activity header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
}

.dash-activity__totals {
	display: flex;
	gap: 16px;
	align-items: center;
}

.dash-activity__totals span {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
}

.dash-activity__totals small {
	font-size: 0.65rem;
	text-transform: uppercase;
	color: var(--text-muted);
	letter-spacing: 0.04em;
}

.dash-activity__totals strong {
	font-size: 0.9rem;
}

/* ── Wizard Step 3: Attachments ──────────────────────────── */

.attachment-row {
	display: flex;
	flex-direction: column;
	gap: var(--sp-3);
	padding: var(--sp-4);
	margin-bottom: var(--sp-3);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	position: relative;
}

.attachment-row__fields {
	display: flex;
	gap: var(--sp-3);
	flex-wrap: wrap;
}

.attachment-row__fields .form-group {
	min-width: 200px;
}

.attachment-row__fields .form-label {
	font-size: 0.75rem;
	color: var(--text-muted);
	margin-bottom: 2px;
}

.attachment-row__remove {
	position: absolute;
	top: var(--sp-3);
	right: var(--sp-3);
	width: 24px;
	height: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--radius);
	font-size: 0.75rem;
	cursor: pointer;
	background: transparent;
	color: var(--text-muted);
	border: 1px solid var(--border);
	transition: background 150ms, color 150ms, border-color 150ms;
}

.attachment-row__remove:hover {
	background: var(--error);
	color: #fff;
	border-color: var(--error);
}

.attachment-row--file {
	flex-direction: row;
	align-items: center;
	gap: var(--sp-3);
	padding: var(--sp-3) var(--sp-4);
}

.attachment-row__name {
	font-weight: 500;
	font-size: 0.875rem;
	flex: 1;
}

.attachment-row__type {
	font-size: 0.75rem;
	color: var(--text-muted);
	background: var(--surface-2);
	padding: 2px 8px;
	border-radius: var(--radius);
}

.attachment-list {
	margin-top: var(--sp-3);
}

.wiz-pdf-vars {
	margin-top: var(--sp-3);
	padding-top: var(--sp-3);
	border-top: 1px solid var(--border);
}

.wiz-pdf-vars .variable-mapping-row {
	margin-bottom: var(--sp-2);
}

/* Gap between the two article sections in step 3 */
#wizard-attachments-form article+article {
	margin-top: var(--sp-5);
}

/* QA-3: KPI cards collapse to 2x2 on tablets so the four metrics
   (delivery / open / click / bounce) stay aligned instead of leaving
   "bounce rate" stranded on its own row. */
@media (max-width: 1024px) {
	.dash-kpi {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* QA-4: the 8-column delivery-volume strip is unreadable on phones.
   Stack to 2 columns on small screens so each value has breathing room. */
@media (max-width: 768px) {
	.dash-stats-row {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 480px) {
	.dash-stats-row {
		grid-template-columns: repeat(2, 1fr);
		gap: 0.375rem;
	}

	.dash-stats-row__val {
		font-size: 1rem;
	}

	.dash-stats-row__label {
		font-size: 0.625rem;
	}
}

/* ── Wizard Layout (form + preview) ───────────────────────── */

.wizard-layout {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1.5rem;
	align-items: start;
}

.wizard-layout--composer {
	grid-template-columns: 1fr 400px;
}

.wizard-card {
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
	overflow: hidden;
}

.wizard-card__header {
	padding: 12px 16px;
	background: var(--surface-2);
	border-bottom: 1px solid var(--border);
	font-weight: 600;
	font-size: 0.875rem;
}

.wizard-card__body {
	padding: 20px 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.wizard-card__body label {
	font-size: 0.8125rem;
}

.wizard-card__body fieldset {
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.wizard-layout__preview {
	position: sticky;
	top: 1.5rem;
}

.wizard-actions {
	display: flex;
	gap: 8px;
	justify-content: space-between;
	align-items: center;
	margin-top: 1.5rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--border);
}

.wizard-actions button,
.wizard-actions [role="button"] {
	width: auto;
	margin: 0;
}

.wizard-actions__end {
	display: flex;
	gap: 8px;
	align-items: center;
}

/* ── SMS Wizard — audience preview ──────────────────────────── */
.audience-preview {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.audience-preview__file-label {
	color: var(--text-muted);
	white-space: nowrap;
}

.audience-preview__row-count {
	color: var(--text-muted);
}

.recipients-preview__stats {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.stat-pill {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 3px 10px;
	border-radius: 9999px;
	font-size: 0.75rem;
	line-height: 1.4;
	border: 1px solid transparent;
}

.stat-pill strong {
	font-weight: 600;
	font-size: 0.8125rem;
}

.stat-pill--valid {
	background: var(--success-bg);
	border-color: var(--success-border);
	color: var(--success);
}

.stat-pill--invalid {
	background: var(--error-bg);
	border-color: var(--error-border);
	color: var(--error);
}

.stat-pill--suppressed {
	background: var(--warning-bg);
	border-color: var(--warning-border);
	color: var(--warning);
}

.stat-pill--dup {
	background: var(--surface-2);
	border-color: var(--border);
	color: var(--text-muted);
}

.recipients-preview__cost {
	display: flex;
	gap: 12px;
	font-size: 0.8125rem;
	flex-wrap: wrap;
	color: var(--text-muted);
}

.recipients-preview__cost strong {
	color: var(--text);
}

.column-picker {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.column-picker label {
	font-size: 0.8125rem;
	color: var(--text-muted);
	margin-bottom: 0;
}

.column-picker select {
	text-transform: capitalize;
}

/* Single send form (SMS-INT-07): spaces stacked .grid rows and the standalone
   message field consistently, matching the vertical rhythm used in Number Lookup. */
.sms-send-form .grid {
	margin-bottom: var(--sp-4);
}

/* Caps the send form + result panel width so fields don't stretch the full
   content area on wide screens (single-record form, not a data table). */
.sms-send-panel {
	max-width: 640px;
}

.sms-body-group {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.sms-composer-split {
	display: grid;
	grid-template-columns: 150px 1fr;
	gap: 10px;
	align-items: stretch;
	height: 360px;
}

.sms-composer-split--solo {
	grid-template-columns: 1fr;
}

.sms-composer-split .sms-body-group {
	height: 100%;
}

.sms-composer-split .sms-body-group label {
	flex: 1;
	display: flex;
	flex-direction: column;
}

.sms-composer-split .sms-body-group textarea {
	flex: 1;
	resize: none;
}

.sms-var-scroll {
	display: flex;
	flex-direction: column;
	gap: 4px;
	max-height: 260px;
	overflow-y: auto;
}

.sms-var-scroll .sms-file-var-btn {
	width: 100%;
	text-align: left;
	font-size: 0.6875rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sms-counter {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
	font-size: 0.75rem;
	color: var(--text-muted);
}

.sms-counter__sep {
	opacity: 0.4;
}

.form-divider {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	margin-bottom: 10px;
	color: var(--text-muted);
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.form-divider::before,
.form-divider::after {
	content: '';
	flex: 1;
	height: 1px;
	background: var(--border);
}

.confirm-recipients-breakdown {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 6px;
}

/* ── SMS Phone Mockup (step 2 preview) ──────────────────────── */
.sms-phone {
	display: flex;
	justify-content: center;
	padding: 4px 0 8px;
}

.sms-phone__frame {
	position: relative;
	width: 280px;
	height: 470px;
	display: flex;
	flex-direction: column;
	border-radius: 22px;
	border: 3px solid color-mix(in srgb, var(--text) 10%, var(--surface));
	box-shadow:
		0 0 0 1px var(--border),
		0 6px 24px rgba(0, 0, 0, 0.3);
	overflow: hidden;
	background: var(--bg);
}

/* Side buttons */
.sms-phone__frame::before {
	content: '';
	position: absolute;
	right: -6px;
	top: 70px;
	width: 3px;
	height: 28px;
	background: color-mix(in srgb, var(--text) 12%, var(--surface));
	border-radius: 0 2px 2px 0;
}

.sms-phone__frame::after {
	content: '';
	position: absolute;
	left: -6px;
	top: 60px;
	width: 3px;
	height: 20px;
	background: color-mix(in srgb, var(--text) 12%, var(--surface));
	border-radius: 2px 0 0 2px;
	box-shadow: 0 28px 0 color-mix(in srgb, var(--text) 12%, var(--surface));
}

.sms-phone__status-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 6px 14px 4px;
	background: var(--surface-2);
	color: var(--text);
	font-size: 0.625rem;
	font-weight: 700;
}

.sms-phone__status-icons {
	display: flex;
	align-items: center;
	gap: 5px;
}

.sms-phone__app-bar {
	display: flex;
	align-items: center;
	gap: 7px;
	padding: 7px 10px;
	background: var(--surface-2);
	border-bottom: 1px solid var(--border);
}

.sms-phone__back-icon {
	flex-shrink: 0;
	color: var(--accent);
}

.sms-phone__avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--accent-muted);
	color: var(--accent);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.75rem;
	font-weight: 700;
	flex-shrink: 0;
	text-transform: uppercase;
}

.sms-phone__contact {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 1px;
}

.sms-phone__contact-name {
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.sms-phone__contact-sub {
	font-size: 0.5625rem;
	color: var(--text-muted);
}

.sms-phone__app-bar-actions {
	display: flex;
	gap: 10px;
	color: var(--text-muted);
	flex-shrink: 0;
}

.sms-phone__messages {
	flex: 1;
	min-height: 220px;
	padding: 12px 10px;
	background: var(--bg);
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.sms-phone__date-sep {
	text-align: center;
	font-size: 0.5625rem;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.sms-phone__bubble-wrap {
	display: flex;
	justify-content: flex-start;
}

.sms-phone__bubble {
	max-width: 82%;
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: 3px 14px 14px 14px;
	padding: 7px 10px;
}

.sms-phone__bubble-text {
	font-size: 0.6875rem;
	color: var(--text);
	line-height: 1.5;
	word-break: break-word;
	white-space: pre-wrap;
}

.sms-phone__input-bar {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px 10px;
	background: var(--surface-2);
	border-top: 1px solid var(--border);
}

.sms-phone__input-fake {
	flex: 1;
	font-size: 0.6875rem;
	color: var(--text-muted);
	background: var(--surface);
	padding: 5px 10px;
	border-radius: 18px;
	border: 1px solid var(--border);
}

.sms-phone__send-btn {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--accent);
	border: none;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	flex-shrink: 0;
	cursor: default;
	padding: 0;
	margin: 0;
}

.sms-phone__home {
	background: var(--surface-2);
	padding: 8px 0 6px;
	display: flex;
	justify-content: center;
}

.sms-phone__home::after {
	content: '';
	width: 70px;
	height: 4px;
	background: color-mix(in srgb, var(--text) 25%, transparent);
	border-radius: 2px;
}

.radio-option {
	display: grid;
	grid-template-columns: 16px 1fr;
	align-items: start;
	gap: var(--sp-3);
	padding: var(--sp-3) var(--sp-4);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	cursor: pointer;
	transition: border-color 0.15s, background 0.15s;
	margin: 0;
}

.radio-option:hover {
	border-color: var(--accent);
	background: var(--surface-2);
}

.radio-option input[type="radio"],
.radio-option input[type="checkbox"] {
	margin-top: 2px;
	accent-color: var(--accent);
}

.radio-option:has(input:checked) {
	border-color: var(--accent);
	background: var(--accent-muted);
}

.radio-option__content {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.radio-option__content strong {
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--text);
}

.radio-option__content small {
	font-size: 0.75rem;
	color: var(--text-muted);
	font-weight: 400;
	line-height: 1.4;
}

.label--inline {
	flex-direction: row;
	align-items: center;
	gap: var(--sp-2);
	cursor: pointer;
	font-weight: 400;
}

.label--inline input[type="checkbox"] {
	flex-shrink: 0;
}

.time-range {
	display: flex;
	gap: var(--sp-3);
}

.time-range>label {
	flex: 1;
	min-width: 0;
}

#sms-scheduled-group {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

/* ── Template Preview (email) ─────────────────────────────── */

.template-preview {
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
	background: var(--surface);
}

.wizard-card .template-preview {
	border: 0;
	border-radius: 0;
}

.template-preview__header {
	padding: 12px 16px;
	background: var(--surface-2);
	border-bottom: 1px solid var(--border);
	font-weight: 600;
	font-size: 0.875rem;
}

.template-preview__subject {
	padding: 10px 14px;
	font-size: 0.8125rem;
	border-bottom: 1px solid var(--border);
	background: var(--surface-2);
}

.template-preview__vars {
	padding: 8px 14px;
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	border-bottom: 1px solid var(--border);
}

.template-preview__frame {
	width: 100%;
	min-height: 300px;
	border: 0;
	background: #fff;
	display: block;
}

.template-preview__empty {
	padding: 3rem 1.5rem;
	text-align: center;
	color: var(--text-muted);
	font-size: 0.8125rem;
}

.variable-pill {
	display: inline-block;
	padding: 2px 8px;
	background: var(--accent-muted);
	color: var(--accent);
	border-radius: var(--radius);
	font-family: var(--font-mono);
	font-size: 0.6875rem;
}

.variable-mapping-list.grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--sp-3);
}

.variable-mapping-row {
	display: flex !important;
	flex-direction: row !important;
	align-items: center;
	gap: var(--sp-3);
	margin-bottom: 0;
	padding: 8px 12px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
}

.variable-mapping-row__var {
	font-family: var(--font-mono);
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--accent);
	white-space: nowrap;
	background: var(--accent-muted);
	padding: 4px 10px;
	border-radius: var(--radius);
}

.variable-mapping-row__arrow {
	color: var(--text-muted);
	font-size: 1rem;
	flex-shrink: 0;
}

.variable-mapping-row__select {
	flex: 1;
	margin: 0;
}

@media (max-width: 768px) {
	.variable-mapping-list.grid {
		grid-template-columns: 1fr;
	}
}

/* ── Campaign Preview Card ────────────────────────────────── */

.preview-card {
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
	background: var(--surface);
}

.preview-card__subject {
	padding: 10px 14px;
	font-size: 0.8125rem;
	border-bottom: 1px solid var(--border);
	background: var(--surface-2);
}

.preview-card__frame {
	width: 100%;
	min-height: 400px;
	border: 0;
	background: #fff;
	display: block;
}

.preview-card__empty {
	padding: 3rem 1.5rem;
	text-align: center;
	color: var(--text-muted);
	font-size: 0.8125rem;
}

/* ── WhatsApp Bubble Preview ──────────────────────────────── */

.wa-bubble {
	max-width: 360px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	border-left: 4px solid #25d366;
	padding: 12px;
	margin: 1rem auto;
}

.wa-bubble__header {
	font-weight: 600;
	font-size: 0.875rem;
	margin-bottom: 8px;
}

.wa-bubble__body {
	font-size: 0.8125rem;
	line-height: 1.5;
	white-space: pre-wrap;
}

.wa-bubble__footer {
	font-size: 0.75rem;
	color: var(--text-muted);
	margin-top: 8px;
}

.wa-bubble__buttons {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-top: 8px;
	border-top: 1px solid var(--border);
	padding-top: 8px;
}

.wa-bubble__btn {
	text-align: center;
	padding: 8px;
	font-size: 0.8125rem;
	color: #0095f6;
	font-weight: 500;
	border: 1px solid var(--border);
	border-radius: var(--radius);
}

.wa-bubble__var {
	background: color-mix(in srgb, var(--accent) 15%, transparent);
	border-radius: 4px;
	padding: 0 4px;
	font-weight: 600;
	color: var(--accent);
}

/* ── Quick Test (WhatsApp test message) ───────────────────── */

.quick-test {
	max-width: 560px;
	margin: 0 auto;
}

.quick-test__config {
	display: flex;
	gap: 1rem;
	border-bottom: 1px solid var(--border);
}

.quick-test__config .quick-test__field {
	flex: 1;
}

.quick-test__tabs {
	display: flex;
	gap: 0;
	background: var(--surface-2);
	border-bottom: 1px solid var(--border);
}

.quick-test__tab {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 12px 16px;
	color: var(--text-muted);
	font-size: 0.8125rem;
	font-weight: 500;
	cursor: pointer;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
	transition: color 150ms, border-color 150ms;
}

.quick-test__tab:hover {
	color: var(--text);
}

.quick-test__tab--active {
	color: var(--accent);
	border-bottom-color: var(--accent);
}

.quick-test__tab svg {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

.quick-test__result {
	padding: 10px 14px;
	border-radius: var(--radius);
	font-size: 0.8125rem;
	font-weight: 500;
	margin-bottom: 1rem;
}

.quick-test__result--success {
	background: var(--success-bg);
	color: var(--success);
	border: 1px solid var(--success-border);
}

.quick-test__result--error {
	background: var(--error-bg);
	color: var(--error);
	border: 1px solid var(--error-border);
}

.quick-test__form {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.quick-test__field {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-bottom: 1rem;
}

.quick-test__field label {
	font-size: 0.8125rem;
	font-weight: 500;
	margin-bottom: 0;
}

.quick-test__field small {
	font-size: 0.6875rem;
	color: var(--text-muted);
	margin-top: -2px;
}

.quick-test__field input,
.quick-test__field select,
.quick-test__field textarea {
	margin-bottom: 0;
}

.quick-test__textarea {
	min-height: 100px;
	resize: vertical;
}

.quick-test__actions {
	display: flex;
	justify-content: flex-end;
	padding-top: 4px;
}

.quick-test__actions button {
	width: auto;
	margin: 0;
	display: flex;
	align-items: center;
	gap: 6px;
}

.quick-test__tip {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin-top: 1rem;
	padding: 12px 16px;
	border-radius: var(--radius);
	background: var(--surface-2);
	border: 1px solid var(--border);
	color: var(--text-muted);
	font-size: 0.8125rem;
	line-height: 1.5;
}

.quick-test__tip svg {
	flex-shrink: 0;
	margin-top: 1px;
}

.quick-test__preview {
	background: var(--surface-2);
	padding: 12px 16px;
	border-radius: var(--radius);
	font-size: 0.8125rem;
	margin-bottom: 1rem;
	white-space: pre-wrap;
	color: var(--text-muted);
	line-height: 1.5;
	border-left: 3px solid var(--accent);
}

/* ── WhatsApp Conversations ───────────────────────────────── */

.conv-detail-row td {
	padding: 0 !important;
}

.conv-log {
	display: flex;
	flex-direction: column;
	gap: 3px;
	padding: 12px 16px;
	background-color: #efeae2;
}

[data-theme="dark"] .conv-log {
	background-color: #0b141a;
}

.chat-msg {
	max-width: 70%;
	padding: 6px 10px 8px;
	border-radius: 8px;
	font-size: 0.8125rem;
	line-height: 1.4;
	word-break: break-word;
	position: relative;
	box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.1);
}

.chat-msg p {
	margin: 0;
}

.chat-msg--received {
	align-self: flex-start;
	background: #fff;
	color: #303030;
	border-top-left-radius: 0;
}

[data-theme="dark"] .chat-msg--received {
	background: #1f2c34;
	color: #e9edef;
}

.chat-msg--sent {
	align-self: flex-end;
	background: #d9fdd3;
	color: #303030;
	border-top-right-radius: 0;
}

[data-theme="dark"] .chat-msg--sent {
	background: #005c4b;
	color: #e9edef;
}

.chat-msg__meta {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 3px;
	font-size: 0.6875rem;
	margin-top: 2px;
	opacity: 0.55;
	color: #667781;
	white-space: nowrap;
}

.chat-msg__status {
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: -2px;
}

.chat-msg__status--sent,
.chat-msg__status--delivered {
	color: #667781;
}

.chat-msg__status--read {
	color: #53bdeb;
}

.chat-msg__status--failed {
	color: #e53935;
	letter-spacing: 0;
}

.chat-msg--failed {
	opacity: 0.85;
	border: 1px solid #e53935;
}

.chat-msg__error {
	font-size: 0.6875rem;
	color: #e53935;
	margin-top: 4px;
	background: rgba(229, 57, 53, 0.08);
	padding: 3px 6px;
	border-radius: 4px;
}

.chat-msg__media {
	margin-bottom: 4px;
}

.chat-msg__media-placeholder {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	border-radius: 6px;
	font-size: 0.8125rem;
}

.chat-msg__media-placeholder--image {
	background: rgba(76, 175, 80, 0.12);
}

.chat-msg__media-placeholder--video {
	background: rgba(33, 150, 243, 0.12);
}

.chat-msg__media-placeholder--audio {
	background: rgba(156, 39, 176, 0.12);
}

.chat-msg__media-placeholder--doc {
	background: rgba(255, 152, 0, 0.12);
}

/* ── Tab Bar ──────────────────────────────────────────────── */

.tab-bar {
	display: flex;
	gap: 0;
	border-bottom: 2px solid var(--border);
}

.tab-bar__tab {
	padding: 8px 20px;
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--text-muted);
	text-decoration: none;
	border-bottom: 2px solid transparent;
	margin-bottom: -2px;
	transition: color 0.15s, border-color 0.15s;
}

.tab-bar__tab:hover {
	color: var(--text);
}

.tab-bar__tab--active {
	color: var(--accent);
	border-bottom-color: var(--accent);
}

/* ── Text Utilities ───────────────────────────────────────── */

.text--success {
	color: var(--success);
}

.text--danger {
	color: var(--error);
}

/* ── HTMX Loading State ───────────────────────────────────── */

.htmx-request .spinner {
	display: inline-block;
}

.htmx-request [data-loading-text] {
	display: none;
}

/* ── Mobile Responsive ────────────────────────────────────── */

@media (max-width: 768px) {
	.console-shell {
		flex-direction: column;
		height: auto;
		overflow: visible;
	}

	.console-shell>main {
		overflow: visible;
	}

	.console-shell>main>.content-body {
		overflow-y: visible;
	}

	.sidebar {
		position: fixed;
		top: 0;
		left: 0;
		height: 100vh;
		width: 280px;
		transform: translateX(-100%);
		transition: transform 200ms ease;
		z-index: var(--z-sidebar);
	}

	.sidebar.nav--open {
		transform: translateX(0);
	}

	.sidebar__body {
		flex-direction: column;
	}

	.sidebar__body .service-rail {
		display: none;
	}

	.sidebar .nav__rail-mobile {
		display: flex;
		gap: 4px;
		padding: 8px 12px;
		border-bottom: 1px solid var(--border);
		overflow-x: auto;
	}

	.sidebar .nav__rail-mobile .service-rail__item {
		width: 36px;
		height: 36px;
		border-left: none;
		border-bottom: 2px solid transparent;
	}

	.sidebar .nav__rail-mobile .service-rail__item--active {
		border-bottom-color: var(--service-color, var(--accent));
	}

	.sidebar .nav__rail-mobile .service-rail__tooltip {
		display: none !important;
	}

	.content-body {
		padding: 1rem;
	}

	.content-header__inner {
		padding: 0.5rem 1rem;
	}

	.wizard-progress {
		flex-wrap: wrap;
		justify-content: center;
	}

	.wizard-progress__step {
		padding: 8px 12px;
		font-size: 0.75rem;
	}

	.wizard-progress__label {
		display: none;
	}

	.wizard-progress__number,
	.wizard-progress__check {
		width: 28px;
		height: 28px;
	}

	.wizard-layout {
		grid-template-columns: 1fr;
	}

	.wizard-layout__preview {
		position: static;
	}

	.filter-bar {
		flex-direction: column;
	}

	.filter-bar select,
	.filter-bar input[type="date"],
	.filter-bar input[type="text"],
	.filter-bar__field {
		width: 100%;
	}

	.filter-bar--collapsible {
		display: none;
	}

	.filter-bar--collapsible.filter-bar--open {
		display: flex;
	}

	.filter-bar__mobile-toggle {
		display: flex;
		align-items: center;
		gap: 6px;
		font-size: 0.8125rem;
		font-weight: 500;
		color: var(--accent);
		cursor: pointer;
		margin-bottom: 0.75rem;
	}

	.filter-bar__mobile-toggle svg {
		width: 16px;
		height: 16px;
		stroke: var(--accent);
	}

	.dash-stats-row {
		grid-template-columns: repeat(4, 1fr);
	}

	.dash-charts {
		grid-template-columns: 1fr;
	}

	.dash-charts article {
		overflow: hidden;
		min-width: 0;
	}

	.dash-activity header {
		flex-direction: column;
		align-items: flex-start;
	}

	.dash-panels {
		grid-template-columns: 1fr;
	}

	.quick-test__config {
		flex-direction: column;
		gap: 0;
	}

	.quick-test__tab {
		padding: 10px 12px;
		font-size: 0.75rem;
	}

	.chat-msg {
		max-width: 85%;
	}
}

@media (min-width: 769px) {
	.filter-bar__mobile-toggle {
		display: none;
	}
}

.template-id {
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 0.75rem;
	padding: 2px 6px;
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: 4px;
	cursor: pointer;
	user-select: all;
	transition: background 0.15s, border-color 0.15s;
}

.template-id:hover {
	background: var(--surface);
	border-color: var(--accent);
}

.template-id--copied {
	background: rgba(16, 185, 129, 0.15);
	border-color: #10b981;
	color: #6ee7b7;
}

/* ── SMS wizard — audience preview ── */
.audience-preview {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.table-responsive {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.audience-preview__meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	font-size: 0.8125rem;
	color: var(--text-muted);
	margin-top: 10px;
}

.audience-preview__meta-left {
	display: flex;
	align-items: center;
	gap: 8px;
}

.column-picker {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding-top: 4px;
}

.column-picker__row {
	display: flex;
	gap: 8px;
	align-items: center;
}

.column-picker__row .select {
	flex: 1;
	min-width: 0;
}

.wrong-col-samples {
	margin-top: 8px;
}

.wrong-col-samples__label {
	font-size: 0.75rem;
	color: inherit;
	display: block;
	margin-bottom: 4px;
}

.wrong-col-samples__col {
	font-size: 0.75rem;
	background: rgba(0, 0, 0, .15);
	padding: 1px 4px;
	border-radius: 3px;
}

.wrong-col-samples__list {
	margin: 0;
	padding-left: 0;
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

.wrong-col-samples__list li code {
	font-size: 0.75rem;
	background: rgba(0, 0, 0, .15);
	padding: 2px 6px;
	border-radius: 3px;
}

/* ── SMS Log drawer ── */
dialog#form-dialog.sms-log-dialog {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: auto;
	width: 480px;
	max-width: 92vw;
	height: 100%;
	max-height: 100%;
	margin: 0;
	padding: 0;
	border: none;
	border-left: 1px solid var(--border);
	border-radius: 0;
	overflow-y: auto;
	animation: sms-drawer-in .28s cubic-bezier(.25, .46, .45, .94);
}

dialog#form-dialog.sms-log-dialog::backdrop {
	background: rgba(0, 0, 0, .45);
}

@keyframes sms-drawer-in {
	from {
		transform: translateX(100%);
	}

	to {
		transform: translateX(0);
	}
}

.sms-log-drawer {
	display: flex;
	flex-direction: column;
	min-height: 100%;
}

.sms-log-drawer__header {
	position: sticky;
	top: 0;
	z-index: 1;
	background: var(--surface);
	border-bottom: 1px solid var(--border);
}

.sms-log-drawer__body {
	padding: var(--sp-4) var(--sp-5);
	display: flex;
	flex-direction: column;
	gap: var(--sp-5);
	flex: 1;
}

.sms-log-section-label {
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: .05em;
	margin: 0 0 var(--sp-2);
}

.sms-log-body-text {
	background: var(--surface-raised);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: var(--sp-3) var(--sp-4);
	font-size: 0.875rem;
	line-height: 1.5;
}

.sms-log-timeline {
	display: flex;
	flex-direction: column;
	gap: var(--sp-3);
}

.sms-log-timeline__item {
	display: flex;
	gap: var(--sp-3);
	align-items: center;
}

.sms-log-timeline__badge {
	font-size: 0.65rem;
	padding: 2px 8px;
	min-width: 76px;
	text-align: center;
}

.sms-log-timeline__note {
	margin: 0;
	font-size: 0.8125rem;
}

.sms-log-timeline__time {
	margin: 0;
	font-size: 0.75rem;
	color: var(--text-muted);
}

/* SMS Log table */
.sms-log-table {
	cursor: pointer;
}

.sms-log-table td.col-date {
	color: var(--text-muted);
	white-space: nowrap;
}

.sms-log-table td.col-from {
	color: var(--text-muted);
}

.sms-log-table td.col-body {
	color: var(--text-muted);
	max-width: 260px;
}

.sms-log-table td.col-segs {
	color: var(--text-muted);
	text-align: center;
}

.sms-log-table td.col-campaign {
	color: var(--text-muted);
}