/* ── Campaign Funnel-Tag Mapping ─────────────────────────────────── */
/* Same palette as the library and podcast search tools; own file so the
 * tools can't break each other. */

:root {
	--linen: #f4f0e3;
	--linen-dark: #e8e2d0;
	--sage: #9aa583;
	--sage-dark: #7d8c6e;
	--forest: #3d5b47;
	--forest-dark: #2c3e33;
	--desert: #c8856a;
	--stone: #6b7d8a;
	--ink: #263029;
	--alarm: #b3402f;
}

body {
	background: var(--linen);
	color: var(--ink);
	font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, sans-serif;
	margin: 0;
}

h1, h2, h3, h4 {
	font-family: 'Libre Baskerville', Georgia, serif;
}

.btn-forest {
	background: var(--forest);
	border-color: var(--forest);
	color: var(--linen);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.btn-forest:hover { background: var(--forest-dark); border-color: var(--forest-dark); color: #fff; }

.btn-outline-forest {
	border-color: var(--forest);
	color: var(--forest);
}
.btn-outline-forest:hover { background: var(--forest); color: var(--linen); }
.btn-outline-forest:disabled { opacity: .4; }

/* ── Boot + auth ─────────────────────────────────────────────────── */

.cm-boot {
	min-height: 60vh;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cm-auth {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.cm-auth-card {
	background: #fff;
	border: 1px solid var(--linen-dark);
	border-radius: 12px;
	padding: 40px 32px;
	max-width: 420px;
	width: 100%;
	text-align: center;
	box-shadow: 0 2px 16px rgba(38, 48, 41, .06);
}

.cm-auth-logo { height: 40px; margin-bottom: 20px; }
.cm-auth-card h2 { font-size: 1.4rem; margin-bottom: 10px; }
.cm-auth-note { font-size: .8rem; color: var(--stone); margin: 12px 0 0; }
.cm-auth-error { font-size: .85rem; color: var(--alarm); margin: 16px 0 0; }

/* ── Toolbar ─────────────────────────────────────────────────────── */

.cm-toolbar {
	background: #fff;
	border-bottom: 1px solid var(--linen-dark);
	position: sticky;
	top: 56px;
	z-index: 1000;
}

.cm-toolbar-inner {
	max-width: 1500px;
	margin: 0 auto;
	padding: 12px 24px;
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.cm-input-wrap {
	position: relative;
	flex: 1 1 320px;
	min-width: 240px;
}

.cm-input-wrap i {
	position: absolute;
	left: 12px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--stone);
	pointer-events: none;
}

.cm-input-wrap .form-control {
	padding-left: 36px;
	border-color: var(--linen-dark);
}

.cm-mini {
	width: auto;
	font-size: .875rem;
	border-color: var(--linen-dark);
}

.cm-check { margin: 0; font-size: .875rem; white-space: nowrap; }
.cm-check .form-check-input:checked { background-color: var(--forest); border-color: var(--forest); }

.cm-spacer { flex: 1; }

.cm-doclink {
	color: var(--forest);
	font-size: .85rem;
	text-decoration: none;
	white-space: nowrap;
}
.cm-doclink:hover { text-decoration: underline; }

/* ── Main ────────────────────────────────────────────────────────── */

.cm-main {
	max-width: 1500px;
	margin: 0 auto;
	padding: 20px 24px 60px;
}

.cm-summary {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 12px;
}

.cm-stat {
	background: #fff;
	border: 1px solid var(--linen-dark);
	border-radius: 10px;
	padding: 10px 16px;
	min-width: 150px;
}

.cm-stat.alarm { border-color: rgba(179, 64, 47, .35); background: #fdf4f2; }

.cm-stat-value { font-size: 1.25rem; font-weight: 700; line-height: 1.2; }
.cm-stat.alarm .cm-stat-value { color: var(--alarm); }
.cm-stat-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--stone); }

.cm-status {
	font-size: .875rem;
	color: var(--stone);
	min-height: 22px;
	margin-bottom: 8px;
}
.cm-status.error { color: var(--alarm); }

.cm-table-wrap {
	background: #fff;
	border: 1px solid var(--linen-dark);
	border-radius: 12px;
	overflow-x: auto;
}

.cm-table { margin: 0; font-size: .875rem; }

.cm-table > thead > tr > th {
	background: var(--linen);
	border-bottom: 1px solid var(--linen-dark);
	font-size: .72rem;
	text-transform: uppercase;
	letter-spacing: .05em;
	color: var(--stone);
	font-weight: 700;
	white-space: nowrap;
	padding: 10px 12px;
}

/* Sortable headers: neutral ↕ hint, forest arrow once a sort is applied. */
.cm-table > thead > tr > th[data-sort] {
	cursor: pointer;
	user-select: none;
}
.cm-table > thead > tr > th[data-sort]:hover { color: var(--forest); }
.cm-table > thead > tr > th[data-sort]::after {
	content: '↕';
	margin-left: 5px;
	opacity: .35;
}
.cm-table > thead > tr > th[data-sort][aria-sort="ascending"]::after {
	content: '↑';
	opacity: 1;
	color: var(--forest);
}
.cm-table > thead > tr > th[data-sort][aria-sort="descending"]::after {
	content: '↓';
	opacity: 1;
	color: var(--forest);
}

.cm-table > tbody > tr > td {
	padding: 10px 12px;
	border-bottom: 1px solid #f1eee4;
	vertical-align: middle;
}

.cm-table > tbody > tr.cm-attention > td { background: #fdf7f5; }
.cm-table > tbody > tr.cm-saved > td { background: #f2f6f1; transition: background .6s ease; }

.cm-col-campaign { min-width: 300px; }
.cm-col-mapping { width: 120px; }
.cm-col-spend { width: 110px; }
.cm-col-active { width: 150px; }
.cm-col-status { width: 90px; }
.cm-col-tag { width: 210px; }
.cm-col-type { width: 130px; }
.cm-col-notes { min-width: 200px; }
.cm-col-save { width: 130px; }

.cm-name { font-weight: 600; }
.cm-meta { font-size: .75rem; color: var(--stone); margin-top: 2px; word-break: break-all; }
.cm-meta code { color: var(--stone); }
.cm-shared { color: var(--desert); }

.cm-spend { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.cm-dates { font-size: .78rem; color: var(--stone); white-space: nowrap; }

.cm-badge {
	display: inline-block;
	font-size: .68rem;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
	padding: 2px 7px;
	border-radius: 4px;
	max-width: 110px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.cm-badge-unmapped { background: var(--alarm); color: #fff; }
.cm-badge-untagged { background: var(--desert); color: #fff; }
.cm-badge-mapped { background: var(--sage); color: var(--forest-dark); }

.cm-status-pill {
	font-size: .72rem;
	color: var(--stone);
	border: 1px solid var(--linen-dark);
	border-radius: 10px;
	padding: 1px 8px;
	white-space: nowrap;
}
.cm-status-pill.active { color: var(--forest); border-color: var(--sage); }

.cm-table select.form-select,
.cm-table input.form-control {
	font-size: .82rem;
	padding: 4px 8px;
	border-color: var(--linen-dark);
}

.cm-new-tag { margin-top: 6px; text-transform: uppercase; }

.cm-save-note {
	display: block;
	font-size: .72rem;
	color: var(--stone);
	margin-top: 4px;
}
.cm-save-note.ok { color: var(--forest); }
.cm-save-note.error { color: var(--alarm); }

.cm-empty { padding: 32px; text-align: center; color: var(--stone); }

.cm-footnote {
	font-size: .8rem;
	color: var(--stone);
	margin: 14px 2px 0;
}
.cm-footnote code { color: var(--forest); }
