/*
 * Command Center Identity — front-end styles.
 *
 * Mobile first, and everything is bounded so it survives the 320px case that
 * this site's audit found repeatedly. Two rules learned here the hard way:
 *  - any table or wide block scrolls inside its own container, never the page;
 *  - min-width beats overflow, so the overflow lives on the WRAPPER.
 */

/*
 * Design tokens.
 *
 * `.kcci-modal` MUST be in this list. The modal is appended to document.body,
 * so it is NOT a descendant of .kcci-entry — without its own declaration every
 * var() inside it resolves to nothing, and `background: var(--kcci-bg)` becomes
 * transparent while text falls back to the theme's colour. On this site that
 * theme colour is white, which produced a white card heading and white input
 * text on a white field: an invisible modal that looked like a dead button.
 */
.kcci-shell,
.kcci-entry,
.kcci-actions,
.kcci-modal {
	--kcci-ink: #14202b;
	--kcci-muted: #5a6b7a;
	--kcci-line: #dce3ea;
	--kcci-bg: #ffffff;
	--kcci-soft: #f4f7fa;
	--kcci-accent: #b3311f;
	--kcci-accent-ink: #ffffff;
	--kcci-ok: #17694a;
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: var(--kcci-ink);
}

.kcci-shell *,
.kcci-entry *,
.kcci-actions *,
.kcci-modal * { box-sizing: border-box; }

/*
 * Headings and form text are set EXPLICITLY, not left to inherit.
 *
 * Inheritance loses to any direct theme rule, and this theme ships a plain
 * `h2 { color: #fff }`. That beat the inherited ink token and made both
 * entrance tiles' headings white on a #f4f7fa tile. Specificity here is
 * deliberately high enough to win without !important where possible; the
 * heading rules carry it because the theme's kit stylesheet loads after ours
 * (see kcpsr_elementor_kit_h2_specificity).
 */
.kcci-entry .kcci-entry-copy h2,
.kcci-entry h2,
.kcci-actions h2 {
	color: var(--kcci-ink) !important;
}

.kcci-modal .kcci-modal-card h3,
.kcci-modal h3 {
	color: var(--kcci-ink) !important;
}

.kcci-modal .kcci-form label {
	color: var(--kcci-ink) !important;
}

/* ---------- entrance ---------- */

.kcci-entry {
	max-width: 1100px;
	margin: 28px auto;
	padding: 0 16px;
}

.kcci-entry-inner {
	background: var(--kcci-soft);
	border: 1px solid var(--kcci-line);
	border-radius: 14px;
	padding: 22px 18px;
}

.kcci-entry h2 {
	margin: 0 0 8px;
	font-size: clamp(1.25rem, 4vw, 1.6rem);
	line-height: 1.2;
}

.kcci-entry p { margin: 0 0 14px; color: var(--kcci-muted); line-height: 1.5; }
.kcci-entry-note { font-size: 0.86rem; margin: 12px 0 0; }

.kcci-entry-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

/*
 * The entrance button before its script has initialised.
 *
 * Opacity and cursor ONLY — no size, border, padding or font change — so
 * releasing the busy state cannot move anything on the page. A click here is
 * still caught and replayed by the inline shim, so this is an honest hint that
 * it is not quite ready rather than a barrier.
 */
.kcci-btn[aria-busy="true"] {
	opacity: 0.72;
	cursor: progress;
}

/* Respect a reduced-motion preference: no transition, just the two states. */
@media (prefers-reduced-motion: no-preference) {
	.kcci-btn[aria-busy="true"] { transition: opacity 120ms linear; }
}

/* Alternatives that already work. Wrap rather than scroll: at 320px these
   become a stack, which is what a thumb wants anyway. */
.kcci-entry-alts {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-top: 16px;
	padding-top: 14px;
	border-top: 1px solid var(--kcci-line);
}

