/* ClickSend SMS — customer portal (front-end)
 * Aesthetic: warm editorial fintech. Fraunces display serif over Outfit body,
 * ink + vermillion with a paper-grain backdrop, layered depth, and a
 * staggered page-load reveal. Namespaced under .csbs-fe to avoid theme bleed.
 */

.csbs-fe {
	--ink: #16181d;
	--ink-soft: #353a44;
	--paper: #f7f4ee;
	--paper-2: #fffdf9;
	--card: #ffffff;
	--line: #e7e3da;
	--line-strong: #d2cdc1;
	--accent: #df5128;
	--accent-deep: #b53d18;
	--accent-soft: #fbeee8;
	--gold: #c79a3a;
	--ok: #1e7a4d;
	--ok-bg: #e4f3ea;
	--warn: #8a5d00;
	--warn-bg: #fbf0d2;
	--danger: #b3261e;
	--danger-bg: #fbe4e2;
	--muted: #847f72;
	--radius: 12px;
	--radius-sm: 8px;
	--shadow-sm: 0 1px 2px rgba(22,24,29,.05), 0 2px 8px -4px rgba(22,24,29,.10);
	--shadow: 0 2px 4px rgba(22,24,29,.04), 0 14px 40px -18px rgba(22,24,29,.22);
	--shadow-lg: 0 30px 70px -28px rgba(22,24,29,.4);

	font-family: 'Outfit', ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
	color: var(--ink);
	width: 100%;
	max-width: 1100px;
	margin: 0 auto;
	font-size: 16.5px;
	line-height: 1.6;
	box-sizing: border-box;
	-webkit-font-smoothing: antialiased;
}
.csbs-fe *, .csbs-fe *::before, .csbs-fe *::after { box-sizing: border-box; }

/* Display type */
.csbs-fe h2, .csbs-fe-h3, .csbs-fe-balance-big, .csbs-fe-stat-value, .csbs-fe-bundle-price {
	font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
	font-optical-sizing: auto;
}

/* Brand / logo */
.csbs-fe-logo-img { display: block; }
.csbs-fe-logo-icon { height: 40px; width: auto; }
.csbs-fe-brand-auth { justify-content: center; margin-bottom: 6px; }
.csbs-fe-brand-auth .csbs-fe-logo-img { height: 84px; width: auto; }
.csbs-fe-brand { display: flex; align-items: center; gap: 13px; }
.csbs-fe-logo {
	display: grid; place-items: center; width: 42px; height: 42px;
	background: linear-gradient(140deg, var(--accent), var(--accent-deep));
	color: #fff; border-radius: 11px; font-size: 18px;
	box-shadow: 0 6px 16px -6px rgba(223,81,40,.6); flex: none;
}
.csbs-fe-brand h2 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }

/* ── Auth (login / register) ───────────────────────────────────────── */
.csbs-fe-authcard {
	max-width: 460px; margin: 40px auto;
	position: relative;
	animation: csbs-rise .5s cubic-bezier(.2,.7,.3,1) both;
}
.csbs-fe-card {
	background: var(--card); border: 1px solid var(--line);
	border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow);
	position: relative; overflow: hidden;
}
.csbs-fe-card::before {
	content: ''; position: absolute; inset: 0 0 auto 0; height: 4px;
	background: linear-gradient(90deg, var(--accent), var(--gold));
}
.csbs-fe-authtabs { display: flex; gap: 4px; margin: 22px 0 18px; border-bottom: 1px solid var(--line); }
.csbs-fe-authtab {
	flex: 1; background: none; border: none; border-bottom: 2px solid transparent;
	padding: 11px; font-size: 14px; font-weight: 600; color: var(--muted);
	cursor: pointer; font-family: inherit; transition: color .18s, border-color .18s;
}
.csbs-fe-authtab.is-active { color: var(--ink); border-bottom-color: var(--accent); }
.csbs-fe-authtab:hover { color: var(--ink); }
.csbs-fe-authpanel { display: none; animation: csbs-fade .3s ease both; }
.csbs-fe-authpanel.is-active { display: block; }

