/* ==========================================================================
   Fluid full-width layout + branded app header (FunnelKit-style concept)
   ========================================================================== */
:root {
	--kachingly-brand: #f97316;
	--kachingly-brand-dark: #ea580c;
	--kachingly-brand-soft: #fff7ed;
	--kachingly-ink: #1d2327;
	--kachingly-muted: #646970;
	--kachingly-faint: #787c82;
	--kachingly-line: #dcdcde;
	--kachingly-line-soft: #f0f0f1;
	--kachingly-ok: #008a20;
	--kachingly-ok-soft: #edfaef;
	--kachingly-warn: #bd8600;
	--kachingly-err: #b32d2e;
	--kachingly-card-shadow: 0 1px 2px rgba(0,0,0,0.04);
	--kachingly-radius: 10px;
}

/* Let Kachingly screens run edge-to-edge (fluid) instead of the boxed .wrap. */
.kachingly-admin #wpcontent {
	padding-left: 0;
}
.kachingly-admin #wpbody-content {
	padding-bottom: 0;
}
.kachingly-admin .wrap {
	margin: 0;
	max-width: 100%;
	box-sizing: border-box;
	padding: 24px 28px 48px;
}
.kachingly-admin .wrap > h1:first-child {
	margin-top: 0;
}
/* WP moves admin notices below the first H1 — keep them aligned in the fluid body. */
.kachingly-admin .notice,
.kachingly-admin div.updated,
.kachingly-admin div.error {
	margin-left: 0;
	margin-right: 0;
}

/* App bar */
.kachingly-appbar {
	background: #fff;
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
}
.kachingly-appbar * {
	box-sizing: border-box;
}
.kachingly-appbar-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	width: 100%;
	min-height: 60px;
	padding: 0 28px;
}
.kachingly-appbar-l {
	display: flex;
	align-items: center;
	gap: 28px;
	min-width: 0;
}
.kachingly-brand {
	display: inline-flex;
	align-items: center;
	flex-shrink: 0;
}
.kachingly-brand img {
	height: 30px;
	width: auto;
	display: block;
}
.kachingly-appnav {
	display: flex;
	align-items: center;
	gap: 4px;
	min-width: 0;
	overflow-x: auto;
	scrollbar-width: none;
}
.kachingly-appnav::-webkit-scrollbar {
	display: none;
}
.kachingly-appnav a {
	position: relative;
	display: inline-flex;
	align-items: center;
	height: 60px;
	padding: 0 14px;
	font-size: 14px;
	font-weight: 500;
	white-space: nowrap;
	text-decoration: none;
	color: var(--kachingly-ink);
	box-shadow: none;
}
.kachingly-appnav a:hover,
.kachingly-appnav a:focus {
	color: var(--kachingly-brand-dark);
}
.kachingly-appnav a.is-active {
	color: var(--kachingly-brand-dark);
}
.kachingly-appnav a.is-active::after,
.kachingly-appnav a:hover::after {
	content: "";
	position: absolute;
	left: 14px;
	right: 14px;
	bottom: 0;
	height: 3px;
	border-radius: 3px 3px 0 0;
	background: var(--kachingly-brand);
}
.kachingly-appbar-r {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
}
.kachingly-version {
	display: inline-flex;
	align-items: center;
	padding: 4px 12px;
	border-radius: 24px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--kachingly-brand-dark);
	background: var(--kachingly-brand-soft);
}
/* Mobile hamburger toggle (hidden on desktop; shown ≤782px). */
.kachingly-nav-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 1px solid var(--kachingly-line);
	border-radius: 8px;
	background: #fff;
	color: var(--kachingly-ink);
	cursor: pointer;
}
.kachingly-nav-toggle:hover {
	color: var(--kachingly-brand-dark);
	border-color: var(--kachingly-brand);
}
.kachingly-nav-toggle .dashicons {
	font-size: 22px;
	width: 22px;
	height: 22px;
	line-height: 22px;
}

/* Header banner: licence/subscription notices, rendered above the page heading. */
.kachingly-banner {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px 14px;
	padding: 12px 28px;
	font-size: 14px;
	border-left: 4px solid #d63638;
	background: #fcf0f1;
	color: var(--kachingly-ink);
}
.kachingly-banner-warning {
	border-left-color: #dba617;
	background: #fcf9e8;
}
.kachingly-banner-error {
	border-left-color: #d63638;
	background: #fcf0f1;
}
.kachingly-banner-msg { flex: 1 1 auto; min-width: 0; }
.kachingly-banner-btn {
	display: inline-flex;
	align-items: center;
	padding: 7px 16px;
	border-radius: 8px;
	background: var(--kachingly-brand);
	color: #fff;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}
.kachingly-banner-btn:hover,
.kachingly-banner-btn:focus {
	background: var(--kachingly-brand-dark);
	color: #fff;
}
@media (max-width: 600px) {
	.kachingly-banner { padding: 12px 16px; }
}

/* Report table: scroll horizontally instead of overflowing the viewport (mobile).
   Also caps height + scrolls vertically so the header row + DATE column stay frozen. */
.kachingly-table-scroll {
	width: 100%;
	max-width: 100%;
	max-height: calc(100vh - 220px);
	overflow: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
}
.kachingly-table-scroll > table.kachingly-table {
	min-width: 900px;
}

@media screen and (max-width: 782px) {
	.kachingly-appbar { position: relative; }
	.kachingly-appbar-inner {
		flex-wrap: nowrap;
		min-height: 0;
		padding: 10px 16px;
		gap: 12px;
	}
	.kachingly-appbar-l {
		gap: 14px;
		flex: 1 1 auto;
		min-width: 0;
		justify-content: flex-start;
	}
	.kachingly-nav-toggle { display: inline-flex; }
	/* Nav collapses into a dropdown panel below the bar, toggled by the hamburger. */
	.kachingly-appnav {
		display: none;
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		background: #fff;
		border-top: 1px solid var(--kachingly-line);
		box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
		overflow: visible;
		z-index: 100;
	}
	.kachingly-appnav.is-open { display: flex; }
	.kachingly-appnav a {
		height: auto;
		width: 100%;
		padding: 13px 20px;
		border-bottom: 1px solid var(--kachingly-line);
	}
	.kachingly-appnav a:last-child { border-bottom: 0; }
	/* Vertical list: swap the underline indicator for a left brand bar. */
	.kachingly-appnav a.is-active::after,
	.kachingly-appnav a:hover::after {
		left: 0;
		right: auto;
		top: 0;
		bottom: 0;
		width: 3px;
		height: auto;
		border-radius: 0 3px 3px 0;
	}
	.kachingly-brand img {
		height: 26px;
	}
	.kachingly-admin .wrap {
		padding: 16px 14px 40px;
	}
}

.kachingly-sub {
	font-size: 14px;
	color: #646970;
	font-weight: 400;
	margin-left: 8px;
}

/* Data filters panel */
.kachingly-filters {
	background: #ffffff;
	border: 1px solid #e2e4e9;
	border-radius: 14px;
	padding: 14px 18px 16px;
	margin: 16px 0 18px;
	color: #1d2327;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

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

.kachingly-filters-title {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #1d2327;
}

.kachingly-filters-title .dashicons {
	width: 30px;
	height: 30px;
	font-size: 18px;
	line-height: 30px;
	text-align: center;
	background: #6d5ef7;
	color: #fff;
	border-radius: 8px;
}

.kachingly-filters-reset {
	text-decoration: none;
	color: #50575e;
	background: #f6f7f9;
	border: 1px solid #dcdfe4;
	border-radius: 8px;
	padding: 7px 14px;
	font-size: 13px;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.kachingly-filters-reset:hover {
	color: #1d2327;
	background: #eef0f3;
	border-color: #c9cdd4;
}

.kachingly-filters-body {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 14px 18px;
}

.kachingly-filters-row {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: flex-end;
	margin: 0;
}

.kachingly-filters-tools {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.kachingly-filters-lastsync {
	margin-top: 10px;
	color: #8a8f98;
	font-size: 12px;
	text-align: right;
}

.kachingly-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	width: 150px;
}

.kachingly-field-range {
	width: 178px;
}

.kachingly-field label {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #646970;
}

.kachingly-filters select,
.kachingly-filters input[type="date"] {
	width: 100%;
	box-sizing: border-box;
	height: 42px;
	min-height: 42px;
	max-height: 42px;
	line-height: 24px;
	background: #fff;
	border: 1px solid #dcdfe4;
	color: #1d2327;
	border-radius: 9px;
	padding: 0 12px;
	font-size: 13px;
	box-shadow: none;
	vertical-align: middle;
}

.kachingly-filters select {
	-webkit-appearance: none;
	appearance: none;
	padding-right: 36px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23646970' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
}

.kachingly-filters select:focus,
.kachingly-filters input[type="date"]:focus {
	border-color: #6d5ef7;
	box-shadow: 0 0 0 2px rgba(109, 94, 247, 0.35);
	outline: none;
}

.kachingly-apply {
	height: 42px !important;
	min-height: 42px !important;
	border-radius: 9px !important;
	padding: 0 20px !important;
}

/* Modern toolbar buttons (Export Image / Export Excel / Sync Meta Ads). */
.kachingly-filters-tools .kachingly-toolbtn,
#kachingly-export-download {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	height: 38px;
	padding: 0 16px;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	background: #fff;
	border: 1px solid var(--kachingly-line);
	color: var(--kachingly-ink);
	transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
	text-decoration: none;
	box-shadow: 0 1px 1px rgba(15, 23, 42, 0.04);
}
.kachingly-filters-tools .kachingly-toolbtn:hover,
.kachingly-filters-tools .kachingly-toolbtn:focus,
#kachingly-export-download:hover {
	background: var(--kachingly-brand-soft);
	border-color: #fed7aa;
	color: var(--kachingly-brand-dark);
}
.kachingly-filters-tools .kachingly-toolbtn .dashicons,
.kachingly-filters-tools .kachingly-toolbtn .kachingly-ico,
#kachingly-export-download .dashicons,
#kachingly-export-download .kachingly-ico {
	font-size: 16px;
	width: 16px;
	height: 16px;
	line-height: 16px;
	margin: 0;
	color: inherit;
}
/* Primary stays orange via the WPLM overlay, but harmonise sizing + shape. */
.kachingly-filters-tools .kachingly-toolbtn.button-primary,
#kachingly-export-download.button-primary {
	background: var(--kachingly-brand) !important;
	border-color: var(--kachingly-brand-dark) !important;
	color: #fff !important;
	box-shadow: 0 1px 2px rgba(249, 115, 22, 0.3) !important;
}
.kachingly-filters-tools .kachingly-toolbtn.button-primary:hover,
.kachingly-filters-tools .kachingly-toolbtn.button-primary:focus,
#kachingly-export-download.button-primary:hover {
	background: var(--kachingly-brand-dark) !important;
	border-color: var(--kachingly-brand-dark) !important;
	color: #fff !important;
}
.kachingly-filters-tools .kachingly-toolbtn.button-primary .dashicons,
#kachingly-export-download.button-primary .dashicons {
	color: #fff !important;
}
.kachingly-filters-tools .kachingly-toolbtn:disabled,
.kachingly-filters-tools .kachingly-toolbtn[disabled] {
	opacity: 0.55;
	cursor: not-allowed;
}

.kachingly-syncmsg {
	font-style: italic;
}