.kcci-entry-alts-label {
	flex: 1 1 100%;
	font-size: 0.84rem;
	font-weight: 600;
	color: var(--kcci-muted);
}

.kcci-entry-alts .kcci-btn {
	flex: 1 1 auto;
	min-height: 44px;
	font-size: 0.95rem;
}

@media (min-width: 560px) {
	.kcci-entry-alts .kcci-btn { flex: 0 0 auto; }
}

.kcci-entry--compact .kcci-entry-inner { padding: 18px 16px; }
.kcci-entry--compact h2 { font-size: clamp(1.1rem, 3.6vw, 1.35rem); }

/* ---------- preview panel ---------- */

.kcci-eyebrow {
	margin: 0 0 6px;
	font-size: 0.72rem;
	font-weight: 800;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: var(--kcci-accent);
}

.kcci-modal-card--preview h3 { margin-bottom: 12px; line-height: 1.25; }

.kcci-ticks {
	list-style: none;
	margin: 0 0 14px;
	padding: 0;
}

.kcci-ticks li {
	position: relative;
	padding-left: 26px;
	margin-bottom: 9px;
	line-height: 1.45;
	overflow-wrap: anywhere;
}

.kcci-ticks li::before {
	content: "";
	position: absolute;
	left: 2px;
	top: 0.38em;
	width: 12px;
	height: 7px;
	border-left: 2.5px solid var(--kcci-ok);
	border-bottom: 2.5px solid var(--kcci-ok);
	transform: rotate(-45deg);
}

.kcci-modal-alts {
	margin-top: 20px;
	padding-top: 16px;
	border-top: 1px solid var(--kcci-line);
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.kcci-modal-alts-label {
	flex: 1 1 100%;
	margin: 0;
	font-size: 0.88rem;
	font-weight: 600;
	color: var(--kcci-muted);
}

.kcci-modal-alts .kcci-btn { flex: 1 1 auto; }

/* ---------- buttons ---------- */

.kcci-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 46px;             /* comfortable touch target on a phone */
	padding: 10px 18px;
	border-radius: 10px;
	border: 1px solid transparent;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	text-decoration: none;
	max-width: 100%;
}