.csbs-fe-label {
	display: block; font-size: 11px; font-weight: 600; text-transform: uppercase;
	letter-spacing: .06em; color: var(--muted); margin: 15px 0 6px;
}
.csbs-fe-input {
	width: 100%; padding: 12px 14px; border: 1px solid var(--line-strong);
	border-radius: var(--radius-sm); font-size: 15px; font-family: inherit; color: var(--ink);
	background: var(--paper-2); transition: border-color .18s, box-shadow .18s, background .18s;
}
.csbs-fe-input:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px rgba(223,81,40,.13); }
.csbs-fe-input::placeholder { color: #b3ad9f; }

.csbs-fe-btn {
	appearance: none; font-family: inherit; font-size: 15px; font-weight: 600;
	padding: 12px 20px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
	background: #fff; color: var(--ink); cursor: pointer;
	transition: background .18s, border-color .18s, transform .08s, box-shadow .18s;
}
.csbs-fe-btn:hover { background: var(--paper); border-color: var(--muted); }
.csbs-fe-btn:active { transform: translateY(1px); }
.csbs-fe-btn:disabled { opacity: .5; cursor: not-allowed; }
.csbs-fe-btn-primary {
	background: linear-gradient(140deg, var(--accent), var(--accent-deep));
	border-color: var(--accent-deep); color: #fff; width: 100%; margin-top: 20px;
	box-shadow: 0 8px 20px -10px rgba(223,81,40,.7);
}
.csbs-fe-btn-primary:hover { filter: brightness(1.05); box-shadow: 0 10px 26px -10px rgba(223,81,40,.8); }
.csbs-fe-btn-sm { padding: 8px 13px; font-size: 13px; width: auto; margin: 0; }
.csbs-fe-btn-danger { color: var(--danger); border-color: #e7c3c0; background: #fff; }
.csbs-fe-btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }

.csbs-fe-msg { margin-top: 16px; padding: 12px 15px; border-radius: var(--radius-sm); font-size: 14px; }
.csbs-fe-msg.err { background: var(--danger-bg); color: var(--danger); }
.csbs-fe-msg.ok { background: var(--ok-bg); color: var(--ok); }
.csbs-fe-note { padding: 18px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.csbs-fe-link {
	display: inline-block; margin-top: 14px; background: none; border: none; padding: 4px 0;
	font-family: inherit; font-size: 14px; font-weight: 600; color: var(--accent-deep);
	cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.csbs-fe-link:hover { color: var(--accent); }

/* ── App shell ─────────────────────────────────────────────────────── */
#csbs-fe-app {
	background:
		radial-gradient(1200px 400px at 100% -10%, rgba(223,81,40,.06), transparent 60%),
		radial-gradient(900px 360px at -10% 110%, rgba(199,154,58,.07), transparent 60%),
		var(--paper);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	overflow: hidden;
	box-shadow: var(--shadow);
	animation: csbs-rise .5s cubic-bezier(.2,.7,.3,1) both;
}
.csbs-fe-top {
	display: flex; align-items: center; justify-content: space-between;
	padding: 20px 26px;
	background: linear-gradient(135deg, #1b1e25, #14161b);
	position: relative;
}
.csbs-fe-top::after {
	content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
	background: linear-gradient(90deg, transparent, rgba(223,81,40,.6), transparent);
}
.csbs-fe-top .csbs-fe-brand h2 { color: #f7f3ec; }
.csbs-fe-topright { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.csbs-fe-pill {
	background: rgba(255,255,255,.08); color: #f3efe7; padding: 7px 14px; border-radius: 999px;
	font-size: 13px; font-weight: 600; border: 1px solid rgba(255,255,255,.10);
	transition: background .2s;
}
.csbs-fe-pill.low { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.csbs-fe-pill.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.csbs-fe-plan { color: #aca695; font-size: 13px; }
.csbs-fe-logout { color: #d6d0c4; font-size: 13px; text-decoration: none; border-bottom: 1px dotted #5b6068; transition: color .18s; }
.csbs-fe-logout:hover { color: #fff; }

.csbs-fe-banner {
	background: linear-gradient(0deg, var(--warn-bg), var(--warn-bg));
	color: var(--warn); padding: 13px 26px; font-size: 14px; font-weight: 600;
	border-bottom: 1px solid #ecd9bd;
}

/* Body split: sidebar + content */
.csbs-fe-body { display: flex; align-items: stretch; min-height: 420px; }
.csbs-fe-sidebar {
	flex: none; width: 232px; background: var(--paper-2);
	border-right: 1px solid var(--line); padding: 18px 14px;
	display: flex; flex-direction: column;
}
.csbs-fe-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.csbs-fe-nav-bottom { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.csbs-fe-account-btn { align-items: center; }
.csbs-fe-avatar {
	display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none;
	border-radius: 50%; background: linear-gradient(140deg, var(--accent), var(--accent-deep));
	color: #fff; font-weight: 700; font-size: 14px; text-transform: uppercase;
}
.csbs-fe-account-btn.is-active .csbs-fe-avatar { background: #fff; color: var(--accent-deep); }
.csbs-fe-account-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.csbs-fe-account-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.csbs-fe-account-sub { font-size: 11.5px; font-weight: 500; opacity: .7; }
.csbs-fe-navitem {
	display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
	background: none; border: none; border-radius: var(--radius-sm);
	padding: 11px 13px; font-size: 14px; font-weight: 600; font-family: inherit;
	color: var(--ink-soft); cursor: pointer; transition: background .15s, color .15s;
}
.csbs-fe-navitem:hover { background: rgba(223,81,40,.07); color: var(--ink); }
.csbs-fe-navitem.is-active { background: linear-gradient(120deg, var(--accent), var(--accent-deep)); color: #fff; box-shadow: 0 6px 16px -8px rgba(223,81,40,.7); }
.csbs-fe-navitem.is-active .csbs-fe-ico { opacity: 1; }
.csbs-fe-ico { display: inline-grid; place-items: center; width: 20px; font-size: 14px; opacity: .65; }
.csbs-fe-nav-sep { height: 1px; background: var(--line); margin: 10px 6px; }

.csbs-fe-content { flex: 1; min-width: 0; }
.csbs-fe-panels { padding: 26px; }
.csbs-fe-panels > * { animation: csbs-fade .35s ease both; }

.csbs-fe-burger { display: none; background: none; border: none; color: #f3efe7; font-size: 20px; cursor: pointer; padding: 0 4px 0 0; margin-right: 2px; }

@media (max-width: 760px) {
	.csbs-fe-burger { display: inline-block; }
	.csbs-fe-body { display: block; position: relative; }
	.csbs-fe-sidebar {
		position: absolute; z-index: 30; top: 0; bottom: 0; left: 0; width: 220px;
		transform: translateX(-105%); transition: transform .25s ease; box-shadow: var(--shadow-lg);
	}
	.csbs-fe-sidebar.open { transform: none; }
}

.csbs-fe-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.08fr); gap: 22px; align-items: start; }
@media (max-width: 880px) { .csbs-fe-grid { grid-template-columns: 1fr; } }

.csbs-fe-h3 { font-size: 18px; margin: 0 0 15px; font-weight: 600; letter-spacing: -.01em; }
.csbs-fe-help { font-size: 13px; color: var(--muted); margin: 0 0 12px; line-height: 1.6; }

.csbs-fe-cardpad {
	background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
	padding: 24px; box-shadow: var(--shadow-sm);
}

/* Audience / compose */
.csbs-fe-audience { display: flex; flex-direction: column; gap: 9px; margin-bottom: 13px; }
.csbs-fe-audience label { font-size: 14px; display: flex; align-items: center; gap: 9px; cursor: pointer; }
.csbs-fe-audience input[type=radio] { accent-color: var(--accent); }
.csbs-fe-recipients {
	font-size: 13px; font-weight: 600; color: var(--accent-deep);
	background: var(--accent-soft); border: 1px solid #f0d2c6; padding: 9px 13px; border-radius: var(--radius-sm); margin: 6px 0;
}
.csbs-fe-cost {
	border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper);
	padding: 13px 15px; margin: 6px 0; font-size: 13px;
}
.csbs-fe-cost-row { display: flex; justify-content: space-between; padding: 4px 0; color: var(--ink-soft); }
.csbs-fe-cost-row.total { border-top: 1px dashed var(--line-strong); margin-top: 5px; padding-top: 9px; font-size: 15px; font-weight: 600; }
.csbs-fe-cost-row.total strong { color: var(--accent-deep); font-family: 'Fraunces', serif; }
.csbs-fe-short {
	margin-top: 11px; padding: 12px 14px; border-radius: var(--radius-sm);
	background: var(--warn-bg); border: 1px solid #ecd9bd; color: #6b4e00; font-weight: 600; font-size: 13px;
}
.csbs-fe-meta { font-size: 12px; color: var(--muted); margin-top: 6px; }
.csbs-fe-check { display: flex; align-items: center; gap: 9px; font-size: 14px; margin: 15px 0 8px; cursor: pointer; }
.csbs-fe-check input { accent-color: var(--accent); }

/* Tables */
.csbs-fe-tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 1px 2px rgba(22,24,29,.04), 0 8px 24px -18px rgba(22,24,29,.16); }
.csbs-fe-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.csbs-fe-table th {
	text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
	color: var(--muted); background: var(--paper-2); padding: 13px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; font-weight: 700;
}
.csbs-fe-table td { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.csbs-fe-table tbody tr:nth-child(even) { background: rgba(22,24,29,.015); }
.csbs-fe-table tr:last-child td { border-bottom: none; }
.csbs-fe-table tbody tr { transition: background .12s; }
.csbs-fe-table tbody tr:hover { background: var(--accent-soft); }
.csbs-fe-empty { text-align: center; color: var(--muted); padding: 48px 16px; font-size: 14.5px; }

.csbs-fe-tag { display: inline-block; font-size: 11px; background: #efeadd; color: var(--ink-soft); padding: 3px 9px; border-radius: 999px; margin: 1px 3px 1px 0; }
.csbs-fe-grouptag { display: inline-block; font-size: 11px; font-weight: 600; background: var(--accent-soft); color: var(--accent-deep); border: 1px solid #f0d2c6; padding: 3px 9px; border-radius: 999px; margin: 1px 3px 1px 0; }
.csbs-fe-muted-dash { color: var(--muted); }
.csbs-fe-badge { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; text-transform: capitalize; letter-spacing: .02em; }
.csbs-fe-badge.sent { background: var(--ok-bg); color: var(--ok); }
.csbs-fe-badge.scheduled { background: #e6eefb; color: #2456c9; }
.csbs-fe-badge.queued { background: var(--warn-bg); color: var(--warn); }
.csbs-fe-badge.failed { background: var(--danger-bg); color: var(--danger); }
.csbs-fe-badge.cancelled { background: #ece9e2; color: var(--muted); }
.csbs-fe-badge.topup, .csbs-fe-badge.refund { background: var(--ok-bg); color: var(--ok); }
.csbs-fe-badge.charge { background: var(--accent-soft); color: var(--accent-deep); }

.csbs-fe-rowbtn { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 13px; padding: 5px 7px; border-radius: 6px; transition: background .15s, color .15s; }
.csbs-fe-rowbtn:hover { color: var(--ink); background: var(--paper); }
.csbs-fe-rowbtn.danger:hover { color: var(--danger); background: var(--danger-bg); }

.csbs-fe-actions { display: flex; gap: 11px; margin-top: 20px; flex-wrap: wrap; }
.csbs-fe-pager { display: flex; gap: 7px; align-items: center; margin-top: 15px; font-size: 13px; color: var(--muted); }
.csbs-fe-pager span { margin-right: auto; }

/* Balance / bundles */
.csbs-fe-balance-big {
	font-size: 40px; font-weight: 600; letter-spacing: -.02em; margin: 2px 0; line-height: 1.05;
	background: linear-gradient(120deg, var(--ink), var(--accent-deep)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.csbs-fe-bundles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 6px 0 4px; }
@media (max-width: 560px) { .csbs-fe-bundles { grid-template-columns: 1fr; } }
.csbs-fe-bundle {
	border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 17px;
	text-align: center; cursor: pointer; background: linear-gradient(180deg, #fff, var(--paper-2));
	transition: border-color .18s, transform .12s, box-shadow .18s; position: relative;
}
.csbs-fe-bundle:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }
.csbs-fe-bundle-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.csbs-fe-bundle-price { font-size: 25px; font-weight: 600; margin: 5px 0 2px; }
.csbs-fe-bundle-credit { font-size: 12px; color: var(--ok); font-weight: 600; }
.csbs-fe-bundle-bonus { display: inline-block; margin-top: 7px; font-size: 11px; background: var(--ok-bg); color: var(--ok); padding: 3px 9px; border-radius: 999px; font-weight: 600; }

/* Dropzone */
.csbs-fe-drop {
	border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 40px 20px;
	text-align: center; cursor: pointer; transition: border-color .18s, background .18s; background: var(--paper-2);
}
.csbs-fe-drop:hover, .csbs-fe-drop.drag { border-color: var(--accent); background: var(--accent-soft); }
.csbs-fe-drop-name { font-weight: 600; color: var(--accent-deep); margin-top: 8px; }

/* Dashboard & reports */
.csbs-fe-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin: 4px 0; }
.csbs-fe-stat {
	background: #fff;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 20px 22px;
	box-shadow: 0 1px 2px rgba(22,24,29,.04), 0 8px 24px -16px rgba(22,24,29,.18);
	transition: transform .16s cubic-bezier(.2,.7,.3,1), box-shadow .2s, border-color .2s;
	animation: csbs-rise .5s cubic-bezier(.2,.7,.3,1) both;
	position: relative; overflow: hidden;
}
.csbs-fe-stat::before {
	content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
	background: linear-gradient(90deg, var(--line-strong), transparent);
	opacity: .8;
}
.csbs-fe-stat:hover {
	transform: translateY(-3px);
	box-shadow: 0 4px 8px rgba(22,24,29,.05), 0 22px 44px -18px rgba(22,24,29,.30);
	border-color: var(--line-strong);
}
.csbs-fe-stat.accent {
	border-color: #f0d2c6;
	background: linear-gradient(180deg, #fff 60%, var(--accent-soft));
}
.csbs-fe-stat.accent::before { background: linear-gradient(90deg, var(--accent), var(--gold)); opacity: 1; }
.csbs-fe-stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.csbs-fe-stat-value { font-size: 27px; font-weight: 600; letter-spacing: -.02em; margin: 7px 0 3px; line-height: 1.12; color: var(--ink); }
.csbs-fe-stat-sub { font-size: 12.5px; color: var(--muted); }
.csbs-fe-stat:nth-child(1) { animation-delay: .02s; }
.csbs-fe-stat:nth-child(2) { animation-delay: .06s; }
.csbs-fe-stat:nth-child(3) { animation-delay: .10s; }
.csbs-fe-stat:nth-child(4) { animation-delay: .14s; }
.csbs-fe-stat:nth-child(5) { animation-delay: .18s; }
.csbs-fe-stat:nth-child(6) { animation-delay: .22s; }
#fe-report-chart svg rect { transition: fill .15s; }
#fe-report-chart svg rect:hover { fill: var(--accent-deep); }

/* Toast */
.csbs-fe-toast {
	position: fixed; right: 24px; bottom: 24px;
	background: linear-gradient(135deg, #1b1e25, #14161b); color: #fff;
	padding: 14px 19px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
	box-shadow: var(--shadow-lg); z-index: 99999; max-width: 350px;
	border: 1px solid rgba(255,255,255,.08); animation: csbs-toast-in .3s cubic-bezier(.2,.7,.3,1) both;
}
.csbs-fe-toast.err { background: linear-gradient(135deg, #c12d24, #9e1f18); }
.csbs-fe-toast.ok { background: linear-gradient(135deg, #1e8050, #166440); }

.csbs-fe-spinner {
	display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4);
	border-top-color: #fff; border-radius: 50%; animation: csbs-fe-spin .6s linear infinite; vertical-align: -2px; margin-right: 7px;
}

/* Modal */
.csbs-fe-backdrop { position: fixed; inset: 0; background: rgba(20,22,27,.5); backdrop-filter: blur(2px); display: grid; place-items: center; z-index: 99998; animation: csbs-fade .18s ease; padding: 16px; }
.csbs-fe-modal { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); width: min(480px, 96vw); box-shadow: var(--shadow-lg); animation: csbs-rise .3s cubic-bezier(.2,.7,.3,1) both; overflow: hidden; }
.csbs-fe-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 16px; border-bottom: 1px solid var(--line); }
.csbs-fe-modal-head h3 { margin: 0; font-size: 19px; font-family: 'Fraunces', serif; font-weight: 600; }
.csbs-fe-modal-x { background: none; border: none; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; border-radius: 6px; transition: color .15s, background .15s; }
.csbs-fe-modal-x:hover { color: var(--ink); background: var(--paper); }
.csbs-fe-modal-body { padding: 18px 24px 22px; }
.csbs-fe-modal-body .csbs-fe-label:first-child { margin-top: 0; }
.csbs-fe-modal-foot { display: flex; justify-content: flex-end; gap: 11px; padding: 16px 24px; border-top: 1px solid var(--line); background: var(--paper); }
.csbs-fe-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .csbs-fe-form-row { grid-template-columns: 1fr; } }
.csbs-fe-form-row .csbs-fe-label { margin-top: 0; }

/* Motion */
@keyframes csbs-fe-spin { to { transform: rotate(360deg); } }
@keyframes csbs-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes csbs-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes csbs-toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
	.csbs-fe *, .csbs-fe *::before, .csbs-fe *::after { animation: none !important; transition: none !important; }
}

/* ── Full-screen portal mode (body.csbs-portal-page) ───────────────── */
/* This is driven by a body class the PLUGIN adds, so it works on any theme,
   regardless of page template. It (a) forces every ancestor of the portal to
   full width, killing side whitespace, and (b) hides the theme's header and
   footer so customers focus on the app. */

/* (a) Force the portal and ALL its ancestors to full width. The :has()
   selector reaches every wrapper that contains the app, whatever the theme
   names them. A static fallback list follows for older browsers. */
body.csbs-portal-page,
body.csbs-portal-page :has(> #csbs-fe-app),
body.csbs-portal-page :has(#csbs-fe-app) {
	max-width: 100% !important;
	width: auto !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
	float: none !important;
}
/* Fallback for browsers without :has() — common theme wrapper names. */
body.csbs-portal-page #content,
body.csbs-portal-page #main,
body.csbs-portal-page #primary,
body.csbs-portal-page .content,
body.csbs-portal-page .entry-content,
body.csbs-portal-page .page-content,
body.csbs-portal-page .wp-block-post-content,
body.csbs-portal-page .site-content,
body.csbs-portal-page .site-main,
body.csbs-portal-page .content-area,
body.csbs-portal-page .container,
body.csbs-portal-page .wrap,
body.csbs-portal-page .wrapper,
body.csbs-portal-page article,
body.csbs-portal-page main {
	max-width: 100% !important;
	width: 100% !important;
	padding: 0 !important;
	margin: 0 !important;
	float: none !important;
}

/* (b) Hide the theme's header, footer, and page-title chrome on portal pages. */
body.csbs-portal-page > header,
body.csbs-portal-page > footer,
body.csbs-portal-page .site-header,
body.csbs-portal-page .site-footer,
body.csbs-portal-page #masthead,
body.csbs-portal-page #colophon,
body.csbs-portal-page .site-branding,
body.csbs-portal-page nav.site-header,
body.csbs-portal-page .main-navigation,
/* Page-title variants across common themes */
body.csbs-portal-page .page-title,
body.csbs-portal-page .entry-header,
body.csbs-portal-page .entry-title,
body.csbs-portal-page .page-header,
body.csbs-portal-page .page-header-inner,
body.csbs-portal-page header.entry-header,
body.csbs-portal-page .wp-block-post-title,
body.csbs-portal-page h1.entry-title,
body.csbs-portal-page h1.page-title,
body.csbs-portal-page .ast-page-title,            /* Astra */
body.csbs-portal-page .entry-header-wrap,
body.csbs-portal-page .page-hero,
body.csbs-portal-page .title-bar,
body.csbs-portal-page .page__title,
body.csbs-portal-page .titlebar,
body.csbs-portal-page .breadcrumbs,
body.csbs-portal-page .breadcrumb,
body.csbs-portal-page .single-featured-image-header {
	display: none !important;
}
/* Catch any element whose own text is just the page title sitting directly
   before the portal app, as a last resort, using :has(). */
body.csbs-portal-page :is(h1, header):has(+ * #csbs-fe-app),
body.csbs-portal-page :is(h1, header):has(+ #csbs-fe-app) {
	display: none !important;
}

/* Prevent any horizontal scroll/push on portal pages (logged in or out). */
body.csbs-portal-page, body.csbs-portal-page-public { overflow-x: hidden; }

/* The portal app itself fills the screen edge-to-edge. */
body.csbs-portal-page .csbs-fe { max-width: none !important; width: 100% !important; margin: 0 !important; }
body.csbs-portal-page #csbs-fe-app {
	border-radius: 0;
	border-left: none;
	border-right: none;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}
body.csbs-portal-page #csbs-fe-app .csbs-fe-body { flex: 1; }
body.csbs-portal-page .csbs-fe-sidebar { width: 264px; }
body.csbs-portal-page .csbs-fe-content { min-width: 0; }
body.csbs-portal-page .csbs-fe-panels { padding: 36px 44px; max-width: 1320px; margin: 0 auto; width: 100%; }

/* Larger, more readable type throughout the app */
.csbs-fe-navitem { font-size: 16.5px; padding: 13px 15px; }
.csbs-fe-ico { width: 22px; font-size: 16px; }
.csbs-fe-account-name { font-size: 15px; }
.csbs-fe-account-sub { font-size: 12.5px; }
.csbs-fe-h3 { font-size: 19px; }
.csbs-fe-table { font-size: 15px; }
.csbs-fe-input { font-size: 15.5px; }
.csbs-fe-btn { font-size: 15px; }
.csbs-fe-help { font-size: 14px; }
.csbs-fe-balance-big { font-size: 44px; }

/* ── Getting-started checklist ─────────────────────────────────────── */
.csbs-fe-steps { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.csbs-fe-step {
	display: flex; align-items: flex-start; gap: 14px;
	background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
	padding: 18px 20px; box-shadow: 0 1px 2px rgba(22,24,29,.04);
}
.csbs-fe-step.is-done { background: var(--paper-2); }
.csbs-fe-step-check {
	flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
	font-weight: 700; font-size: 14px; background: var(--paper); color: var(--muted); border: 1px solid var(--line);
}
.csbs-fe-step-check.done { background: var(--ok-bg); color: var(--ok); border-color: #bfe6d3; }
.csbs-fe-step-body { flex: 1; min-width: 0; }
.csbs-fe-step-title { font-weight: 700; font-size: 15.5px; }
.csbs-fe-step.is-done .csbs-fe-step-title { color: var(--muted); }
.csbs-fe-step-text { font-size: 14px; color: var(--ink-soft); margin-top: 3px; }
.csbs-fe-step-go { flex: none; align-self: center; }

/* ── FAQ accordion ─────────────────────────────────────────────────── */
.csbs-fe-faq { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.csbs-fe-faq-item { border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; overflow: hidden; }
.csbs-fe-faq-q {
	width: 100%; text-align: left; background: none; border: none; cursor: pointer;
	font-family: inherit; font-size: 15px; font-weight: 600; color: var(--ink);
	padding: 15px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.csbs-fe-faq-q:hover { background: var(--paper); }
.csbs-fe-faq-caret { flex: none; font-size: 18px; color: var(--accent); transition: transform .18s; }
.csbs-fe-faq-q.is-open .csbs-fe-faq-caret { transform: rotate(45deg); }
.csbs-fe-faq-a { padding: 0 18px 16px; font-size: 14.5px; color: var(--ink-soft); line-height: 1.6; }

/* Contact modal group picker */
.csbs-fe-group-pick { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 4px 0 6px; max-height: 160px; overflow-y: auto; padding: 4px 2px; }
.csbs-fe-group-opt { display: inline-flex; align-items: center; gap: 7px; font-size: 14.5px; color: var(--ink); cursor: pointer; }
.csbs-fe-group-opt input { width: auto; margin: 0; }

/* Inline tag add row in contact modal */
.csbs-fe-tagadd { display: flex; gap: 8px; align-items: center; margin: 2px 0 14px; }

/* Optional step badge in getting-started */
.csbs-fe-step-optional { display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--paper); border: 1px solid var(--line); padding: 1px 7px; border-radius: 999px; vertical-align: middle; margin-left: 6px; }

/* ── Send sub-tabs ─────────────────────────────────────────────────── */
.csbs-fe-subtabs { display: flex; gap: 6px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.csbs-fe-subtab { background: none; border: none; border-bottom: 2px solid transparent; font-family: inherit; font-size: 15px; font-weight: 600; color: var(--muted); padding: 10px 16px; cursor: pointer; margin-bottom: -1px; }
.csbs-fe-subtab.is-active { color: var(--accent-deep); border-bottom-color: var(--accent); }
.csbs-fe-subtab:hover { color: var(--ink); }
.csbs-fe-sub-badge { display: inline-block; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; text-align: center; padding: 1px 6px; border-radius: 999px; margin-left: 4px; }

/* ── Conversations (GHL-style inbox) ───────────────────────────────── */
.csbs-fe-convo { display: grid; grid-template-columns: 320px 1fr; gap: 16px; height: calc(100vh - 230px); min-height: 460px; }
.csbs-fe-convo-list { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; overflow-y: auto; }
.csbs-fe-convo-thread { display: block; width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--line-soft); padding: 12px 10px; cursor: pointer; border-radius: var(--radius-sm); }
.csbs-fe-convo-thread:hover { background: var(--paper); }
.csbs-fe-convo-thread.is-active { background: var(--accent-soft); }
.csbs-fe-convo-thread-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.csbs-fe-convo-thread-name { font-weight: 700; font-size: 14.5px; color: var(--ink); }
.csbs-fe-convo-thread-sub { font-size: 13px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.csbs-fe-convo-unread { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; text-align: center; padding: 1px 6px; border-radius: 999px; }
.csbs-fe-convo-main { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; }
.csbs-fe-convo-empty { margin: auto; color: var(--muted); padding: 40px; text-align: center; }
.csbs-fe-convo-head { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.csbs-fe-convo-head-name { font-weight: 700; font-size: 16px; }
.csbs-fe-convo-thread-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; background: var(--paper); }
.csbs-fe-bubble-row { display: flex; }
.csbs-fe-bubble-row.out { justify-content: flex-end; }
.csbs-fe-bubble-row.in { justify-content: flex-start; }
.csbs-fe-bubble { max-width: 72%; padding: 11px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.45; }
.csbs-fe-bubble.out { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.csbs-fe-bubble.in { background: #fff; color: var(--ink); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.csbs-fe-bubble-time { font-size: 10.5px; opacity: .7; margin-top: 5px; }
.csbs-fe-convo-reply { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--line); align-items: flex-end; }
.csbs-fe-convo-reply textarea { flex: 1; margin: 0; resize: none; }
@media (max-width: 760px) {
	.csbs-fe-convo { grid-template-columns: 1fr; height: auto; }
	.csbs-fe-convo-main { min-height: 420px; }
}