.kachingly-syncmsg.ok { color: #008a20; font-style: normal; }
.kachingly-syncmsg.err { color: #d63638; font-style: normal; }

.kachingly-lastsync {
	color: #646970;
	font-size: 12px;
}

/* Summary cards */
/* Two side-by-side groups: Yesterday (left) + This month (right) */
.kachingly-cardgroups {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 26px;
	align-items: start;
	margin: 10px 0 24px;
}

@media (max-width: 1180px) {
	.kachingly-cardgroups {
		grid-template-columns: 1fr;
		gap: 18px;
	}
}

/* Daily Reports: single full-width group (the Yesterday column was removed).
   Full page width → 6 cards per row on desktop, 3 per row on mobile. */
.kachingly-cardgroups-single {
	grid-template-columns: 1fr;
}
.kachingly-cardgroups-single .kachingly-cards {
	grid-template-columns: repeat(6, minmax(0, 1fr));
}
@media (max-width: 782px) {
	.kachingly-cardgroups-single .kachingly-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
	.kachingly-cardgroups-single .kachingly-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.kachingly-cards {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 14px;
	margin: 8px 0 0;
}
@media (max-width: 782px) {
	.kachingly-cards { grid-template-columns: 1fr 1fr; }
}

/* Phones: keep 2 columns but tighten the cards so long figures still fit one line. */
@media (max-width: 600px) {
	.kachingly-cards {
		grid-template-columns: 1fr 1fr; /* always 2-up, no 150px min that could overflow */
		gap: 10px;
	}
	.kachingly-card {
		padding: 13px 12px;
		min-height: 82px;
	}
	.kachingly-card .label {
		font-size: 10px;
		letter-spacing: 0.04em;
	}
	.kachingly-card .value {
		font-size: clamp(15px, 4.6vw, 22px);
	}
	.kachingly-card .sub {
		font-size: 11px;
	}
	.kachingly-card-icon {
		width: 38px;
		height: 38px;
		right: 8px;
	}
}

.kachingly-card {
	position: relative;
	overflow: hidden;
	background: linear-gradient(180deg, #fcfcff 0%, #f1f2fb 100%);
	color: #1d2327;
	border: 1px solid #e6e8ee;
	border-radius: 14px;
	padding: 16px 18px;
	min-height: 94px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 4px;
	box-shadow: 0 1px 3px rgba(24, 28, 45, 0.06);
	transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
}

.kachingly-card:hover {
	box-shadow: 0 6px 18px rgba(24, 28, 45, 0.10);
	border-color: #dcdfe8;
	transform: translateY(-1px);
}

/* Subtle colored accent bar on the left edge (per metric) */
.kachingly-card::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 4px;
	background: #c7ccd6;
}

.kachingly-card-icon {
	position: absolute;
	right: 14px;
	top: 50%;
	transform: translateY(-50%);
	width: 54px;
	height: 54px;
	color: #1d2327;
	fill: currentColor; /* inline SVG inherits the (theme) colour */
	opacity: 0.12;
	pointer-events: none;
}

.kachingly-card .label,
.kachingly-card .value,
.kachingly-card .sub {
	position: relative; /* sit above the watermark icon */
	z-index: 1;
}

.kachingly-card .label {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #8a8f98;
}

.kachingly-card .value {
	font-size: 22px;
	font-weight: 800;
	line-height: 1.1;
	color: #1d2327;
	white-space: nowrap;        /* keep the figure on one line (no mid-number break) */
	font-variant-numeric: tabular-nums;
}

.kachingly-card .sub {
	font-size: 11.5px;
	color: #8a8f98;
	font-variant-numeric: tabular-nums;
}

/* Per-metric accent: left bar + tinted watermark (+ value colour for spend & profit) */
.kachingly-card.spend::before { background: #2563eb; }
.kachingly-card.spend .kachingly-card-icon { color: #2563eb; }
.kachingly-card.spend .value { color: #2563eb; }

.kachingly-card.sales::before { background: #1f7a8c; }
.kachingly-card.sales .kachingly-card-icon { color: #1f7a8c; }

.kachingly-card.roas::before { background: #b8860b; }
.kachingly-card.roas .kachingly-card-icon { color: #b8860b; }

.kachingly-card.orders::before { background: #2c3338; }
.kachingly-card.orders .kachingly-card-icon { color: #2c3338; }

.kachingly-card.cod::before { background: #9c5b34; }
.kachingly-card.cod .kachingly-card-icon { color: #9c5b34; }

.kachingly-card.fpx::before { background: #2f5fa3; }
.kachingly-card.fpx .kachingly-card-icon { color: #2f5fa3; }

.kachingly-card.rts::before { background: #ea580c; }
.kachingly-card.rts .kachingly-card-icon { color: #ea580c; }

.kachingly-card.pnl-pos::before { background: #1a7f37; }
.kachingly-card.pnl-pos .kachingly-card-icon { color: #1a7f37; }
.kachingly-card.pnl-pos .value { color: #1a7f37; }

.kachingly-card.pnl-neg::before { background: #b32d2e; }
.kachingly-card.pnl-neg .kachingly-card-icon { color: #b32d2e; }
.kachingly-card.pnl-neg .value { color: #b32d2e; }

/* Clean theme: match the Dashboard overview metric cards — flat white, no left
   accent bar, small brand-orange icon top-right (instead of the big watermark). */
.kachingly-style-clean .kachingly-cards {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 782px) {
	.kachingly-style-clean .kachingly-cards { grid-template-columns: 1fr 1fr; }
}
.kachingly-style-clean .kachingly-card {
	background: #fff;
	border: 1px solid var(--kachingly-line);
	border-radius: var(--kachingly-radius);
	box-shadow: var(--kachingly-card-shadow);
}
.kachingly-style-clean .kachingly-card::before { display: none; }
.kachingly-style-clean .kachingly-card .kachingly-card-icon {
	top: 16px;
	right: 16px;
	transform: none;
	width: 22px;
	height: 22px;
	opacity: 1;
	color: var(--kachingly-brand-dark);
}
.kachingly-style-clean .kachingly-card .label { color: var(--kachingly-faint); font-size: 11px; letter-spacing: 0.03em; }
.kachingly-style-clean .kachingly-card .value { color: var(--kachingly-ink); font-size: 22px; line-height: 1.1; }
.kachingly-style-clean .kachingly-card .sub { color: var(--kachingly-muted); font-size: 11.5px; }
/* Keep profit / loss values coloured; neutralise the spend accent value. */
.kachingly-style-clean .kachingly-card.spend .value { color: var(--kachingly-ink); }
.kachingly-style-clean .kachingly-card.pnl-pos .value { color: #16a34a; }
.kachingly-style-clean .kachingly-card.pnl-neg .value { color: #dc2626; }
.kachingly-style-clean .kachingly-card.pnl-pos .kachingly-card-icon { color: #16a34a; }
.kachingly-style-clean .kachingly-card.pnl-neg .kachingly-card-icon { color: #dc2626; }

.kachingly-section {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #50575e;
	font-weight: 600;
	margin: 0 0 2px;
	padding: 0;
}

/* Section header row with status pill */
.kachingly-section-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	min-height: 26px;
}

.kachingly-status-pill {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 4px 11px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
	text-transform: none;
	letter-spacing: 0.01em;
	border: 1px solid transparent;
}

.kachingly-status-pill .dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: currentColor;
}

.kachingly-status-pill.on { background: #e9f7ef; color: #1a7f37; border-color: #b6e2c6; }
.kachingly-status-pill.on .dot { box-shadow: 0 0 0 3px rgba(26, 127, 55, 0.18); }
.kachingly-status-pill.warn { background: #fff7e6; color: #8a6d1b; border-color: #f0d493; }
.kachingly-status-pill.off { background: #f0f0f1; color: #646970; border-color: #dcdfe4; }

/* Table */
.kachingly-table {
	border-collapse: collapse;
	border: 1px solid #dcdfe3;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
	font-variant-numeric: tabular-nums;
	font-feature-settings: "tnum";
}

.kachingly-table th,
.kachingly-table td {
	text-align: right;
	white-space: nowrap;
	padding: 9px 14px !important;
	font-size: 13px;
}

/* Header — frozen to the top of the scroll area while scrolling down */
table.kachingly-table thead th {
	text-align: right;
	background: #2c3338 !important;
	color: #fff !important;
	font-weight: 600;
	font-size: 11px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	padding-top: 11px !important;
	padding-bottom: 11px !important;
	position: sticky;
	top: 0;
	z-index: 4; /* stays above body cells (incl. sticky DATE column) while scrolling down */
}

/* Sortable-link colour only. NOTE: no `thead th:hover` colour override — the header
   can be light-themed (card style), so forcing white text on hover made the hovered
   header (e.g. CASH) vanish. Without an override the cell keeps its own colour. */
table.kachingly-table thead th a {
	color: #fff !important;
}

/* Date column: left aligned + emphasised */
.kachingly-table td.kachingly-date,
.kachingly-table thead th:first-child,
.kachingly-table tfoot th:first-child {
	text-align: left;
}

.kachingly-table td.kachingly-date {
	font-weight: 600;
	color: #1d2327;
}

/* Frozen DATE column (sticky horizontally) */
table.kachingly-table thead th:first-child {
	position: sticky;
	left: 0;
	top: 0;
	z-index: 6; /* top-left corner: above both the frozen header row and the frozen DATE column */
}

.kachingly-table td.kachingly-date {
	position: sticky;
	left: 0;
	z-index: 1;
	background: #fff;
	border-right: 1px solid #dcdfe3;
	box-shadow: 2px 0 3px -1px rgba(0, 0, 0, 0.08);
}

table.kachingly-table tfoot th:first-child {
	position: sticky;
	left: 0;
	bottom: 0;
	z-index: 6; /* bottom-left corner: above both the frozen totals row and the frozen DATE column */
	border-right: 1px solid #11193b;
}

/* Keep the frozen cell's background matched to its row state */
.kachingly-table tbody tr:nth-child(even) td.kachingly-date { background: #f6f7f7; }
.kachingly-table tbody tr.is-weekend td.kachingly-date { background: #fbf6ee; }
.kachingly-table tbody tr:hover td.kachingly-date { background: #eef4fb; }

/* Rows */
.kachingly-table tbody td {
	border-bottom: 1px solid #f0f0f1;
	color: #1d2327;
}

.kachingly-table tbody tr:nth-child(even) {
	background: #f6f7f7;
}

.kachingly-table tbody tr.is-weekend {
	background: #fbf6ee;
}

.kachingly-table tbody tr:hover {
	background: #eef4fb;
}

/* Dim zero / empty values so real numbers stand out */
.kachingly-table tbody td.z {
	color: #c3c4c7;
}

/* Column-group separators (Ads | Sales | Performance | Orders) */
.kachingly-table th:nth-child(2),
.kachingly-table td:nth-child(2),
.kachingly-table th:nth-child(4),
.kachingly-table td:nth-child(4),
.kachingly-table th:nth-child(8),
.kachingly-table td:nth-child(8),
.kachingly-table th:nth-child(11),
.kachingly-table td:nth-child(11) {
	border-left: 1px solid #e3e5e8;
}

/* Key result columns: Net Profit + ROI */
.kachingly-table tbody td.col-key {
	background: #f7f9ff;
}

.kachingly-table tbody tr:hover td.col-key {
	background: #eaf0fd;
}

/* Today's row — highlighted so the eye lands on it instantly */
.kachingly-table tbody tr.is-today { background: #e9ecff; }
.kachingly-table tbody tr.is-today td { border-bottom-color: #d4d9fb; }
.kachingly-table tbody tr.is-today td.kachingly-date {
	background: #e9ecff;
	border-left: 3px solid #6d5ef7;
	color: #4a3fd0;
}
.kachingly-table tbody tr.is-today td.col-key { background: #e2e6ff; }
.kachingly-table tbody tr.is-today:hover,
.kachingly-table tbody tr.is-today:hover td.kachingly-date { background: #dfe3ff; }
.kachingly-table tbody tr.is-today:hover td.col-key { background: #d6dbff; }

/* Profit / loss colouring — coloured text, no harsh fill */
.kachingly-table tbody td.pnl-neg {
	color: #b32d2e;
	font-weight: 700;
}

.kachingly-table tbody td.pnl-pos {
	color: #1a7f37;
	font-weight: 700;
}

/* Totals footer — frozen to the bottom of the scroll area */
table.kachingly-table tfoot tr.kachingly-totals th,
.kachingly-totals th {
	background: #1d2855 !important;
	color: #fff !important;
	font-size: 13px;
	padding-top: 12px !important;
	padding-bottom: 12px !important;
	border-top: 2px solid #11193b;
	vertical-align: top;
	position: sticky;
	bottom: 0;
	z-index: 4;
}

/* Self-describing total cells: small heading above each figure. */
.kachingly-totals .kachingly-tot-h {
	display: block;
	font-size: 9px;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.6);
	margin-bottom: 3px;
	line-height: 1.2;
	white-space: nowrap;
}
.kachingly-totals .kachingly-tot-v {
	display: block;
	font-size: 13px;
	line-height: 1.2;
}

.kachingly-totals .pnl-neg,
.kachingly-totals .pnl-pos {
	color: #fff !important;
}

/* Remarks (change log) column */
.kachingly-table .kachingly-remark-col,
.kachingly-table td.kachingly-remark-cell {
	text-align: left;
	white-space: normal;
	min-width: 220px;
	border-left: 1px solid #e3e5e8;
}

/* Click-to-edit toggle */
.kachingly-remark-toggle {
	width: 100%;
	box-sizing: border-box;
	background: none;
	border: 1px solid transparent;
	padding: 5px 7px;
	font-size: 13px;
	text-align: left;
	color: #1d2327;
	border-radius: 4px;
	cursor: text;
	white-space: normal;
	transition: background 0.15s, color 0.15s;
}

.kachingly-remark-toggle:hover { background: #f0f0f1; }
.kachingly-remark-toggle.empty { color: #b5b8bd; }
.kachingly-remark-toggle.saved { color: #1a7f37; font-weight: 600; }
.kachingly-remark-toggle.error { color: #d63638; }

.kachingly-remark {
	width: 100%;
	box-sizing: border-box;
	border: 1px solid #2271b1;
	background: #fff;
	padding: 5px 7px;
	font-size: 13px;
	border-radius: 4px;
	color: #1d2327;
	box-shadow: 0 0 0 1px #2271b1;
}

.kachingly-remark::placeholder { color: #b5b8bd; }
.kachingly-remark:focus { outline: none; }

/* Payment-method column: RM amount beneath the percentage */
.kachingly-pay-amt {
	display: block;
	margin-top: 1px;
	font-size: 10px;
	font-weight: 400;
	color: #8a8f98;
}

.kachingly-totals .kachingly-pay-amt {
	color: rgba(255, 255, 255, 0.75);
}

.kachingly-legend {
	color: #646970;
	font-style: italic;
	margin-top: 12px;
}

/* Export-as-image modal */
.kachingly-export-overlay {
	display: flex;
	position: fixed;
	inset: 0;
	z-index: 100000;
	background: rgba(10, 14, 23, 0.72);
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.kachingly-export-overlay[hidden] {
	display: none;
}

.kachingly-export-dialog {
	width: 560px;
	max-width: 100%;
	max-height: 90vh;
	overflow: auto;
	background: #16202e;
	color: #e6eaf2;
	border-radius: 14px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.kachingly-export-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 22px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.kachingly-export-head h2 {
	margin: 0;
	font-size: 18px;
	color: #fff;
}

.kachingly-export-head .dashicons {
	color: #8b5cf6;
	vertical-align: text-bottom;
}

.kachingly-export-x {
	background: none;
	border: none;
	color: #aab2c0;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
}

.kachingly-export-x:hover {
	color: #fff;
}

.kachingly-export-body {
	padding: 22px;
}

.kachingly-export-canvas {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 12px;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.kachingly-export-foot {
	display: flex;
	justify-content: flex-end;
	gap: 12px;
	padding: 16px 22px 22px;
}

.kachingly-export-foot .dashicons {
	vertical-align: text-bottom;
}

/* Marketer Log page — WPLM list-table card (fluid, muted header, brand-soft hover) */
.kachingly-changelog-table {
	width: 100%;
	margin-top: 14px;
	background: #fff;
	border: 1px solid var(--kachingly-line);
	border-collapse: separate;
	border-spacing: 0;
	border-radius: var(--kachingly-radius);
	box-shadow: var(--kachingly-card-shadow);
	overflow: hidden;
}

.kachingly-changelog-table thead th {
	background: #fafafb;
	color: var(--kachingly-muted);
	text-align: left;
	text-transform: uppercase;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.04em;
	padding: 12px 14px;
	border-bottom: 1px solid #e0e0e2;
}

.kachingly-changelog-table td {
	padding: 12px 14px;
	border-bottom: 1px solid var(--kachingly-line-soft);
	vertical-align: top;
	color: var(--kachingly-ink);
	font-size: 13px;
}

.kachingly-changelog-table tbody tr:last-child td {
	border-bottom: 0;
}

.kachingly-changelog-table tbody tr:hover td {
	background: var(--kachingly-brand-soft);
}

.kachingly-changelog-date {
	white-space: nowrap;
	font-weight: 600;
}

.kachingly-changelog-date a {
	color: var(--kachingly-brand-dark);
	text-decoration: none;
}

.kachingly-changelog-date a:hover {
	text-decoration: underline;
}

.kachingly-changelog-date .dow {
	display: block;
	font-weight: 400;
	font-size: 12px;
	color: var(--kachingly-faint);
}

.kachingly-changelog-remark {
	width: 100%;
	white-space: pre-wrap;
	color: var(--kachingly-ink);
}

.kachingly-changelog-updated {
	white-space: nowrap;
	font-size: 12px;
	color: var(--kachingly-faint);
}

.kachingly-changelog-empty {
	margin-top: 14px;
	background: #fff;
	border: 1px solid var(--kachingly-line);
	border-radius: var(--kachingly-radius);
	padding: 24px;
	color: var(--kachingly-muted);
	box-shadow: var(--kachingly-card-shadow);
}

/* Settings: quick-start guide */
.kachingly-guide {
	background: #fff;
	border: 1px solid var(--kachingly-line);
	border-radius: var(--kachingly-radius);
	padding: 22px 26px 24px;
	margin: 18px 0 26px;
	box-shadow: var(--kachingly-card-shadow);
}

.kachingly-guide h2 {
	display: flex;
	align-items: center;
	gap: 11px;
	margin: 0 0 18px;
	font-size: 17px;
	font-weight: 700;
	color: #1d2327;
}

.kachingly-guide h2 .dashicons {
	width: 34px;
	height: 34px;
	font-size: 20px;
	line-height: 34px;
	text-align: center;
	color: #fff;
	background: linear-gradient(135deg, var(--kachingly-brand), var(--kachingly-brand-dark));
	border-radius: 10px;
	box-shadow: 0 2px 6px rgba(249, 115, 22, 0.30);
}

/* Timeline-style numbered steps */
.kachingly-guide-steps {
	counter-reset: step;
	list-style: none;
	margin: 0;
	padding: 0;
	position: relative;
}

.kachingly-guide-steps::before {
	content: "";
	position: absolute;
	left: 15px;
	top: 8px;
	bottom: 20px;
	width: 2px;
	background: #fed7aa; /* light orange timeline line */
}

.kachingly-guide-steps li {
	counter-increment: step;
	position: relative;
	padding: 0 0 22px 48px;
	line-height: 1.55;
	color: #50575e;
}

.kachingly-guide-steps li:last-child {
	padding-bottom: 4px;
}

.kachingly-guide-steps li::before {
	content: counter(step);
	position: absolute;
	left: 0;
	top: -1px;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--kachingly-brand), var(--kachingly-brand-dark));
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 5px rgba(249, 115, 22, 0.30);
}

.kachingly-guide-step-head {
	font-size: 14px;
	font-weight: 700;
	color: #1d2327;
	margin: 4px 0 3px;
}

.kachingly-guide-step-body {
	margin: 0;
	color: #50575e;
}

.kachingly-guide-steps a {
	color: var(--kachingly-brand-dark);
	text-decoration: none;
	font-weight: 600;
}

.kachingly-guide-steps a:hover {
	text-decoration: underline;
}

/* "Tonton Video Tutorial" pill — only renders when a link is configured. */
.kachingly-guide-vid {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 9px;
	padding: 5px 13px 5px 10px;
	font-size: 12.5px;
	font-weight: 600;
	line-height: 1;
	color: var(--kachingly-brand-dark) !important;
	background: var(--kachingly-brand-soft);
	border: 1px solid #fed7aa;
	border-radius: 999px;
	text-decoration: none !important;
	transition: background .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.kachingly-guide-vid:hover {
	color: #fff !important;
	background: linear-gradient(135deg, var(--kachingly-brand), var(--kachingly-brand-dark));
	border-color: var(--kachingly-brand-dark);
	box-shadow: 0 2px 6px rgba(249, 115, 22, 0.30);
}

.kachingly-guide-vid .dashicons {
	width: 16px;
	height: 16px;
	font-size: 16px;
	line-height: 16px;
}

.kachingly-guide-token .kachingly-guide-vid {
	margin-top: 12px;
}

.kachingly-guide-token {
	margin-top: 18px;
	background: var(--kachingly-brand-soft);
	border: 1px solid #fed7aa;
	border-radius: 12px;
	padding: 12px 16px;
}

.kachingly-guide-token summary {
	cursor: pointer;
	font-weight: 600;
	color: var(--kachingly-brand-dark);
}

.kachingly-guide-token ol {
	margin: 12px 0 4px;
	padding-left: 20px;
	color: #50575e;
}

.kachingly-guide-token li {
	margin-bottom: 7px;
	line-height: 1.55;
}

/* Settings tabs — flat layout (matches WPLM Billplz). The form-table inside is
   the visible card; the panel itself is a transparent wrapper. */
.kachingly-settings .kachingly-settings-card {
	background: transparent;
	border: 0;
	border-radius: 0;
	padding: 0;
	margin: 0 0 24px;
	box-shadow: none;
}

.kachingly-settings .kachingly-settings-card h2 {
	margin: 0 0 12px;
	padding: 0;
	font-size: 17px;
	font-weight: 600;
	color: var(--kachingly-ink);
	border-bottom: 0;
}

.kachingly-settings .kachingly-settings-card .form-table {
	margin-top: 4px;
}

.kachingly-settings .kachingly-settings-card .form-table th {
	padding-left: 0;
	font-weight: 600;
}

.kachingly-settings .kachingly-settings-card .description {
	color: #646970;
}

.kachingly-settings input[type="text"],
.kachingly-settings input[type="password"],
.kachingly-settings input[type="number"] {
	border-radius: 7px;
}

.kachingly-settings .submit {
	margin-top: 0;
	padding-top: 0;
}

/* Meta connection status + account picker (settings) */
.kachingly-conn-badge {
	display: inline-block;
	margin: 0 0 12px;
	padding: 6px 12px;
	border-radius: 8px;
	font-size: 13px;
}

.kachingly-conn-badge.on { background: #e9f7ef; color: #1a7f37; border: 1px solid #b6e2c6; }
.kachingly-conn-badge.off { background: #f0f0f1; color: #646970; border: 1px solid #dcdfe4; }
.kachingly-conn-badge.warn { background: #fff7e6; color: #8a6d1b; border: 1px solid #f0d493; }

.kachingly-meta-links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 14px;
}

.kachingly-acct-picker {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 8px;
}

.kachingly-acct-select { min-width: 260px; }

.kachingly-acct-msg { font-size: 12px; font-style: italic; color: #646970; }
.kachingly-acct-msg.ok { color: #008a20; font-style: normal; }
.kachingly-acct-msg.err { color: #d63638; font-style: normal; }

/* Meta card buttons with icons */
.kachingly-links-label {
	margin: 4px 0 6px;
	font-weight: 600;
	color: #50575e;
}

.kachingly-meta-links .button,
#kachingly-load-accounts {
	display: inline-flex;
	align-items: center;
	gap: 5px;
}

.kachingly-meta-links .button .dashicons,
#kachingly-load-accounts .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
	line-height: 16px;
}

/* ============================================================= */
/* iOS Widget builder (settings)                                 */
/* ============================================================= */
.kachingly-widget-builder-title {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 22px 0 4px;
	font-size: 14px;
	font-weight: 700;
	color: #1d2327;
	border-top: 1px solid #eef0f3;
	padding-top: 16px;
}
.kachingly-widget-builder-title .dashicons { color: #6d5ef7; }

.kachingly-widget-pickers {
	display: flex;
	flex-wrap: wrap;
	gap: 18px;
	margin: 10px 0 14px;
}
.kachingly-widget-pickers label {
	display: flex;
	flex-direction: column;
	gap: 5px;
}
.kachingly-widget-pickers .title {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: #646970;
}
.kachingly-widget-pickers select {
	min-width: 180px;
	border-radius: 7px;
}

/* Dark mock of the phone widget (intentionally dark — it mimics iOS) */
.kachingly-widget-preview {
	display: inline-block;
	min-width: 340px;
	max-width: 420px;
	background: linear-gradient(160deg, #1d2855, #10162e);
	border-radius: 16px;
	padding: 16px 18px;
	color: #fff;
	box-shadow: 0 8px 24px rgba(16, 22, 46, 0.25);
	margin: 4px 0 18px;
}
.kachingly-widget-preview .bwp-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}
.kachingly-widget-preview .bwp-store { font-size: 14px; font-weight: 700; }
.kachingly-widget-preview .bwp-tag { font-size: 11px; color: #9aa3b5; }
.kachingly-widget-preview .bwp-body { display: flex; }
.kachingly-widget-preview .bwp-gap { flex: 1; min-width: 18px; }
.kachingly-widget-preview .bwp-col { min-width: 150px; }
.kachingly-widget-preview .bwp-col-t {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	color: #f6c453;
	margin-bottom: 8px;
}
.kachingly-widget-preview .bwp-row {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 5px;
}
.kachingly-widget-preview .bwp-l { font-size: 11px; color: #9aa3b5; }
.kachingly-widget-preview .bwp-v { font-size: 12px; font-weight: 700; color: #fff; }
.kachingly-widget-preview .bwp-v.pos { color: #3ad07a; }
.kachingly-widget-preview .bwp-v.neg { color: #ff6b6b; }

.kachingly-widget-code-head {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 6px 0;
}
.kachingly-widget-code-head .button { display: inline-flex; align-items: center; gap: 5px; }
.kachingly-widget-code-head .dashicons { font-size: 16px; width: 16px; height: 16px; line-height: 16px; }

.kachingly-widget-code {
	width: 100%;
	max-width: 900px;
	box-sizing: border-box;
	font-family: Menlo, Consolas, monospace;
	font-size: 12px;
	line-height: 1.5;
	background: #1e2430;
	color: #e6eaf2;
	border: 1px solid #2a3550;
	border-radius: 10px;
	padding: 12px 14px;
}

/* ============================================================= */
/* Settings tabs                                                 */
/* ============================================================= */
.kachingly-tabs {
	margin: 14px 0 20px;
	display: flex;
	flex-wrap: wrap;
	gap: 2px;
	border-bottom: 1px solid var(--kachingly-line);
}

.kachingly-tabs .nav-tab {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0 2px -1px 0;
	font-size: 13px;
	font-weight: 600;
}
/* Active tab: rely on WP defaults for the text colour; add a brand bottom-bar. */
.kachingly-tabs .nav-tab.nav-tab-active {
	position: relative;
}
.kachingly-tabs .nav-tab.nav-tab-active::after {
	content: "";
	position: absolute;
	left: 0; right: 0; bottom: -1px;
	height: 2px;
	background: var(--kachingly-brand);
}

.kachingly-tabs .nav-tab .dashicons {
	font-size: 17px;
	width: 17px;
	height: 17px;
	line-height: 17px;
}

/* Panels: hidden only when JS tabs are active (graceful no-JS fallback) */
.kachingly-tabs-enabled .kachingly-tab-panel { display: none; }
.kachingly-tabs-enabled .kachingly-tab-panel.active { display: block; }

.kachingly-style-opt {
	display: inline-block;
	min-width: 130px;
	margin-bottom: 4px;
}

/* Shipping cost grids (fixed 2×2 + percentage per-segment matrix). */
.kachingly-ship-grid {
	border-collapse: collapse;
	margin: 2px 0 4px;
	max-width: 620px;
}
.kachingly-ship-grid th,
.kachingly-ship-grid td {
	padding: 6px 10px;
	text-align: left;
	border-bottom: 1px solid #eef0f3;
}
.kachingly-ship-grid thead th {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .03em;
	color: #6b7280;
	border-bottom: 1px solid #d6dae0;
	white-space: nowrap;
}
.kachingly-ship-grid tbody th {
	font-weight: 600;
	color: #1d2327;
	white-space: nowrap;
}
.kachingly-ship-grid input[type="number"] {
	width: 84px;
}
.kachingly-ship-grid-pct input[type="number"] {
	width: 72px;
}

/* Sortable report-card chooser (drag to reorder). */
.kachingly-cards-sort {
	margin: 0 0 8px;
	max-width: 360px;
}
.kachingly-card-sort-item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 7px 10px;
	margin: 0 0 6px;
	background: #fff;
	border: 1px solid #e6e8ee;
	border-radius: 7px;
}
.kachingly-card-sort-item label {
	margin: 0;
	cursor: default;
}
.kachingly-card-sort-item .kachingly-drag {
	color: #9aa1ac;
	cursor: grab;
}
.kachingly-card-sort-item .kachingly-drag:active {
	cursor: grabbing;
}
.kachingly-card-sort-placeholder {
	height: 38px;
	margin: 0 0 6px;
	border: 1px dashed #c2c7d0;
	border-radius: 7px;
	background: #f4f5f9;
}

/* ============================================================= */
/* Trend chart                                                   */
/* ============================================================= */
.kachingly-trend {
	background: #fff;
	border: 1px solid #e6e8ee;
	border-radius: 14px;
	padding: 14px 18px 10px;
	margin: 0 0 18px;
	box-shadow: 0 1px 3px rgba(24, 28, 45, 0.06);
}

.kachingly-trend-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 4px;
}

.kachingly-trend-head .kachingly-section { margin: 0; }

.kachingly-trend-legend {
	display: flex;
	gap: 16px;
	flex-wrap: wrap;
}

.kachingly-trend-key {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: #50575e;
}

.kachingly-trend-key .dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
}

.kachingly-trend .kachingly-section {
	margin: 0 0 12px;
}

/* Chart.js needs a sized, position:relative wrapper (maintainAspectRatio:false) */
.kachingly-trend-canvas-wrap {
	position: relative;
	width: 100%;
	height: 340px;
}

.kachingly-trend-svg {
	display: block;
	width: 100%;
	height: auto;
}

.kachingly-trend-scale {
	display: flex;
	justify-content: space-between;
	font-size: 11px;
	color: #8a8f98;
	font-variant-numeric: tabular-nums;
	margin-top: 2px;
}

.kachingly-trend-scale .kachingly-trend-min { color: #b32d2e; }

/* ============================================================= */
/* Card themes: .kachingly-style-{clean|colorful|dark}               */
/* (clean = base styling above; only overrides below)            */
/* ============================================================= */

/* --- Colorful: vibrant filled cards, white text --- */
.kachingly-style-colorful .kachingly-card {
	background: #2c3338;
	color: #fff;
	border-color: transparent;
}
.kachingly-style-colorful .kachingly-card::before { display: none; }
.kachingly-style-colorful .kachingly-card .label { color: rgba(255, 255, 255, 0.82); }
.kachingly-style-colorful .kachingly-card .value { color: #fff; }
.kachingly-style-colorful .kachingly-card .sub { color: rgba(255, 255, 255, 0.8); }
.kachingly-style-colorful .kachingly-card .kachingly-card-icon { color: #fff; opacity: 0.18; }
.kachingly-style-colorful .kachingly-card.spend { background: #1d2855; }
.kachingly-style-colorful .kachingly-card.sales { background: #1f7a8c; }
.kachingly-style-colorful .kachingly-card.roas { background: #4654a3; }
.kachingly-style-colorful .kachingly-card.orders { background: #2c3338; }
.kachingly-style-colorful .kachingly-card.cod { background: #9c5b34; }
.kachingly-style-colorful .kachingly-card.fpx { background: #2f5fa3; }
.kachingly-style-colorful .kachingly-card.rts { background: #ea580c; }
.kachingly-style-colorful .kachingly-card.pnl-pos { background: #2f7a3b; }
.kachingly-style-colorful .kachingly-card.pnl-neg { background: #b32d2e; }

/* --- Dark: dark cards on the light page, accent-coloured values --- */
.kachingly-style-dark .kachingly-card {
	background: #1b2233;
	color: #fff;
	border-color: #2a3550;
}
.kachingly-style-dark .kachingly-card .label { color: #8b93a7; }
.kachingly-style-dark .kachingly-card .value { color: #fff; }
.kachingly-style-dark .kachingly-card .sub { color: #8b93a7; }
.kachingly-style-dark .kachingly-card .kachingly-card-icon { color: #ffffff; opacity: 0.16; }
.kachingly-style-dark .kachingly-card.spend .value { color: #5b8cff; }
.kachingly-style-dark .kachingly-card.pnl-pos .value { color: #46c46a; }
.kachingly-style-dark .kachingly-card.pnl-neg .value { color: #ff6b6c; }
.kachingly-style-dark .kachingly-card.spend::before { background: #5b8cff; }
.kachingly-style-dark .kachingly-card.pnl-pos::before { background: #46c46a; }

/* =========================================================
   AI Optimizer
   ========================================================= */
/* Head: matches WPLM page heading (orange dashicon + orange bottom-border). */
.kachingly-opt-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 10px;
	margin: 6px 0 20px;
	padding-bottom: 14px;
	border-bottom: 2px solid var(--kachingly-brand);
}
.kachingly-opt-head h1 {
	margin: 0;
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 23px;
	font-weight: 600;
	color: var(--kachingly-ink);
	letter-spacing: -0.01em;
}
.kachingly-opt-head h1 .dashicons {
	color: var(--kachingly-brand);
	font-size: 26px;
	width: 26px;
	height: 26px;
}
.kachingly-opt-head-tools { display: flex; align-items: center; gap: 12px; }
.kachingly-opt-synced { color: var(--kachingly-muted); font-size: 13px; }
#kachingly-opt-refresh { display: inline-flex; align-items: center; gap: 6px; }
.kachingly-btn-ic { width: 15px; height: 15px; fill: currentColor; flex: 0 0 auto; }

.kachingly-opt-empty {
	background: #fff;
	border: 1px solid var(--kachingly-line);
	border-radius: var(--kachingly-radius);
	padding: 40px 20px;
	text-align: center;
	color: var(--kachingly-muted);
	box-shadow: var(--kachingly-card-shadow);
}
.kachingly-opt-empty .dashicons {
	font-size: 40px;
	width: 40px;
	height: 40px;
	color: var(--kachingly-brand);
	opacity: 0.5;
}
.kachingly-opt-empty p { margin: 10px 0 0; font-size: 15px; }

/* Score card + gauge */
.kachingly-opt-scorecard {
	display: flex;
	align-items: center;
	gap: 22px;
	background: #fff;
	border: 1px solid var(--kachingly-line);
	border-radius: var(--kachingly-radius);
	padding: 20px 24px;
	box-shadow: var(--kachingly-card-shadow);
	margin-bottom: 16px;
}
.kachingly-opt-gauge {
	--val: 0;
	flex: 0 0 auto;
	width: 96px;
	height: 96px;
	border-radius: 50%;
	background: conic-gradient(#16a34a calc(var(--val) * 1%), #e8eaed 0);
	display: flex;
	align-items: center;
	justify-content: center;
}
.kachingly-opt-gauge.na { background: conic-gradient(#c9ccd3 0, #e8eaed 0); }
.kachingly-opt-gauge-inner {
	width: 74px;
	height: 74px;
	border-radius: 50%;
	background: #fff;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	line-height: 1;
}
.kachingly-opt-score { font-size: 26px; font-weight: 800; color: #1d2327; line-height: 1; }
.kachingly-opt-score-max { font-size: 11px; color: #8b93a7; margin-top: 2px; }
.kachingly-opt-scoretext strong { font-size: 15px; display: block; margin-bottom: 4px; }
.kachingly-opt-scoretext p { margin: 0; color: #50575e; max-width: 640px; }

.kachingly-opt-roas-notice .dashicons { color: #2271b1; vertical-align: middle; margin-right: 4px; }

/* Recommendation category tabs */
.kachingly-opt-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 16px 0 14px;
	border-bottom: 1px solid var(--kachingly-line);
}
.kachingly-opt-tab {
	background: none;
	border: none;
	border-bottom: 2px solid transparent;
	padding: 8px 12px;
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
	color: var(--kachingly-muted);
}
.kachingly-opt-tab:hover { color: var(--kachingly-brand-dark); }
.kachingly-opt-tab.active {
	color: var(--kachingly-brand-dark);
	border-bottom-color: var(--kachingly-brand);
}
.kachingly-opt-tabcount { color: var(--kachingly-faint); font-weight: 400; }

/* Recommendation cards */
.kachingly-opt-cards { display: flex; flex-direction: column; gap: 12px; }
.kachingly-opt-card {
	background: #fff;
	border: 1px solid var(--kachingly-line);
	border-left: 4px solid #b0b4bd;
	border-radius: var(--kachingly-radius);
	padding: 16px 18px;
	box-shadow: var(--kachingly-card-shadow);
}
.kachingly-opt-card.cat-scale  { border-left-color: var(--kachingly-ok); }
.kachingly-opt-card.cat-reduce { border-left-color: var(--kachingly-err); }
.kachingly-opt-card.cat-new    { border-left-color: var(--kachingly-brand); }

.kachingly-opt-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kachingly-opt-card-title { font-size: 15px; font-weight: 700; color: var(--kachingly-ink); display: flex; align-items: center; gap: 6px; }
.kachingly-opt-card.cat-scale  .kachingly-opt-card-title .dashicons { color: var(--kachingly-ok); }
.kachingly-opt-card.cat-reduce .kachingly-opt-card-title .dashicons { color: var(--kachingly-err); }
.kachingly-opt-card.cat-new    .kachingly-opt-card-title .dashicons { color: var(--kachingly-brand-dark); }

.kachingly-opt-prio { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.kachingly-opt-prio.prio-high { background: #fde8e6; color: #b32d2e; }
.kachingly-opt-prio.prio-medium { background: #fff3d6; color: #8a6d1a; }
.kachingly-opt-prio.prio-low { background: #eef0f3; color: #646970; }

.kachingly-opt-card-body { margin: 10px 0 14px; color: #50575e; line-height: 1.55; }

.kachingly-opt-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.kachingly-opt-metrics { display: flex; flex-wrap: wrap; gap: 18px; }
.kachingly-opt-metric { display: flex; flex-direction: column; }
.kachingly-opt-metric-l { font-size: 11px; color: #8b93a7; text-transform: uppercase; letter-spacing: .02em; }
.kachingly-opt-metric-v { font-size: 15px; font-weight: 700; color: #1d2327; }
.kachingly-opt-metric.tone-pos .kachingly-opt-metric-v { color: #1a7f37; }
.kachingly-opt-metric.tone-neg .kachingly-opt-metric-v { color: #b32d2e; }

.kachingly-opt-actions { display: flex; gap: 8px; align-items: center; }

.kachingly-opt-foot { margin-top: 16px; }

/* Level toggle (Kempen / Ad Set / Iklan) */
.kachingly-opt-levels { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.kachingly-opt-level {
	text-decoration: none;
	padding: 6px 16px;
	border: 1px solid var(--kachingly-line);
	border-radius: 999px;
	font-size: 13px;
	font-weight: 600;
	color: var(--kachingly-muted);
	background: #fff;
}
.kachingly-opt-level:hover {
	color: var(--kachingly-brand-dark);
	border-color: var(--kachingly-brand);
	background: var(--kachingly-brand-soft);
}
.kachingly-opt-level.active {
	background: var(--kachingly-brand);
	border-color: var(--kachingly-brand-dark);
	color: #fff;
}
.kachingly-opt-levels-hint { color: var(--kachingly-faint); font-size: 12px; margin-left: 6px; }

.kachingly-opt-card-titlewrap { display: flex; flex-direction: column; gap: 2px; }
.kachingly-opt-card-parent { font-size: 12px; color: #8b93a7; padding-left: 26px; }

@media (max-width: 600px) {
	.kachingly-opt-scorecard { flex-direction: column; text-align: center; }
	.kachingly-opt-card-bottom { flex-direction: column; align-items: flex-start; }
	.kachingly-opt-levels-hint { width: 100%; margin: 4px 0 0; }
}
.kachingly-style-dark .kachingly-card.pnl-neg::before { background: #ff6b6c; }

/* ============================================================ */
/* Subscription tab — two-column layout (Neyya-style)            */
/* ============================================================ */
/* Subscription tab — themed with Kaching brand orange.
   "Yes/No" status badges keep semantic green/red. */
.kaching-sub-wrap { padding: 0 !important; }
.kaching-sub-h {
	display: flex; align-items: center; justify-content: center; gap: 8px;
	color: var(--kachingly-brand-dark); font-weight: 700; letter-spacing: 1px;
	margin: 16px 0 24px;
	font-size: 18px;
}
.kaching-sub-h .dashicons { color: var(--kachingly-brand-dark); }

.kaching-sub-grid {
	display: grid; grid-template-columns: 1fr 1.5fr; gap: 24px;
	align-items: start;
}
@media (max-width: 960px) {
	.kaching-sub-grid { grid-template-columns: 1fr; }
}

.kaching-sub-card {
	border: 1px solid var(--kachingly-line); border-radius: var(--kachingly-radius);
	background: #fff; overflow: hidden;
	margin-bottom: 16px;
	box-shadow: var(--kachingly-card-shadow);
}

.kaching-sub-plan {
	text-align: center; padding: 14px 16px;
	color: var(--kachingly-brand-dark); font-weight: 700; letter-spacing: 2px;
	border-bottom: 1px solid var(--kachingly-line-soft);
	background: var(--kachingly-brand-soft);
	font-size: 16px;
}

.kaching-sub-statustable {
	width: 100%; border-collapse: collapse;
}
.kaching-sub-statustable th,
.kaching-sub-statustable td {
	padding: 12px 16px; border-bottom: 1px solid var(--kachingly-line-soft);
	vertical-align: middle; text-align: center;
}
.kaching-sub-statustable tr:last-child th,
.kaching-sub-statustable tr:last-child td { border-bottom: 0; }
.kaching-sub-statustable th {
	width: 38%; text-align: left; font-weight: 600;
	color: var(--kachingly-muted); background: #fafafb;
	font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em;
}

/* Status badges keep semantic colours (green = active, red = inactive). */
.kaching-sub-badge {
	display: inline-block; padding: 2px 10px; border-radius: 999px;
	font-size: 12px; font-weight: 600;
}
.kaching-sub-badge.yes { background: var(--kachingly-ok-soft); color: var(--kachingly-ok); }
.kaching-sub-badge.no  { background: #fcf0f1; color: var(--kachingly-err); }

.kaching-sub-time { font-size: 13px; color: var(--kachingly-muted); }
.kaching-sub-daysleft { font-size: 12px; color: var(--kachingly-faint); margin-top: 4px; }
.kaching-sub-price { color: var(--kachingly-brand-dark); font-weight: 700; font-size: 15px; }
.kaching-sub-cycle { color: var(--kachingly-faint); font-style: italic; font-size: 12px; }

.kaching-sub-renew { padding: 20px 16px; }
.kaching-sub-renew-h {
	text-align: center; color: var(--kachingly-brand-dark);
	font-weight: 700; letter-spacing: 1.5px;
	margin-bottom: 16px;
}
.kaching-sub-cycle-select {
	width: 100%; padding: 10px 12px;
	border: 1px solid var(--kachingly-line); border-radius: 7px;
	background: #fff; font-size: 14px;
	margin-bottom: 12px;
}
/* Renew button inherits the WPLM-style orange .button-primary; only handle layout. */
.kaching-sub-renew-btn {
	width: 100%; display: flex !important; align-items: center; justify-content: center;
	gap: 6px; padding: 8px 16px !important;
	font-weight: 600; height: auto !important;
}

/* Tier selector in renew form */
.kaching-sub-tier-options {
	display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px;
}
.kaching-sub-tier-option {
	flex: 1; min-width: 70px; display: flex; flex-direction: column; align-items: center;
	gap: 2px; padding: 8px 6px; border: 2px solid var(--kachingly-line);
	border-radius: 8px; cursor: pointer; font-size: 12px; text-align: center;
	transition: border-color .15s, background .15s;
}
.kaching-sub-tier-option input[type="radio"] { display: none; }
.kaching-sub-tier-option strong { font-size: 13px; }
.kaching-sub-tier-domains {
	background: var(--kachingly-line); border-radius: 20px;
	padding: 1px 7px; font-size: 11px; color: var(--kachingly-muted);
}
.kaching-sub-tier-option:hover,
.kaching-sub-tier-selected {
	border-color: var(--kachingly-brand); background: rgba(var(--kachingly-brand-rgb, 234,88,12), .04);
}
.kaching-sub-tier-selected .kaching-sub-tier-domains {
	background: var(--kachingly-brand); color: #fff;
}

.kaching-sub-meta { text-align: center; margin-top: 12px; font-size: 12px; }
.kaching-sub-meta a { color: var(--kachingly-muted); text-decoration: none; }
.kaching-sub-meta a:hover { color: var(--kachingly-brand-dark); }

/* History table */
.kaching-sub-hist-h {
	margin: 0 0 12px; padding: 0 4px;
	color: var(--kachingly-ink); font-size: 15px; font-weight: 600;
}
.kaching-sub-hist {
	width: 100%; border-collapse: separate; border-spacing: 0;
	border: 1px solid var(--kachingly-line); border-radius: var(--kachingly-radius); overflow: hidden;
	background: #fff;
	box-shadow: var(--kachingly-card-shadow);
}
.kaching-sub-hist thead th {
	background: #fafafb; padding: 10px 12px;
	text-align: center; font-weight: 600; font-size: 11px;
	letter-spacing: 0.04em; text-transform: uppercase;
	color: var(--kachingly-muted); border-bottom: 1px solid var(--kachingly-line);
}
.kaching-sub-hist tbody td {
	padding: 14px 12px; border-bottom: 1px solid var(--kachingly-line-soft);
	vertical-align: middle; text-align: center; font-size: 13px;
	color: var(--kachingly-ink);
}
.kaching-sub-hist tbody tr:last-child td { border-bottom: 0; }
.kaching-sub-hist tbody tr:hover td { background: var(--kachingly-brand-soft); }

.kaching-sub-pkg-badge {
	display: inline-block; padding: 4px 10px; border-radius: 999px;
	background: var(--kachingly-brand-soft); color: var(--kachingly-brand-dark);
	font-size: 11px; font-weight: 600;
}
.kaching-sub-validity { line-height: 1.6; color: var(--kachingly-muted); }
.kaching-sub-payment { line-height: 1.6; color: var(--kachingly-ink); font-weight: 600; }
.kaching-sub-payment small { color: var(--kachingly-faint); font-size: 11px; font-weight: 400; }

.kaching-sub-empty { color: var(--kachingly-faint); padding: 20px !important; font-style: italic; }

.kaching-sub-activate {
	padding: 20px; background: #fff;
	border: 1px solid var(--kachingly-line); border-radius: var(--kachingly-radius);
	box-shadow: var(--kachingly-card-shadow);
}
.kaching-sub-activate h3 { margin: 0 0 8px; color: var(--kachingly-ink); }
.kaching-sub-activate form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }

.kachingly-portal-link { margin-top: 24px !important; text-align: center; color: var(--kachingly-faint); }

/* ==========================================================================
   WPLM-style overlay — page chrome, cards, tables, forms, buttons.
   Applied to all Kachingly admin screens via the body class .kachingly-admin.
   The app header (.kachingly-appbar) is untouched.
   ========================================================================== */

/* Page heading */
.kachingly-admin .wrap > h1:first-of-type {
	font-size: 23px;
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 8px;
	padding-bottom: 14px;
	margin: 6px 0 20px;
	border-bottom: 2px solid var(--kachingly-brand);
	letter-spacing: -0.01em;
	color: var(--kachingly-ink);
}
.kachingly-admin .wrap > h1:first-of-type .dashicons {
	color: var(--kachingly-brand);
	font-size: 26px;
	width: 26px;
	height: 26px;
}
.kachingly-admin .kachingly-sub {
	font-size: 14px;
	color: var(--kachingly-muted);
	font-weight: 400;
}

/* Primary button → brand orange */
.kachingly-admin .button-primary,
.kachingly-admin .wrap .button-primary {
	background: var(--kachingly-brand) !important;
	border-color: var(--kachingly-brand-dark) !important;
	color: #fff !important;
	text-shadow: none !important;
	box-shadow: 0 1px 2px rgba(249,115,22,0.3) !important;
}
.kachingly-admin .button-primary:hover,
.kachingly-admin .button-primary:focus,
.kachingly-admin .wrap .button-primary:hover,
.kachingly-admin .wrap .button-primary:focus {
	background: var(--kachingly-brand-dark) !important;
	border-color: var(--kachingly-brand-dark) !important;
}

/* Filters panel → WPLM clean card */
.kachingly-admin .kachingly-filters {
	background: #fff;
	border: 1px solid var(--kachingly-line);
	border-radius: var(--kachingly-radius);
	box-shadow: var(--kachingly-card-shadow);
}
.kachingly-admin .kachingly-filters-title .dashicons {
	background: var(--kachingly-brand);
}

/* Dashboard cards — WPLM clean look applies ONLY to the "Clean" theme.
   The "Colorful" and "Dark" themes keep their original card styling so the
   theme picker (Settings → Paparan Laporan) still works. */
.kachingly-admin .kachingly-style-clean .kachingly-card {
	background: #fff !important;
	color: var(--kachingly-ink) !important;
	border: 1px solid var(--kachingly-line);
	border-radius: var(--kachingly-radius);
	box-shadow: var(--kachingly-card-shadow);
}
.kachingly-admin .kachingly-style-clean .kachingly-card::before {
	display: none; /* drop the colored left strip on Clean */
}
.kachingly-admin .kachingly-style-clean .kachingly-card .label {
	color: var(--kachingly-muted) !important;
}
.kachingly-admin .kachingly-style-clean .kachingly-card .value {
	color: var(--kachingly-ink) !important;
}
.kachingly-admin .kachingly-style-clean .kachingly-card .sub {
	color: var(--kachingly-faint) !important;
}
.kachingly-admin .kachingly-style-clean .kachingly-card.pnl-pos .value { color: var(--kachingly-ok) !important; }
.kachingly-admin .kachingly-style-clean .kachingly-card.pnl-neg .value { color: var(--kachingly-err) !important; }
.kachingly-admin .kachingly-style-clean .kachingly-card .kachingly-card-icon {
	color: var(--kachingly-brand-dark) !important;
	opacity: 1 !important;
	top: 16px !important;
	right: 16px !important;
	transform: none !important;
	width: 22px !important;
	height: 22px !important;
}
.kachingly-admin .kachingly-style-clean .kachingly-card.pnl-pos .kachingly-card-icon { color: var(--kachingly-ok) !important; }
.kachingly-admin .kachingly-style-clean .kachingly-card.pnl-neg .kachingly-card-icon { color: var(--kachingly-err) !important; }

/* Period section heading */
.kachingly-admin .kachingly-pnl-section {
	font-size: 15px;
	font-weight: 600;
	color: var(--kachingly-ink);
	margin: 18px 0 4px;
}

/* Status pill → WPLM badge style */
.kachingly-admin .kachingly-status-pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 11px;
	font-weight: 600;
	padding: 2px 10px;
	border-radius: 999px;
	text-transform: capitalize;
}
.kachingly-admin .kachingly-status-pill.on   { color: var(--kachingly-ok);   background: var(--kachingly-ok-soft); }
.kachingly-admin .kachingly-status-pill.warn { color: var(--kachingly-warn); background: #fef9ec; }
.kachingly-admin .kachingly-status-pill.off  { color: var(--kachingly-err); background: #fcf0f1; }
.kachingly-admin .kachingly-status-pill .dot { display: none; }

/* Report table → WPLM list-table look (keep DATE column sticky horizontally) */
.kachingly-admin .kachingly-table-scroll {
	border: 1px solid var(--kachingly-line);
	border-radius: var(--kachingly-radius);
	box-shadow: var(--kachingly-card-shadow);
	background: #fff;
}
.kachingly-admin .kachingly-table {
	border: 0 !important;
	box-shadow: none !important;
	border-radius: 0 !important;
}
.kachingly-admin .kachingly-table thead th {
	background: #fafafb !important;
	color: var(--kachingly-muted) !important;
	font-size: 11px !important;
	font-weight: 600 !important;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	border-bottom: 1px solid #e0e0e2 !important;
}
.kachingly-admin .kachingly-table tbody td {
	border-bottom: 1px solid var(--kachingly-line-soft);
	color: var(--kachingly-ink);
	font-size: 13px;
}
.kachingly-admin .kachingly-table tbody tr:last-child td { border-bottom: 0; }
.kachingly-admin .kachingly-table tbody tr:hover td { background: var(--kachingly-brand-soft); }
.kachingly-admin .kachingly-table tbody tr:hover td.kachingly-date { background: var(--kachingly-brand-soft); }

/* Totals row: solid orange brand-dark with white text */
.kachingly-admin .kachingly-table tfoot tr.kachingly-totals th,
.kachingly-admin .kachingly-totals th {
	background: var(--kachingly-brand-dark) !important;
	color: #fff !important;
	border-top: 0;
}
.kachingly-admin .kachingly-totals .kachingly-tot-h {
	color: rgba(255, 255, 255, 0.8) !important;
}
.kachingly-admin .kachingly-totals .kachingly-tot-v,
.kachingly-admin .kachingly-totals .pnl-pos,
.kachingly-admin .kachingly-totals .pnl-neg {
	color: #fff !important;
}
.kachingly-admin .kachingly-totals .kachingly-pay-amt {
	color: rgba(255, 255, 255, 0.75) !important;
}

/* Settings form-table → WPLM card */
.kachingly-admin .wrap form .form-table {
	background: #fff;
	border: 1px solid var(--kachingly-line);
	border-radius: var(--kachingly-radius);
	box-shadow: var(--kachingly-card-shadow);
	border-collapse: separate;
	border-spacing: 0;
	margin-top: 12px;
	overflow: hidden;
}
.kachingly-admin .wrap form .form-table th {
	width: 200px;
	padding: 18px 16px 18px 22px;
	color: var(--kachingly-ink);
	vertical-align: top;
	border-bottom: 1px solid var(--kachingly-line-soft);
}
.kachingly-admin .wrap form .form-table td {
	padding: 16px 22px 16px 0;
	border-bottom: 1px solid var(--kachingly-line-soft);
}
.kachingly-admin .wrap form .form-table tr:last-child th,
.kachingly-admin .wrap form .form-table tr:last-child td { border-bottom: 0; }
.kachingly-admin .wrap form .form-table input[type="text"]:focus,
.kachingly-admin .wrap form .form-table input[type="email"]:focus,
.kachingly-admin .wrap form .form-table input[type="password"]:focus {
	border-color: var(--kachingly-brand);
	box-shadow: 0 0 0 1px var(--kachingly-brand);
}

/* Hi-specificity fixes — ensure brand colours win over existing rules. */
.kachingly-admin .kachingly-settings .kaching-sub-h,
.kachingly-admin .kachingly-settings .kaching-sub-h .dashicons,
.kachingly-admin .kachingly-settings .kaching-sub-plan,
.kachingly-admin .kachingly-settings .kaching-sub-renew-h {
	color: var(--kachingly-brand-dark);
}
.kachingly-admin .kachingly-settings .kaching-sub-plan {
	background: var(--kachingly-brand-soft);
}

/* ==========================================================================
   Update-available banner (FunnelKit-style alert under the app header).
   ========================================================================== */
.kachingly-update-notice {
	margin: 16px 28px 0;
	background: var(--kachingly-brand-soft);
	border: 1px solid #fed7aa;
	border-radius: var(--kachingly-radius);
	padding: 18px 22px;
	box-shadow: var(--kachingly-card-shadow);
	position: relative;
}
.kachingly-update-notice-inner {
	display: flex;
	align-items: flex-start;
	gap: 18px;
}
.kachingly-update-bell {
	flex-shrink: 0;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px solid #fed7aa;
}
.kachingly-update-bell .dashicons {
	color: var(--kachingly-brand-dark);
	font-size: 22px;
	width: 22px;
	height: 22px;
}
.kachingly-update-content {
	flex: 1;
	min-width: 0;
	padding-right: 28px; /* leave room for the dismiss × */
}
.kachingly-update-content h3 {
	margin: 0 0 4px;
	font-size: 15px;
	font-weight: 600;
	color: var(--kachingly-ink);
	line-height: 1.4;
}
.kachingly-update-content p {
	margin: 0 0 12px;
	color: var(--kachingly-muted);
	font-size: 13px;
	line-height: 1.5;
}
.kachingly-update-actions {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}
.kachingly-update-dismiss {
	position: absolute;
	top: 10px;
	right: 12px;
	font-size: 22px;
	line-height: 1;
	color: var(--kachingly-muted);
	text-decoration: none;
	padding: 4px 8px;
	border-radius: 4px;
}
.kachingly-update-dismiss:hover,
.kachingly-update-dismiss:focus {
	color: var(--kachingly-ink);
	background: rgba(0,0,0,0.04);
}

@media (max-width: 600px) {
	.kachingly-update-notice {
		margin: 12px 14px 0;
		padding: 14px 16px;
	}
	.kachingly-update-notice-inner {
		gap: 12px;
	}
	.kachingly-update-bell {
		width: 36px;
		height: 36px;
	}
}

/* ==========================================================================
   Ads Optimizer scorecard — restructured for scanability.
   ========================================================================== */
.kachingly-opt-scorecard {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 18px;
	padding: 22px 24px;
}

.kachingly-opt-scorecard-top {
	display: flex;
	align-items: center;
	gap: 22px;
}

.kachingly-opt-scoretext {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

/* Status pill (Bagus / Boleh lagi / Berhati-hati / Perlu tindakan) */
.kachingly-opt-status {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	width: fit-content;
}
.kachingly-opt-status.status-good { background: var(--kachingly-ok-soft); color: var(--kachingly-ok); }
.kachingly-opt-status.status-ok   { background: var(--kachingly-brand-soft); color: var(--kachingly-brand-dark); }
.kachingly-opt-status.status-warn { background: #fef9ec; color: var(--kachingly-warn); }
.kachingly-opt-status.status-bad  { background: #fcf0f1; color: var(--kachingly-err); }
.kachingly-opt-status.status-na   { background: var(--kachingly-line-soft); color: var(--kachingly-muted); }

.kachingly-opt-lead {
	margin: 0;
	font-size: 19px;
	font-weight: 600;
	color: var(--kachingly-ink);
	line-height: 1.35;
	letter-spacing: -0.01em;
}
.kachingly-opt-sub {
	margin: 0;
	color: var(--kachingly-muted);
	font-size: 13px;
}

/* 3-column stat grid */
.kachingly-opt-statgrid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
}
@media (max-width: 600px) {
	.kachingly-opt-statgrid { grid-template-columns: 1fr; }
}

.kachingly-opt-stat {
	display: flex;
	align-items: center;
	gap: 12px;
	background: #fff;
	border: 1px solid var(--kachingly-line);
	border-radius: var(--kachingly-radius);
	padding: 12px 14px;
}
.kachingly-opt-stat-ic {
	flex-shrink: 0;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
}
.kachingly-opt-stat-ic .dashicons { font-size: 18px; width: 18px; height: 18px; }
.kachingly-opt-stat.cat-scale  .kachingly-opt-stat-ic { background: var(--kachingly-ok-soft); }
.kachingly-opt-stat.cat-scale  .kachingly-opt-stat-ic .dashicons { color: var(--kachingly-ok); }
.kachingly-opt-stat.cat-reduce .kachingly-opt-stat-ic { background: #fcf0f1; }
.kachingly-opt-stat.cat-reduce .kachingly-opt-stat-ic .dashicons { color: var(--kachingly-err); }
.kachingly-opt-stat.cat-new    .kachingly-opt-stat-ic { background: var(--kachingly-brand-soft); }
.kachingly-opt-stat.cat-new    .kachingly-opt-stat-ic .dashicons { color: var(--kachingly-brand-dark); }

.kachingly-opt-stat-body { display: flex; flex-direction: column; line-height: 1.1; }
.kachingly-opt-stat-num   { font-size: 22px; font-weight: 700; color: var(--kachingly-ink); letter-spacing: -0.01em; }
.kachingly-opt-stat-label { font-size: 12px; color: var(--kachingly-muted); margin-top: 2px; }

/* Meta info row (thresholds) */
.kachingly-opt-scorecard-meta {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	padding-top: 14px;
	border-top: 1px solid var(--kachingly-line-soft);
	font-size: 12px;
	color: var(--kachingly-muted);
}
.kachingly-opt-meta-item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.kachingly-opt-meta-item .dashicons {
	font-size: 14px;
	width: 14px;
	height: 14px;
	color: var(--kachingly-brand-dark);
}
.kachingly-opt-meta-item strong { color: var(--kachingly-ink); }
.kachingly-opt-meta-link {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	color: var(--kachingly-brand-dark);
	font-weight: 600;
	text-decoration: none;
}
.kachingly-opt-meta-link .dashicons {
	font-size: 14px;
	width: 14px;
	height: 14px;
}
.kachingly-opt-meta-link:hover { text-decoration: underline; }

/* Disclaimer card at the foot of the Ads Optimizer page. */
.kachingly-opt-disclaimer {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	margin-top: 20px;
	padding: 16px 20px;
	background: var(--kachingly-brand-soft);
	border: 1px solid #fed7aa;
	border-radius: var(--kachingly-radius);
}
.kachingly-opt-disclaimer-ic {
	flex-shrink: 0;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px solid #fed7aa;
}
.kachingly-opt-disclaimer-ic .dashicons {
	color: var(--kachingly-brand-dark);
	font-size: 18px;
	width: 18px;
	height: 18px;
}
.kachingly-opt-disclaimer-body strong {
	display: block;
	font-size: 14px;
	color: var(--kachingly-ink);
	margin-bottom: 4px;
}
.kachingly-opt-disclaimer-body p {
	margin: 0;
	color: var(--kachingly-muted);
	font-size: 13px;
	line-height: 1.55;
}

/* ── Renewal: no-downgrade + payment-method chooser (v2.1.3) ───────────── */
.kaching-sub-tier-disabled { opacity: .45; cursor: not-allowed; filter: grayscale(1); pointer-events: none; }
.kaching-sub-downgrade-note { margin: 6px 0 0; font-size: 12px; color: #9a3412; }

.kaching-pay-options { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 10px; }
.kaching-pay-option {
	display: block; padding: 10px 12px; border: 2px solid #e5e7eb; border-radius: 8px;
	cursor: pointer; transition: border-color .15s, background .15s;
}
.kaching-pay-option input[type="radio"] { display: none; }
.kaching-pay-option:hover { border-color: #fdba74; }
.kaching-pay-option.is-selected { border-color: #f97316; background: #fff7ed; }
.kaching-pay-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kaching-pay-head strong { font-size: 13px; }
.kaching-pay-icons { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.kaching-pay-icons img { height: 22px; width: auto; max-width: 60px; object-fit: contain; display: block; }
.kaching-pay-icons img[src*="fpx.svg"] { height: 18px; max-width: 56px; }
.kaching-pay-icons img[src*="visa"], .kaching-pay-icons img[src*="mastercard"] { height: 26px; max-width: 46px; }
.kaching-pay-note { display: block; margin-top: 3px; font-size: 12px; color: #64748b; line-height: 1.4; }

/* ── Meta "Connect with Facebook" (OAuth) ─────────────────────────────── */
.kachingly-oauth-box { margin: 12px 0 18px; }
/* Facebook-brand-compliant login button: #1877F2, white "f" logo, official text. */
.kachingly-fb-btn.button,
a.kachingly-fb-btn.button {
	display: inline-flex; align-items: center; gap: 10px;
	background: #1877F2 !important; border: 1px solid #1877F2 !important; color: #fff !important;
	box-shadow: none !important; text-shadow: none !important;
	font-weight: 600; font-size: 15px; line-height: 1; height: auto;
	padding: 11px 20px; border-radius: 6px;
}
.kachingly-fb-btn.button:hover,
.kachingly-fb-btn.button:focus { background: #166FE0 !important; border-color: #166FE0 !important; color: #fff !important; }
.kachingly-fb-btn svg { width: 18px; height: 18px; flex: 0 0 auto; color: #fff; }
/* Disconnect: secondary OUTLINE style (not the official filled login button). */
.kachingly-fb-disconnect.button,
a.kachingly-fb-disconnect.button {
	display: inline-flex; align-items: center; gap: 8px;
	background: #fff !important; border: 1px solid #1877F2 !important; color: #1877F2 !important;
	box-shadow: none !important; text-shadow: none !important;
	font-weight: 600; height: auto; padding: 8px 16px; border-radius: 6px;
}
.kachingly-fb-disconnect.button:hover,
.kachingly-fb-disconnect.button:focus { background: #f0f5ff !important; border-color: #166FE0 !important; color: #166FE0 !important; }
.kachingly-fb-disconnect svg { width: 16px; height: 16px; flex: 0 0 auto; }

/* ── Guided 3-step Meta connect flow ─────────────────────────────────── */
.kachingly-meta-intro { font-size: 14px; color: #3c434a; margin: 2px 0 16px; font-weight: 600; }
.kachingly-steps { list-style: none; margin: 0 0 18px; padding: 0; max-width: 720px; }
.kachingly-step { position: relative; display: flex; gap: 14px; padding: 0 0 24px 0; }
.kachingly-step:not(:last-child)::before {
	content: ''; position: absolute; left: 17px; top: 38px; bottom: 0; width: 2px; background: #e2e5ea;
}
.kachingly-step-num {
	flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%;
	display: inline-flex; align-items: center; justify-content: center;
	font-weight: 700; font-size: 15px; background: #e2e5ea; color: #8a8f98;
	border: 2px solid #e2e5ea; z-index: 1; box-sizing: border-box;
}
.kachingly-step-main { flex: 1 1 auto; padding-top: 5px; min-width: 0; }
.kachingly-step-main h3 { margin: 0 0 6px; font-size: 15px; color: #1d2327; }
.kachingly-step-main .description { margin: 4px 0 10px; max-width: 640px; }
.kachingly-step-main textarea { margin-top: 4px; }
.kachingly-step-ok { margin: 2px 0 6px; color: #1a7f37; font-weight: 600; font-size: 14px; }
.kachingly-step.is-active .kachingly-step-num { background: #e8770f; border-color: #e8770f; color: #fff; }
.kachingly-step.is-done .kachingly-step-num { background: #1a7f37; border-color: #1a7f37; color: #fff; }
.kachingly-step.is-locked { opacity: .5; }
.kachingly-step.is-locked .kachingly-step-num { background: #f0f0f1; border-color: #e2e5ea; color: #b0b4ba; }
.kachingly-adv-token { margin: 4px 0 8px; padding: 8px 0; border-top: 1px solid #e5e7eb; }
.kachingly-adv-token > summary { cursor: pointer; color: #646970; font-size: 13px; padding: 4px 0; }
.kachingly-adv-token[open] > summary { margin-bottom: 8px; }

/* Facebook connect button — disabled (pending Meta approval) */
.kachingly-fb-btn.is-disabled {
	background: #c5c9cf !important;
	border-color: #c5c9cf !important;
	color: #fff !important;
	cursor: not-allowed;
	pointer-events: none;
	opacity: .85;
	box-shadow: none !important;
}
.kachingly-soon-badge {
	display: inline-block; margin-left: 10px; vertical-align: middle;
	font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
	color: var(--kachingly-brand-dark); background: var(--kachingly-brand-soft);
	border: 1px solid #fed7aa; padding: 3px 9px; border-radius: 999px;
}

/* On/off switch (RTS master toggle) */
.kachingly-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.kachingly-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.kachingly-switch-track {
	position: relative; flex: 0 0 auto; width: 40px; height: 22px;
	background: #c5c9cf; border-radius: 999px; transition: background .18s ease;
}
.kachingly-switch-track::before {
	content: ""; position: absolute; top: 2px; left: 2px;
	width: 18px; height: 18px; background: #fff; border-radius: 50%;
	box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .18s ease;
}
.kachingly-switch input:checked + .kachingly-switch-track { background: var(--kachingly-brand); }
.kachingly-switch input:checked + .kachingly-switch-track::before { transform: translateX(18px); }
.kachingly-switch input:focus-visible + .kachingly-switch-track { box-shadow: 0 0 0 2px var(--kachingly-brand-soft), 0 0 0 3px var(--kachingly-brand); }
.kachingly-switch-text { font-weight: 500; }

/* ==========================================================================
   Guide tab — two columns (guide left, Setup health right ~40%)
   ========================================================================== */
.kachingly-guide-grid {
	display: grid;
	grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
	gap: 28px;
	align-items: start;
}
@media (max-width: 1024px) {
	.kachingly-guide-grid { grid-template-columns: 1fr; }
}
.kachingly-guide-side { position: sticky; top: 40px; }

.kachingly-health-card {
	background: #fff;
	border: 1px solid var(--kachingly-line);
	border-radius: 12px;
	padding: 18px 20px;
	box-shadow: var(--kachingly-card-shadow);
}
.kachingly-health-head {
	display: flex; align-items: center; justify-content: space-between; gap: 10px;
	margin-bottom: 12px;
}
.kachingly-health-head h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--kachingly-ink); }
.kachingly-health-count {
	font-size: 12px; font-weight: 700; color: var(--kachingly-brand-dark);
	background: var(--kachingly-brand-soft); border: 1px solid #fed7aa;
	padding: 2px 9px; border-radius: 999px;
}
.kachingly-health-bar {
	height: 6px; border-radius: 999px; background: var(--kachingly-line-soft);
	overflow: hidden; margin-bottom: 14px;
}
.kachingly-health-bar > span { display: block; height: 100%; background: var(--kachingly-brand); border-radius: 999px; transition: width .3s ease; }
.kachingly-health-row {
	display: flex; align-items: center; gap: 11px;
	padding: 11px 0; border-bottom: 1px solid var(--kachingly-line-soft);
}
.kachingly-health-row:last-child { border-bottom: 0; }
.kachingly-health-ico { flex: 0 0 auto; width: 24px; height: 24px; font-size: 22px; border-radius: 50%; }
.kachingly-health-row.is-done .kachingly-health-ico { color: #16a34a; }
.kachingly-health-row.is-todo .kachingly-health-ico { color: var(--kachingly-brand-dark); }
.kachingly-health-label { flex: 1 1 auto; min-width: 0; font-size: 14px; color: var(--kachingly-ink); }
.kachingly-health-row.is-todo .kachingly-health-label { color: #9a6a00; font-weight: 600; }
.kachingly-health-fix {
	flex: 0 0 auto; display: inline-flex; align-items: center; gap: 2px;
	font-size: 13px; font-weight: 600; text-decoration: none; color: #2563eb;
}
.kachingly-health-fix:hover { color: #1d4ed8; }
.kachingly-health-fix .dashicons { font-size: 15px; width: 15px; height: 15px; }
.kachingly-health-allgood {
	display: flex; align-items: center; gap: 6px; margin: 14px 0 0;
	color: #1a7f37; font-weight: 600; font-size: 13.5px;
}
.kachingly-health-allgood .dashicons { color: #1a7f37; }

/* ==========================================================================
   Dashboard overview (the at-a-glance landing page)
   ========================================================================== */
.kachingly-overview .pnl-pos { color: #16a34a; }
.kachingly-overview .pnl-neg { color: #dc2626; }

.kachingly-ov-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: 8px;
}
.kachingly-ov-top h1 { display: flex; align-items: center; gap: 8px; margin: 0; }
/* If WP relocates an admin notice to just after the h1 (making it a flex child),
   force it onto its own full-width row instead of squeezing beside the title. */
.kachingly-ov-top > .notice { flex: 0 0 100%; order: 99; margin: 10px 0 0; }
.kachingly-ov-top h1 .kachingly-sub { font-size: 13px; font-weight: 400; color: var(--kachingly-muted); }
.kachingly-ov-filter {
	display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
	background: #fff; border: 1px solid var(--kachingly-line);
	border-radius: 12px; padding: 8px 10px; box-shadow: var(--kachingly-card-shadow);
}
/* Inputs / select — uniform height, soft inner control look. */
.kachingly-ov-filter .kachingly-ov-preset,
.kachingly-ov-filter input[type="date"] {
	height: 36px; box-sizing: border-box;
	border: 1px solid var(--kachingly-line); border-radius: 8px;
	background: #fff; padding: 0 10px; margin: 0;
	font-size: 13px; color: var(--kachingly-ink); line-height: 34px;
	box-shadow: none;
}
.kachingly-ov-filter .kachingly-ov-preset { min-width: 130px; }
.kachingly-ov-filter .kachingly-ov-preset:focus,
.kachingly-ov-filter input[type="date"]:focus {
	border-color: var(--kachingly-brand); box-shadow: 0 0 0 1px var(--kachingly-brand);
	outline: none;
}
/* Buttons — uniform height, icon aligned, no default WP chrome. */
.kachingly-ov-filter .button {
	height: 36px; box-sizing: border-box; margin: 0;
	display: inline-flex; align-items: center; gap: 6px;
	padding: 0 14px; border-radius: 8px; font-size: 13px; font-weight: 600;
	box-shadow: none; border: 1px solid var(--kachingly-line);
	background: #fff; color: var(--kachingly-ink); line-height: 1;
}
.kachingly-ov-filter .button .dashicons {
	font-size: 16px; width: 16px; height: 16px; line-height: 16px;
}
.kachingly-ov-filter .button:hover { background: #f6f7f7; border-color: #c5c9cf; }
/* Apply = soft brand secondary. */
.kachingly-ov-filter .kachingly-apply {
	background: var(--kachingly-brand-soft); border-color: #fed7aa; color: var(--kachingly-brand-dark);
}
.kachingly-ov-filter .kachingly-apply:hover { background: #ffedd5; border-color: #fdba74; }
/* Sync = solid brand primary. */
.kachingly-ov-filter .button-primary {
	background: var(--kachingly-brand-dark); border-color: var(--kachingly-brand-dark); color: #fff;
}
.kachingly-ov-filter .button-primary:hover:not(:disabled) { background: #c2410c; border-color: #c2410c; }
.kachingly-ov-filter .button-primary:disabled { opacity: .55; }
.kachingly-ov-filter #kachingly-syncmsg { margin: 0 4px; font-size: 12px; }
/* Inline SVG icons in toolbar buttons. */
.kachingly-ico { flex: 0 0 auto; display: inline-block; vertical-align: middle; }
.kachingly-ov-filter .button .kachingly-ico { width: 16px; height: 16px; }
/* Labelled field wrappers: layout-transparent on desktop (labels hidden), so the
   compact toolbar is unchanged; they become stacked labelled blocks on mobile. */
.kachingly-ov-fields,
.kachingly-ov-actions,
.kachingly-ov-field { display: contents; }
.kachingly-ov-field-label { display: none; }

/* ── Daily Reports + Dashboard filter: mobile compact card revamp ── */
@media (max-width: 782px) {
	.kachingly-ov-top { align-items: stretch; }
	.kachingly-ov-filter {
		display: flex;
		flex-direction: column;
		align-items: stretch;
		width: 100%;
		gap: 0;
		padding: 16px;
		border-radius: 14px;
	}
	/* Fields: compact row that wraps, each a bordered box with a notched label. */
	.kachingly-ov-filter .kachingly-ov-fields {
		display: grid;
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 12px 8px;
	}
	.kachingly-ov-filter .kachingly-ov-field {
		display: block;
		position: relative;
		min-width: 0;
	}
	.kachingly-ov-filter .kachingly-ov-field-label {
		display: block;
		position: absolute;
		top: -7px;
		left: 9px;
		z-index: 1;
		padding: 0 5px;
		background: #fff;
		font-size: 11px;
		font-weight: 600;
		line-height: 1;
		color: var(--kachingly-muted);
		pointer-events: none;
	}
	.kachingly-ov-filter .kachingly-ov-preset,
	.kachingly-ov-filter input[type="date"] {
		width: 100%;
		max-width: none;
		height: 46px;
		line-height: 44px;
		font-size: 14px;
	}
	/* Actions: compact wrapping button row, divider above. */
	.kachingly-ov-filter .kachingly-ov-actions {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 8px;
		margin-top: 14px;
		padding-top: 14px;
		border-top: 1px solid var(--kachingly-line);
	}
	.kachingly-ov-filter .kachingly-ov-actions .button,
	.kachingly-ov-filter .kachingly-ov-export .kachingly-ov-export-toggle {
		flex: 0 1 auto;
		height: 34px !important;
		min-height: 0 !important;
		line-height: 1 !important;
		padding: 0 11px !important;
		gap: 5px;
		font-size: 12.5px;
	}
	.kachingly-ov-filter .kachingly-ov-actions .button .kachingly-ico {
		width: 14px;
		height: 14px;
	}
	.kachingly-ov-filter #kachingly-syncmsg { margin: 0; }
	/* Button colours to match the mockup. */
	.kachingly-ov-filter .kachingly-apply {
		background: var(--kachingly-brand);
		border-color: var(--kachingly-brand);
		color: #fff;
	}
	.kachingly-ov-filter .kachingly-apply:hover {
		background: var(--kachingly-brand-dark);
		border-color: var(--kachingly-brand-dark);
	}
	.kachingly-ov-filter .button-primary {
		background: var(--kachingly-brand-soft);
		border-color: #fed7aa;
		color: var(--kachingly-brand-dark);
	}
	.kachingly-ov-filter .button-primary:hover:not(:disabled) {
		background: #ffedd5;
		border-color: #fdba74;
	}
}
/* Export dropdown */
.kachingly-ov-export { position: relative; display: inline-flex; }
.kachingly-ov-export .kachingly-ov-caret { font-size: 14px !important; width: 14px; height: 14px; margin-left: -2px; transition: transform .15s ease; }
.kachingly-ov-export.is-open .kachingly-ov-caret { transform: rotate( 180deg ); }
.kachingly-ov-export-menu {
	position: absolute; top: calc( 100% + 6px ); right: 0; z-index: 50;
	min-width: 180px; padding: 6px;
	background: #fff; border: 1px solid var(--kachingly-line); border-radius: 10px;
	box-shadow: 0 8px 24px rgba(0,0,0,.12);
	display: flex; flex-direction: column; gap: 2px;
}
.kachingly-ov-export-menu[hidden] { display: none; }
.kachingly-ov-export-item {
	display: flex; align-items: center; gap: 8px;
	width: 100%; box-sizing: border-box; text-align: left;
	padding: 9px 10px; border: 0; border-radius: 7px; cursor: pointer;
	background: transparent; color: var(--kachingly-ink); font-size: 13px; font-weight: 500;
	text-decoration: none; line-height: 1.2;
}
.kachingly-ov-export-item:hover { background: var(--kachingly-brand-soft); color: var(--kachingly-brand-dark); }
.kachingly-ov-export-item .dashicons { font-size: 17px; width: 17px; height: 17px; color: var(--kachingly-brand-dark); }
.kachingly-ov-lastsync { color: var(--kachingly-faint); font-size: 12px; margin: 8px 2px 16px; }

.kachingly-ov-row { display: grid; gap: 18px; margin-bottom: 18px; }
.kachingly-ov-row-hero { grid-template-columns: 1.7fr 1fr; }
.kachingly-ov-row-bottom { grid-template-columns: 1.7fr 1fr; }
@media ( max-width: 1100px ) {
	.kachingly-ov-row-hero, .kachingly-ov-row-bottom { grid-template-columns: 1fr; }
}

.kachingly-ov-card {
	background: #fff;
	border: 1px solid var(--kachingly-line);
	border-radius: var(--kachingly-radius);
	box-shadow: var(--kachingly-card-shadow);
	padding: 20px 22px;
	box-sizing: border-box;
}
.kachingly-ov-eyebrow {
	display: flex; align-items: center; gap: 6px;
	font-size: 12px; font-weight: 700; letter-spacing: .06em;
	color: var(--kachingly-brand-dark); text-transform: uppercase; margin-bottom: 6px;
}
.kachingly-ov-eyebrow .dashicons { font-size: 16px; width: 16px; height: 16px; }

/* Profit Pulse hero */
.kachingly-ov-pulse {
	background: linear-gradient( 135deg, #fff 60%, #fff7ed 100% );
}
.kachingly-ov-pulse-main { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.kachingly-ov-pulse-num { font-size: 56px; line-height: 1.05; font-weight: 800; letter-spacing: -.02em; }
.kachingly-ov-spark { width: 46%; max-width: 320px; height: 70px; }
.kachingly-ov-spark canvas { width: 100% !important; height: 100% !important; }
.kachingly-ov-pulse-label { color: var(--kachingly-muted); font-size: 14px; margin-top: 2px; }
/* Profit Pulse figure: smaller on phones so it doesn't dominate the card. */
@media (max-width: 600px) {
	.kachingly-ov-pulse-num { font-size: 34px; }
}
/* No left/right page scroll on mobile: clip stray overflow (e.g. wide admin
   notices) and constrain notices. Scoped to Kachingly admin pages. */
@media (max-width: 782px) {
	.kachingly-admin #wpcontent,
	.kachingly-admin #wpbody-content { max-width: 100%; overflow-x: hidden; }
	.kachingly-admin #wpbody-content .notice { max-width: 100%; box-sizing: border-box; }
}
.kachingly-ov-badge {
	display: inline-flex; align-items: center; gap: 6px;
	margin: 12px 0 6px; padding: 6px 12px; border-radius: 999px;
	font-size: 13px; font-weight: 600;
}
.kachingly-ov-badge .dashicons { font-size: 15px; width: 15px; height: 15px; }
.kachingly-ov-badge.good { background: #edfaef; color: #1a7f37; }
.kachingly-ov-badge.warn { background: #fff3cd; color: #8a6400; }
.kachingly-ov-badge.bad  { background: #fde8e8; color: #b32d2e; }
.kachingly-ov-pulse-summary { color: var(--kachingly-muted); font-size: 13.5px; margin-bottom: 16px; }
.kachingly-ov-ministrip {
	display: grid; grid-template-columns: repeat( 6, 1fr );
	gap: 0; border-top: 1px solid var(--kachingly-line-soft); padding-top: 14px;
}
@media ( max-width: 782px ) { .kachingly-ov-ministrip { grid-template-columns: repeat( 3, 1fr ); row-gap: 14px; } }
.kachingly-ov-mini { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; border-left: 1px solid var(--kachingly-line-soft); }
.kachingly-ov-mini:first-child { border-left: 0; padding-left: 0; }
.kachingly-ov-mini-label { font-size: 11px; color: var(--kachingly-faint); text-transform: uppercase; letter-spacing: .03em; }
.kachingly-ov-mini-val { font-size: 18px; font-weight: 700; color: var(--kachingly-ink); }
.kachingly-ov-mini-sub { font-size: 11.5px; color: var(--kachingly-muted); }

/* Business Health */
.kachingly-ov-health { display: flex; flex-direction: column; }
.kachingly-ov-gauge-wrap { display: flex; justify-content: center; margin: 6px 0 16px; }
.kachingly-ov-gauge {
	width: 150px; height: 150px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
}
.kachingly-ov-gauge-hole {
	width: 112px; height: 112px; border-radius: 50%; background: #fff;
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	box-shadow: inset 0 0 0 1px var(--kachingly-line-soft);
}
.kachingly-ov-gauge-score { font-size: 40px; font-weight: 800; line-height: 1; }
.kachingly-ov-gauge-max { font-size: 12px; color: var(--kachingly-faint); }
.kachingly-ov-factors { display: flex; flex-direction: column; gap: 8px; }
.kachingly-ov-factor {
	display: flex; align-items: center; gap: 10px;
	padding: 8px 10px; border-radius: 8px; background: #fafafa;
}
.kachingly-ov-factor-ico { flex: 0 0 auto; font-size: 18px; width: 18px; height: 18px; }
.kachingly-ov-factor.is-good .kachingly-ov-factor-ico { color: #1a7f37; }
.kachingly-ov-factor.is-warn .kachingly-ov-factor-ico { color: #bd8600; }
.kachingly-ov-factor.is-bad  .kachingly-ov-factor-ico { color: #b32d2e; }
.kachingly-ov-factor-body { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.kachingly-ov-factor-label { font-weight: 600; font-size: 13.5px; color: var(--kachingly-ink); }
.kachingly-ov-factor-detail { font-size: 12px; color: var(--kachingly-muted); }
.kachingly-ov-factor-note { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.kachingly-ov-factor.is-good .kachingly-ov-factor-note { color: #1a7f37; }
.kachingly-ov-factor.is-warn .kachingly-ov-factor-note { color: #bd8600; }
.kachingly-ov-factor.is-bad  .kachingly-ov-factor-note { color: #b32d2e; }
.kachingly-ov-howto { margin-top: 12px; }
.kachingly-ov-howto > summary { cursor: pointer; color: var(--kachingly-muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.kachingly-ov-howto ul { margin: 8px 0 0 6px; color: var(--kachingly-muted); font-size: 12.5px; list-style: disc; padding-left: 18px; }

/* Kachingly Says */
.kachingly-ov-says {
	display: flex; gap: 16px; align-items: flex-start;
	background: linear-gradient( 135deg, #fff7ed, #ffedd5 );
	border: 1px solid #fed7aa; border-radius: var(--kachingly-radius);
	padding: 18px 22px; margin-bottom: 18px;
}
.kachingly-ov-says-avatar {
	flex: 0 0 auto; align-self: flex-end; display: flex; align-items: flex-end;
}
.kachingly-ov-says-avatar img { width: auto; height: 84px; object-fit: contain; display: block; filter: drop-shadow(0 2px 4px rgba(0,0,0,.12)); }
.kachingly-ov-says-head { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--kachingly-brand-dark); display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.kachingly-ov-says-head .dashicons { font-size: 15px; width: 15px; height: 15px; }
.kachingly-ov-says-headline { font-size: 16px; font-weight: 700; color: var(--kachingly-ink); margin: 0 0 4px; }
.kachingly-ov-says-line { font-size: 13.5px; color: #7c4a13; margin: 2px 0; }

/* Metric cards */
.kachingly-ov-metrics { display: grid; grid-template-columns: repeat( 6, 1fr ); gap: 14px; margin-bottom: 18px; }
@media ( max-width: 1100px ) { .kachingly-ov-metrics { grid-template-columns: repeat( 3, 1fr ); } }
@media ( max-width: 600px ) { .kachingly-ov-metrics { grid-template-columns: repeat( 2, 1fr ); } }
.kachingly-ov-metric {
	background: #fff; border: 1px solid var(--kachingly-line); border-radius: var(--kachingly-radius);
	box-shadow: var(--kachingly-card-shadow); padding: 14px 16px;
	display: flex; flex-direction: column; gap: 2px; position: relative;
}
.kachingly-ov-metric-ico { position: absolute; top: 14px; right: 14px; color: var(--kachingly-brand-dark); font-size: 18px; width: 18px; height: 18px; opacity: 1; }
.kachingly-ov-metric-label { font-size: 11px; color: var(--kachingly-faint); text-transform: uppercase; letter-spacing: .03em; }
.kachingly-ov-metric-val { font-size: 22px; font-weight: 800; color: var(--kachingly-ink); }
.kachingly-ov-metric-sub { font-size: 11.5px; color: var(--kachingly-muted); }
.kachingly-ov-delta { font-size: 11.5px; font-weight: 600; margin-top: 2px; }
.kachingly-ov-delta.is-up { color: #16a34a; }
.kachingly-ov-delta.is-down { color: #dc2626; }
.kachingly-ov-delta.is-flat { color: var(--kachingly-faint); }

/* Net Profit Timeline + At a glance */
.kachingly-ov-card-head { font-size: 12px; font-weight: 700; letter-spacing: .05em; color: var(--kachingly-ink); text-transform: uppercase; margin-bottom: 14px; }
.kachingly-ov-timeline-canvas { height: 280px; }
.kachingly-ov-timeline-canvas canvas { width: 100% !important; height: 100% !important; }
.kachingly-ov-glance-row {
	display: flex; align-items: center; gap: 12px;
	padding: 12px 0; border-bottom: 1px solid var(--kachingly-line-soft);
}
.kachingly-ov-glance-row:last-of-type { border-bottom: 0; }
.kachingly-ov-glance-ico {
	flex: 0 0 auto; width: 34px; height: 34px; border-radius: 8px;
	background: var(--kachingly-brand-soft); color: var(--kachingly-brand-dark);
	display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.kachingly-ov-glance-label { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.kachingly-ov-glance-label strong { font-size: 13px; color: var(--kachingly-ink); }
.kachingly-ov-glance-date { font-size: 12px; color: var(--kachingly-muted); }
.kachingly-ov-glance-val { display: flex; flex-direction: column; align-items: flex-end; font-weight: 700; font-size: 14px; }
.kachingly-ov-glance-sub { font-size: 11.5px; font-weight: 500; color: var(--kachingly-muted); }
.kachingly-ov-glance-more { margin-top: 14px; width: 100%; text-align: center; justify-content: center; display: inline-flex; align-items: center; gap: 4px; }
.kachingly-ov-glance-more .dashicons { font-size: 16px; width: 16px; height: 16px; }

/* ==========================================================================
   Ads Optimizer — full redesign (v2.3.0)
   ========================================================================== */

/* Gauge column: score + "Skor Keseluruhan" label + help toggle */
.kachingly-opt-gaugewrap { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 0 0 auto; }
.kachingly-opt-gauge-label {
	display: inline-flex; align-items: center; gap: 4px;
	font-size: 13px; font-weight: 600; color: var(--kachingly-ink);
}
.kachingly-opt-info { font-size: 15px; width: 15px; height: 15px; color: var(--kachingly-faint); cursor: help; }
.kachingly-opt-scorehelp-toggle {
	background: none; border: none; cursor: pointer; padding: 0;
	color: var(--kachingly-brand-dark); font-size: 12px; font-weight: 600;
	display: inline-flex; align-items: center; gap: 2px;
}
.kachingly-opt-scorehelp-toggle .dashicons { font-size: 14px; width: 14px; height: 14px; transition: transform .15s; }
.kachingly-opt-scorehelp-toggle[aria-expanded="true"] .dashicons { transform: rotate(90deg); }
.kachingly-opt-scorehelp {
	background: var(--kachingly-line-soft); border: 1px solid var(--kachingly-line);
	border-radius: var(--kachingly-radius); padding: 12px 16px; margin-top: -4px;
}
.kachingly-opt-scorehelp p { margin: 0; font-size: 13px; color: var(--kachingly-muted); line-height: 1.6; }

/* Action summary (4-card grid) lives in the right column of the scorecard */
.kachingly-opt-actsummary { margin-top: 6px; }
.kachingly-opt-actsummary-h { display: block; font-size: 13px; font-weight: 600; color: var(--kachingly-ink); margin-bottom: 8px; }
.kachingly-opt-actsummary .kachingly-opt-statgrid { grid-template-columns: repeat(4, 1fr); }
.kachingly-opt-stat.cat-monitor .kachingly-opt-stat-ic { background: #e7eefe; }
.kachingly-opt-stat.cat-monitor .kachingly-opt-stat-ic .dashicons { color: #3b82f6; }

/* Risk pill (shared: overall + per-card) */
.kachingly-opt-risk { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.kachingly-opt-risk.risk-low    { background: var(--kachingly-ok-soft); color: var(--kachingly-ok); }
.kachingly-opt-risk.risk-medium { background: #fef9ec; color: var(--kachingly-warn); }
.kachingly-opt-risk.risk-high   { background: #fcf0f1; color: var(--kachingly-err); }
.kachingly-opt-meta-item .dashicons.dashicons-shield { color: var(--kachingly-ok); }

/* Level selector cards + "how it works" panel */
.kachingly-opt-levelrow { display: flex; gap: 14px; align-items: stretch; margin: 0 0 16px; flex-wrap: wrap; }
.kachingly-opt-levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; flex: 1 1 480px; margin: 0; }
.kachingly-opt-level {
	display: flex; align-items: center; gap: 10px;
	text-decoration: none; padding: 12px 14px;
	border: 1px solid var(--kachingly-line); border-radius: var(--kachingly-radius);
	background: #fff; color: var(--kachingly-ink);
}
.kachingly-opt-level:hover { border-color: var(--kachingly-brand); background: var(--kachingly-brand-soft); }
.kachingly-opt-level.active { border-color: var(--kachingly-brand); background: var(--kachingly-brand-soft); box-shadow: inset 0 0 0 1px var(--kachingly-brand); color: var(--kachingly-brand-dark); }
.kachingly-opt-level.active .kachingly-opt-level-txt strong { color: var(--kachingly-brand-dark); }
.kachingly-opt-level-ic { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 9px; background: var(--kachingly-line-soft); display: flex; align-items: center; justify-content: center; }
.kachingly-opt-level.active .kachingly-opt-level-ic { background: #fff; }
.kachingly-opt-level-ic .dashicons { font-size: 18px; width: 18px; height: 18px; color: var(--kachingly-brand-dark); }
.kachingly-opt-level-txt { display: flex; flex-direction: column; line-height: 1.25; }
.kachingly-opt-level-txt strong { font-size: 14px; font-weight: 700; }
.kachingly-opt-level-txt small { font-size: 11.5px; color: var(--kachingly-muted); }

.kachingly-opt-howto {
	display: flex; align-items: center; gap: 12px; flex: 1 1 320px;
	padding: 12px 16px; border: 1px solid #dbeafe; border-radius: var(--kachingly-radius);
	background: linear-gradient(180deg, #f5f8ff, #eef4ff);
}
.kachingly-opt-howto-body strong { display: block; font-size: 13px; color: var(--kachingly-ink); margin-bottom: 2px; }
.kachingly-opt-howto-body p { margin: 0; font-size: 12px; color: #4b5563; line-height: 1.5; }
.kachingly-opt-howto-bot { flex: 0 0 auto; margin-left: auto; }

/* Filter bar: tabs + dropdown filters */
.kachingly-opt-filterbar {
	display: flex; align-items: center; justify-content: space-between; gap: 14px;
	flex-wrap: wrap; margin: 16px 0 6px;
}
.kachingly-opt-filterbar .kachingly-opt-tabs { margin: 0; border-bottom: none; }
.kachingly-opt-dropfilters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kachingly-opt-dropfilters select {
	height: 34px; min-width: 130px; width: auto; padding: 0 28px 0 10px;
	border: 1px solid var(--kachingly-line); border-radius: 8px; background-color: #fff;
	font-size: 12.5px; color: var(--kachingly-ink); cursor: pointer;
}
.kachingly-opt-clearfilter {
	background: none; border: none; cursor: pointer; color: var(--kachingly-muted);
	font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px;
}
.kachingly-opt-clearfilter:hover { color: var(--kachingly-brand-dark); }
.kachingly-opt-clearfilter .dashicons { font-size: 14px; width: 14px; height: 14px; }

/* Priority-queue header */
.kachingly-opt-queuehead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 14px 0 12px; }
.kachingly-opt-queuehead-title { font-size: 15px; font-weight: 700; color: var(--kachingly-ink); display: inline-flex; align-items: center; gap: 6px; }
.kachingly-opt-queuehead-title .dashicons { color: #d97706; }
.kachingly-opt-queuehead-title em { font-style: normal; font-weight: 400; color: var(--kachingly-muted); font-size: 13px; }
.kachingly-opt-queuehead-sub { font-size: 12px; color: var(--kachingly-faint); }

/* Recommendation card — 4-region layout (rail | main | why | actions) */
.kachingly-opt-card {
	display: grid;
	grid-template-columns: 146px minmax(0, 1.5fr) minmax(0, 1.15fr) 196px;
	gap: 20px; align-items: start;
	border-left: 4px solid #b0b4bd;
}
.kachingly-opt-card.cat-monitor { border-left-color: #3b82f6; }

.kachingly-opt-card-rail { display: flex; flex-direction: column; gap: 12px; }
.kachingly-opt-card-cat { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--kachingly-ink); }
.kachingly-opt-card.cat-scale   .kachingly-opt-card-cat .dashicons { color: var(--kachingly-ok); }
.kachingly-opt-card.cat-reduce  .kachingly-opt-card-cat .dashicons { color: var(--kachingly-err); }
.kachingly-opt-card.cat-new     .kachingly-opt-card-cat .dashicons { color: var(--kachingly-brand-dark); }
.kachingly-opt-card.cat-monitor .kachingly-opt-card-cat .dashicons { color: #3b82f6; }

.kachingly-opt-conf { display: flex; flex-direction: column; gap: 1px; }
.kachingly-opt-stars { display: inline-flex; }
.kachingly-opt-stars .dashicons { font-size: 15px; width: 15px; height: 15px; color: #d1d5db; }
.kachingly-opt-stars .dashicons-star-filled { color: #16a34a; }
.kachingly-opt-stars.conf-medium .dashicons-star-filled { color: #d97706; }
.kachingly-opt-stars.conf-low .dashicons-star-filled { color: #9ca3af; }
.kachingly-opt-conf-label { font-size: 13px; font-weight: 700; color: var(--kachingly-ink); }
.kachingly-opt-conf small { font-size: 11px; color: var(--kachingly-faint); }

.kachingly-opt-card-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.kachingly-opt-card-head { display: flex; flex-direction: column; gap: 2px; }
.kachingly-opt-card-head .kachingly-opt-card-title { font-size: 15px; font-weight: 700; color: var(--kachingly-ink); }
.kachingly-opt-card-head .kachingly-opt-card-parent { font-size: 12px; color: var(--kachingly-brand-dark); padding: 0; }
.kachingly-opt-metric-sub { font-size: 11px; color: var(--kachingly-faint); margin-top: 1px; }
.kachingly-opt-trend { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; margin-left: 4px; }
.kachingly-opt-trend .dashicons { font-size: 12px; width: 12px; height: 12px; }
.kachingly-opt-trend.trend-up { color: var(--kachingly-ok); }
.kachingly-opt-trend.trend-down { color: var(--kachingly-err); }
.kachingly-opt-card-foot { display: flex; align-items: center; gap: 8px; }
.kachingly-opt-riskline { font-size: 12px; color: var(--kachingly-muted); display: inline-flex; align-items: center; gap: 6px; }

.kachingly-opt-why { background: var(--kachingly-line-soft); border-radius: 10px; padding: 12px 14px; }
.kachingly-opt-why strong { display: block; font-size: 12px; color: var(--kachingly-ink); margin-bottom: 6px; }
.kachingly-opt-reasons { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 5px; }
.kachingly-opt-reasons li { display: flex; align-items: flex-start; gap: 6px; font-size: 12.5px; color: #4b5563; line-height: 1.45; }
.kachingly-opt-reasons .dashicons { color: var(--kachingly-ok); font-size: 15px; width: 15px; height: 15px; flex: 0 0 auto; margin-top: 1px; }

.kachingly-opt-card-actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.kachingly-opt-card-actions .kachingly-opt-prio { align-self: flex-end; }
.kachingly-opt-card-actions .button { justify-content: center; text-align: center; display: inline-flex; align-items: center; gap: 5px; }
.kachingly-opt-card-actions .button .dashicons { font-size: 15px; width: 15px; height: 15px; line-height: 15px; font-style: normal; vertical-align: middle; }
.kachingly-opt-card-actions .button-link.kachingly-opt-dismiss { color: var(--kachingly-faint); text-align: center; padding: 2px; }
.kachingly-opt-card-actions .button-link.kachingly-opt-dismiss:hover { color: var(--kachingly-err); }

/* Pro tip footer */
.kachingly-opt-protip {
	display: flex; align-items: center; gap: 14px; margin-top: 18px;
	padding: 14px 20px; border: 1px solid #dbeafe; border-radius: var(--kachingly-radius);
	background: linear-gradient(180deg, #f5f8ff, #eef4ff);
}
.kachingly-opt-protip-ic { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; background: #dbeafe; display: flex; align-items: center; justify-content: center; }
.kachingly-opt-protip-ic .dashicons { color: #2563eb; font-size: 18px; width: 18px; height: 18px; }
.kachingly-opt-protip-body strong { display: block; font-size: 13px; color: var(--kachingly-ink); margin-bottom: 2px; }
.kachingly-opt-protip-body p { margin: 0; font-size: 12.5px; color: #4b5563; line-height: 1.5; }

/* Responsive */
@media (max-width: 1100px) {
	.kachingly-opt-card { grid-template-columns: 140px minmax(0, 1fr) 190px; }
	.kachingly-opt-why { grid-column: 1 / -1; }
}
@media (max-width: 782px) {
	.kachingly-opt-scorecard-top { flex-direction: column; align-items: stretch; }
	.kachingly-opt-actsummary .kachingly-opt-statgrid { grid-template-columns: repeat(2, 1fr); }
	.kachingly-opt-levels { grid-template-columns: 1fr; }
	.kachingly-opt-filterbar { align-items: flex-start; }
}
@media (max-width: 640px) {
	.kachingly-opt-card { grid-template-columns: 1fr; }
	.kachingly-opt-card-rail { flex-direction: row; align-items: center; justify-content: space-between; }
	.kachingly-opt-card-actions { align-items: stretch; }
	.kachingly-opt-card-actions .kachingly-opt-prio { align-self: flex-start; }
	.kachingly-opt-actsummary .kachingly-opt-statgrid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Settings tabs — mobile (phone) layout fixes
   ========================================================================== */
@media (max-width: 782px) {
	/* RTS on/off switch: contain the visually-hidden checkbox and let the long
	   label sit beside the track and wrap, never overlapping it. WP core's mobile
	   admin CSS inflates bare checkboxes — re-assert the hidden reset here. */
	.kachingly-settings .kachingly-switch {
		/* WP core's `.form-table td > label:first-child{display:inline-block}`
		   (0,2,2) outranks our selector, killing the flex layout and letting the
		   track overlap the label — force flex past it. */
		display: flex !important;
		position: relative;
		align-items: center;
		flex-wrap: nowrap;
		gap: 10px;
	}
	/* Card content inset: WP zeroes th/td side padding on mobile, leaving every
	   card's content flush against its border. Restore a consistent inset so
	   headings, toggles, inputs and descriptions all align inside the card. */
	.kachingly-settings .kachingly-settings-card > .form-table > tbody > tr > th,
	.kachingly-settings .kachingly-settings-card > .form-table > tbody > tr > td {
		padding-left: 14px;
		padding-right: 14px;
	}
	.kachingly-settings .kachingly-switch input[type="checkbox"] {
		position: absolute;
		width: 1px;
		height: 1px;
		min-width: 0;
		margin: 0;
		padding: 0;
		opacity: 0;
		pointer-events: none;
	}
	.kachingly-settings .kachingly-switch-track { flex: 0 0 40px; }
	.kachingly-settings .kachingly-switch-text { min-width: 0; flex: 1 1 auto; }
}

@media (max-width: 600px) {
	/* Tab bar: tidy 2-column grid so all tabs stay visible and equal-width
	   instead of a ragged multi-row wrap. */
	.kachingly-settings .kachingly-tabs {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 6px;
		border-bottom: 0;
	}
	.kachingly-settings .kachingly-tabs .nav-tab {
		margin: 0;
		justify-content: center;
		text-align: center;
		border: 1px solid var(--kachingly-line);
		border-radius: 8px;
	}
	/* Active tab: full brand outline reads better than the bottom bar in a grid. */
	.kachingly-settings .kachingly-tabs .nav-tab.nav-tab-active {
		border-color: var(--kachingly-brand);
		box-shadow: inset 0 0 0 1px var(--kachingly-brand);
	}
	.kachingly-settings .kachingly-tabs .nav-tab.nav-tab-active::after { display: none; }

	/* Shipping grids: stack each region/segment into a labelled card so the
	   column headers don't orphan and every input shows which column it is. */
	.kachingly-ship-grid { max-width: none; width: 100%; }
	.kachingly-ship-grid thead { display: none; }
	.kachingly-ship-grid tbody,
	.kachingly-ship-grid tbody tr,
	.kachingly-ship-grid tbody th,
	.kachingly-ship-grid tbody td { display: block; }
	.kachingly-ship-grid tbody tr {
		border: 1px solid #e6e8ee;
		border-radius: 8px;
		padding: 8px 10px;
		margin: 0 0 10px;
	}
	.kachingly-ship-grid tbody th {
		border: 0;
		border-bottom: 1px solid #eef0f3;
		padding: 0 0 6px;
		margin: 0 0 8px;
		font-size: 13px;
		white-space: normal;
	}
	.kachingly-ship-grid tbody td {
		border: 0;
		padding: 4px 0;
		display: flex;
		align-items: center;
		gap: 10px;
	}
	.kachingly-ship-grid tbody td::before {
		flex: 0 0 8.5em;
		font-size: 11px;
		font-weight: 600;
		color: #6b7280;
		text-transform: uppercase;
		letter-spacing: .03em;
	}
	/* Column labels (mirror the thead headers, hidden on mobile). */
	.kachingly-ship-grid:not(.kachingly-ship-grid-pct) tbody td:nth-of-type(1)::before { content: "COD"; }
	.kachingly-ship-grid:not(.kachingly-ship-grid-pct) tbody td:nth-of-type(2)::before { content: "Paid Order"; }
	.kachingly-ship-grid-pct tbody td:nth-of-type(1)::before { content: "Base (RM)"; }
	.kachingly-ship-grid-pct tbody td:nth-of-type(2)::before { content: "Bila order \2264"; }
	.kachingly-ship-grid-pct tbody td:nth-of-type(3)::before { content: "% kecil"; }
	.kachingly-ship-grid-pct tbody td:nth-of-type(4)::before { content: "% besar"; }
	.kachingly-ship-grid input[type="number"],
	.kachingly-ship-grid-pct input[type="number"] {
		width: 100%;
		max-width: 140px;
	}
}

/* Panduan: full-setup playlist CTA card (Guide tab) */
.kachingly-playlist-card{margin-top:20px;text-align:center;background:linear-gradient(135deg,#fff7ed,#ffe8d4);border:1px solid #fed7aa;border-radius:12px;padding:20px 18px;box-shadow:var(--kachingly-card-shadow);}
.kachingly-playlist-ic{display:inline-flex;align-items:center;justify-content:center;width:46px;height:46px;border-radius:50%;background:linear-gradient(135deg,var(--kachingly-brand),var(--kachingly-brand-dark));color:#fff;margin-bottom:10px;box-shadow:0 6px 14px rgba(249,115,22,.35);}
.kachingly-playlist-ic .dashicons{font-size:24px;width:24px;height:24px;}
.kachingly-playlist-card h3{margin:0 0 6px;font-size:15px;font-weight:700;color:var(--kachingly-brand-dark);}
.kachingly-playlist-card p{margin:0 0 14px;font-size:13px;line-height:1.5;color:var(--kachingly-muted);}
.kachingly-playlist-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;width:100%;box-sizing:border-box;padding:11px 16px;font-size:13.5px;font-weight:700;color:#fff !important;text-decoration:none !important;background:linear-gradient(135deg,var(--kachingly-brand),var(--kachingly-brand-dark));border:none;border-radius:9px;box-shadow:0 3px 10px rgba(249,115,22,.32);transition:transform .12s ease,box-shadow .15s ease;}
.kachingly-playlist-btn:hover{color:#fff !important;transform:translateY(-1px);box-shadow:0 5px 16px rgba(249,115,22,.45);}
.kachingly-playlist-btn .dashicons{font-size:17px;width:17px;height:17px;}