.kcci-btn-primary { background: var(--kcci-accent); color: var(--kcci-accent-ink); }
.kcci-btn-primary:hover { filter: brightness(0.94); }
.kcci-btn-quiet { background: #fff; color: var(--kcci-ink); border-color: var(--kcci-line); }
.kcci-btn:focus-visible { outline: 3px solid #1d6fd6; outline-offset: 2px; }
.kcci-btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---------- modal ---------- */

.kcci-modal {
	position: fixed;
	inset: 0;
	background: rgba(12, 20, 28, 0.6);
	display: flex;
	align-items: flex-end;
	justify-content: center;
	z-index: 99999;
	padding: 0;
}

@media (min-width: 640px) {
	.kcci-modal { align-items: center; padding: 20px; }
}

.kcci-modal-card {
	position: relative;
	/* Literal fallback: an unpainted card over a translucent overlay is an
	   invisible dialog, which reads to a visitor as a button that does nothing. */
	background: var(--kcci-bg, #ffffff);
	color: var(--kcci-ink, #14202b);
	width: 100%;
	max-width: 460px;
	max-height: 92vh;
	overflow-y: auto;
	border-radius: 16px 16px 0 0;
	padding: 24px 20px 28px;
}

@media (min-width: 640px) { .kcci-modal-card { border-radius: 16px; } }

.kcci-modal-card h3 { margin: 0 0 6px; font-size: 1.3rem; }
.kcci-modal-why { margin: 0 0 16px; color: var(--kcci-muted); }

.kcci-modal-close {
	position: absolute;
	top: 8px;
	right: 10px;
	background: none;
	border: 0;
	font-size: 1.8rem;
	line-height: 1;
	padding: 6px 10px;
	cursor: pointer;
	color: var(--kcci-muted);
}

.kcci-form label {
	display: block;
	font-weight: 600;
	margin: 12px 0 5px;
	font-size: 0.92rem;
}

/*
 * Inputs state every colour literally.
 *
 * `color: var(--kcci-ink)` was the whole bug: outside .kcci-entry the token is
 * undefined, the declaration is invalid, and the field inherited the theme's
 * white — white text typed into a white box. A literal fallback inside var()
 * means this field is legible even if the token block never loads at all.
 */
.kcci-form input {
	width: 100%;
	min-height: 46px;
	padding: 10px 12px;
	border: 1px solid var(--kcci-line, #dce3ea);
	border-radius: 10px;
	font-size: 16px;              /* 16px stops iOS zooming the whole page on focus */
	background: var(--kcci-bg, #ffffff) !important;
	color: var(--kcci-ink, #14202b) !important;
	caret-color: var(--kcci-ink, #14202b);
	-webkit-text-fill-color: var(--kcci-ink, #14202b);
	opacity: 1;
}

.kcci-form input::placeholder {
	color: var(--kcci-muted, #5a6b7a) !important;
	-webkit-text-fill-color: var(--kcci-muted, #5a6b7a);
	opacity: 1;                   /* Firefox dims placeholders by default */
}

.kcci-form input:focus {
	outline: 2px solid var(--kcci-accent, #b3311f);
	outline-offset: 1px;
}

/*
 * Chrome paints autofilled fields with its own background and text colour via
 * an internal -internal-autofill-selected rule that ordinary `background`
 * cannot override. The long inset shadow repaints the field, and
 * -webkit-text-fill-color is the only thing that moves autofilled text colour.
 */
.kcci-form input:-webkit-autofill,
.kcci-form input:-webkit-autofill:hover,
.kcci-form input:-webkit-autofill:focus,
.kcci-form input:-webkit-autofill:active {
	-webkit-text-fill-color: var(--kcci-ink, #14202b) !important;
	caret-color: var(--kcci-ink, #14202b);
	-webkit-box-shadow: 0 0 0 1000px var(--kcci-bg, #ffffff) inset !important;
	box-shadow: 0 0 0 1000px var(--kcci-bg, #ffffff) inset !important;
	transition: background-color 100000s ease-in-out 0s;
}

/*
 * A viewer in OS dark mode gets a forced dark form control on some browsers.
 * This panel is deliberately a light card in both schemes, so say so.
 */
.kcci-modal-card,
.kcci-form input { color-scheme: light; }

.kcci-form .kcci-btn { width: 100%; margin-top: 14px; }
.kcci-fineprint { font-size: 0.82rem; color: var(--kcci-muted); margin: 10px 0 0; }
.kcci-error { color: #a3231b; font-weight: 600; margin: 14px 0 0; }

/* ---------- dashboard ---------- */

.kcci-shell { max-width: 1100px; margin: 0 auto; padding: 16px; }
.kcci-loading { padding: 40px 0; text-align: center; color: var(--kcci-muted); }

.kcci-head {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: flex-start;
	justify-content: space-between;
	padding-bottom: 14px;
	border-bottom: 1px solid var(--kcci-line);
}

.kcci-hello { margin: 0; font-size: clamp(1.3rem, 5vw, 1.75rem); }
.kcci-sub { margin: 4px 0 0; color: var(--kcci-muted); font-size: 0.9rem; }

/* The tab strip scrolls inside itself. Letting it size the page is what makes
   a phone scroll sideways. */
.kcci-tabs {
	display: flex;
	gap: 6px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	margin: 14px 0 18px;
	padding-bottom: 2px;
}

.kcci-tabs::-webkit-scrollbar { display: none; }

.kcci-tab {
	flex: 0 0 auto;
	min-height: 42px;
	padding: 8px 14px;
	border: 1px solid var(--kcci-line);
	background: #fff;
	border-radius: 999px;
	font-size: 0.94rem;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
}

.kcci-tab.is-active { background: var(--kcci-ink); color: #fff; border-color: var(--kcci-ink); }
.kcci-panel { display: none; }
.kcci-panel.is-active { display: block; }

.kcci-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 14px;
}

@media (min-width: 560px) { .kcci-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .kcci-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.kcci-card {
	border: 1px solid var(--kcci-line);
	border-radius: 12px;
	overflow: hidden;
	background: #fff;
	display: flex;
	flex-direction: column;
	min-width: 0;                 /* lets long pet names wrap instead of widening the grid */
}

.kcci-card-photo {
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	background: var(--kcci-soft);
	display: block;
}

.kcci-card-body { padding: 12px 14px 14px; }
.kcci-card-body h3 { margin: 0 0 4px; font-size: 1.05rem; overflow-wrap: anywhere; }
.kcci-card-meta { margin: 0; font-size: 0.85rem; color: var(--kcci-muted); }

.kcci-badge {
	display: inline-block;
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding: 3px 8px;
	border-radius: 999px;
	margin-right: 6px;
}

.kcci-badge-owner { background: #123a5c; color: #fff; }
.kcci-badge-staff { background: var(--kcci-accent); color: #fff; }
.kcci-badge-community { background: var(--kcci-soft); color: var(--kcci-muted); }
.kcci-badge-test { background: #6b21a8; color: #fff; }

.kcci-card-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 14px 14px; }
.kcci-card-actions .kcci-btn { min-height: 40px; padding: 8px 12px; font-size: 0.9rem; }

.kcci-empty {
	padding: 26px 16px;
	text-align: center;
	color: var(--kcci-muted);
	border: 1px dashed var(--kcci-line);
	border-radius: 12px;
}

.kcci-list { list-style: none; margin: 0; padding: 0; }

.kcci-list li {
	border: 1px solid var(--kcci-line);
	border-radius: 10px;
	padding: 12px 14px;
	margin-bottom: 10px;
	min-width: 0;
	overflow-wrap: anywhere;
}

.kcci-state {
	font-size: 0.76rem;
	font-weight: 700;
	text-transform: uppercase;
	color: var(--kcci-muted);
}

.kcci-state-published { color: var(--kcci-ok); }
.kcci-state-pending_review { color: #9a6700; }

/* ---------- profile action strip ---------- */

.kcci-actions { max-width: 900px; margin: 22px auto 40px; padding: 0 16px; }

.kcci-actions-row {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	padding: 16px;
	border: 1px solid var(--kcci-line);
	border-radius: 12px;
	background: var(--kcci-soft);
}

.kcci-comments { margin-top: 22px; }
.kcci-comment { border-top: 1px solid var(--kcci-line); padding: 14px 0; overflow-wrap: anywhere; }
.kcci-comment-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.kcci-comment-author { font-weight: 700; }
.kcci-comment-time { font-size: 0.8rem; color: var(--kcci-muted); }
.kcci-comment-body { margin: 0; line-height: 1.55; white-space: pre-wrap; }
.kcci-comment-reply { margin-left: 18px; border-left: 3px solid var(--kcci-line); padding-left: 12px; }

.kcci-composer textarea {
	width: 100%;
	min-height: 96px;
	padding: 12px;
	border: 1px solid var(--kcci-line);
	border-radius: 10px;
	font-size: 16px;
	font-family: inherit;
	resize: vertical;
}

.kcci-notice {
	margin: 12px 0 0;
	padding: 12px 14px;
	border-radius: 10px;
	background: #fff6e5;
	border: 1px solid #f0d9a8;
	font-size: 0.9rem;
}

.kcci-notice-ok { background: #eaf7f1; border-color: #b7e0cd; }

@media (prefers-reduced-motion: no-preference) {
	.kcci-btn { transition: filter 0.15s ease, background 0.15s ease; }
}
