/* Construction Manager app - base styles. Colours come from variables so light/dark and the
   company's primary colour work everywhere. */
:root {
	--primary: #0f6b5f;
	--on-primary: #ffffff;
	--bg: #f3f6f5;
	--surface: #ffffff;
	--text: #14201e;
	--muted: #5a6a66;
	--border: #dce4e2;
	--danger: #b42318;
	--danger-bg: #fef3f2;
	--focus: #2563eb;
	--radius: 16px;
	--shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 10px 30px rgba(16, 24, 40, .08);
	--s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
	--font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color-scheme: light;
}
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg: #0f1514; --surface: #182120; --text: #eef3f2; --muted: #9fb0ac; --border: #2a3735;
		--danger: #ff8a80; --danger-bg: #3a1a18; --focus: #7aa7ff; --shadow: 0 10px 30px rgba(0, 0, 0, .45);
		color-scheme: dark;
	}
}
:root[data-theme="dark"] {
	--bg: #0f1514; --surface: #182120; --text: #eef3f2; --muted: #9fb0ac; --border: #2a3735;
	--danger: #ff8a80; --danger-bg: #3a1a18; --focus: #7aa7ff; --shadow: 0 10px 30px rgba(0, 0, 0, .45);
	color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
	font-family: var(--font); font-size: 17px; line-height: 1.55;
	padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 var(--s2); }
p { margin: 0 0 var(--s4); }
a { color: var(--primary); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.ccm-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ccm-muted { color: var(--muted); }
.ccm-old { padding: var(--s5); text-align: center; }

/* Layout helpers */
.ccm-center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--s5) var(--s4); }
.ccm-card {
	width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border);
	border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--s6) var(--s5);
}
@media (max-width: 420px) { .ccm-card { padding: var(--s5) var(--s4); } }

/* Brand mark */
.ccm-brand { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: var(--s5); gap: var(--s2); }
.ccm-logo { max-height: 72px; max-width: 70%; object-fit: contain; }
.ccm-logo-fallback {
	width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center;
	background: var(--primary); color: var(--on-primary);
}
.ccm-brand-name { font-weight: 700; font-size: 1.15rem; }

/* Forms */
.ccm-field { margin-bottom: var(--s4); }
.ccm-label { display: block; font-weight: 600; margin-bottom: var(--s2); }
.ccm-input {
	width: 100%; min-height: 48px; padding: 10px 14px; font: inherit; color: var(--text);
	background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px;
}
.ccm-input:focus { border-color: var(--primary); }
.ccm-input-wrap { position: relative; }
.ccm-input-wrap .ccm-input { padding-inline-end: 52px; }
.ccm-input-btn {
	position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%);
	min-width: 44px; min-height: 44px; display: grid; place-items: center;
	background: none; border: 0; color: var(--muted); cursor: pointer; border-radius: 10px;
}
.ccm-check { display: flex; align-items: center; gap: var(--s3); min-height: 44px; margin-bottom: var(--s3); cursor: pointer; }
.ccm-check input { width: 22px; height: 22px; accent-color: var(--primary); }
.ccm-link { display: inline-block; padding: var(--s3) 0; font-weight: 600; }
.ccm-center-text { text-align: center; }

/* Buttons */
.ccm-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
	min-height: 48px; padding: 10px 20px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
	color: var(--text); background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px;
	transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.ccm-btn:hover { box-shadow: 0 2px 10px rgba(16, 24, 40, .12); }
.ccm-btn:active { transform: translateY(1px); }
.ccm-btn-primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.ccm-btn-block { width: 100%; }
.ccm-btn:disabled { opacity: .65; cursor: not-allowed; box-shadow: none; }
.ccm-btn.is-busy::before {
	content: ""; width: 18px; height: 18px; border-radius: 50%;
	border: 3px solid currentColor; border-top-color: transparent; animation: ccm-spin .8s linear infinite;
}

/* Alerts */
.ccm-alert {
	display: flex; gap: var(--s3); align-items: flex-start; margin-bottom: var(--s4); padding: var(--s3) var(--s4);
	color: var(--danger); background: var(--danger-bg); border: 1px solid currentColor; border-radius: 12px; font-weight: 600;
}

/* Avatar and welcome (temporary home) */
.ccm-avatar {
	width: 72px; height: 72px; margin: 0 auto var(--s3); border-radius: 50%; display: grid; place-items: center;
	background: var(--primary); color: var(--on-primary); font-size: 1.5rem; font-weight: 700;
}
.ccm-welcome { text-align: center; }

/* Skeleton loader */
.ccm-skel {
	background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
	background-size: 200% 100%; animation: ccm-shimmer 1.4s ease-in-out infinite; border-radius: 10px;
}
.ccm-skel-card { display: flex; flex-direction: column; align-items: center; gap: var(--s4); }
.ccm-skel-circle { width: 64px; height: 64px; border-radius: 50%; }
.ccm-skel-line { height: 18px; width: 100%; }
.ccm-skel-line.short { width: 55%; }

@keyframes ccm-spin { to { transform: rotate(360deg); } }
@keyframes ccm-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* ===================== Step 3b: layout and reusable components ===================== */
.ccm-center-text { text-align: center; }
.ccm-stack { display: flex; flex-direction: column; gap: var(--s5); }
.ccm-stack-sm { display: flex; flex-direction: column; align-items: center; gap: var(--s3); }
.ccm-spacer { flex: 1; }
.ccm-flip { transition: transform .2s ease; }
[dir="rtl"] .ccm-flip { transform: scaleX(-1); }

.ccm-shell { display: grid; grid-template-columns: var(--sidebar-w, 264px) minmax(0, 1fr); min-height: 100vh; }
.ccm-shell[data-collapsed="1"] { --sidebar-w: 78px; }
.ccm-main { min-width: 0; display: flex; flex-direction: column; }

/* Sidebar */
.ccm-sidebar {
	position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: var(--s4);
	background: var(--surface); border-inline-end: 1px solid var(--border); padding: var(--s4) var(--s3);
}
.ccm-side-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 48px; }
.ccm-side-brand { display: flex; align-items: center; gap: var(--s3); min-width: 0; font-weight: 700; }
.ccm-side-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: #fff; flex: none; }
.ccm-side-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--primary); color: var(--on-primary); flex: none; }
.ccm-side-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ccm-nav { display: flex; flex-direction: column; gap: var(--s1); }
.ccm-sep { width: 100%; border: 0; border-top: 1px solid var(--border); margin: var(--s3) 0; }
.ccm-nav-link {
	display: flex; align-items: center; gap: var(--s3); min-height: 46px; padding: 0 var(--s3);
	color: var(--text); font: inherit; font-weight: 600; text-decoration: none; background: none; border: 0;
	border-radius: 12px; cursor: pointer; text-align: start;
}
.ccm-nav-link:hover { background: var(--bg); }
.ccm-nav-link[aria-current="page"] { background: var(--primary); color: var(--on-primary); }
.ccm-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ccm-soon-tag { font-size: .7rem; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.ccm-nav-link[aria-current="page"] .ccm-soon-tag { background: transparent; color: var(--on-primary); border-color: currentColor; }
.ccm-shell[data-collapsed="1"] .ccm-side-name,
.ccm-shell[data-collapsed="1"] .ccm-nav .ccm-label,
.ccm-shell[data-collapsed="1"] .ccm-nav .ccm-soon-tag,
.ccm-shell[data-collapsed="1"] .ccm-side-brand { display: none; }
.ccm-shell[data-collapsed="1"] .ccm-side-head { justify-content: center; }
.ccm-shell[data-collapsed="1"] .ccm-nav-link { justify-content: center; padding: 0; }
.ccm-shell[data-collapsed="1"] .ccm-collapse .ccm-flip { transform: rotate(180deg); }
[dir="rtl"] .ccm-shell[data-collapsed="1"] .ccm-collapse .ccm-flip { transform: scaleX(-1) rotate(180deg); }

/* Top bar */
.ccm-topbar {
	position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--s3);
	padding: var(--s3) var(--s5); background: var(--surface); border-bottom: 1px solid var(--border);
}
.ccm-top-mark { display: none; }
.ccm-page-title { font-size: 1.3rem; margin: 0; }
.ccm-icon-btn {
	min-width: 44px; min-height: 44px; display: grid; place-items: center; color: var(--text); cursor: pointer;
	background: none; border: 1.5px solid transparent; border-radius: 12px;
}
.ccm-icon-btn:hover { background: var(--bg); border-color: var(--border); }
.ccm-search {
	display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px; min-width: 220px; padding: 0 var(--s4);
	font: inherit; color: var(--muted); background: var(--bg); border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer; text-align: start;
}
.ccm-userbtn {
	display: flex; align-items: center; gap: var(--s2); min-height: 44px; padding: 4px var(--s2); font: inherit; color: var(--text);
	background: none; border: 1.5px solid transparent; border-radius: 12px; cursor: pointer;
}
.ccm-userbtn:hover { background: var(--bg); border-color: var(--border); }
.ccm-avatar-sm { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: .9rem; }
.ccm-userinfo { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; text-align: start; }
.ccm-username { font-weight: 700; }
.ccm-userrole { font-size: .8rem; color: var(--muted); }
.ccm-usermenu { position: relative; }
.ccm-popover {
	position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 40; min-width: 240px; padding: var(--s2);
	background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
}
.ccm-pop-head { display: flex; flex-direction: column; padding: var(--s3); border-bottom: 1px solid var(--border); margin-bottom: var(--s2); }
.ccm-menu-item {
	display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 44px; padding: 0 var(--s3); font: inherit; font-weight: 600;
	color: var(--text); background: none; border: 0; border-radius: 10px; cursor: pointer; text-align: start;
}
.ccm-menu-item:hover { background: var(--bg); }

/* Content */
.ccm-content { flex: 1; width: 100%; max-width: 1200px; margin-inline: auto; padding: var(--s5); outline: none; }
.ccm-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--s5); }
.ccm-panel-title { font-size: 1.15rem; margin: 0 0 var(--s3); }
.ccm-hero { text-align: center; padding: var(--s6) var(--s5); }
.ccm-hero-title { font-size: 1.5rem; margin: 0 0 var(--s2); }
.ccm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s4); }
.ccm-tile {
	display: flex; flex-direction: column; align-items: flex-start; gap: var(--s3); padding: var(--s5); color: var(--text); text-decoration: none;
	background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
	transition: transform .15s ease, border-color .15s ease;
}
.ccm-tile:hover { transform: translateY(-2px); border-color: var(--primary); }
.ccm-tile-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; background: var(--bg); color: var(--primary); }
.ccm-tile-label { font-weight: 700; font-size: 1.05rem; }

/* Badges, loader, empty state, table */
.ccm-badge { display: inline-block; padding: 2px 10px; font-size: .78rem; font-weight: 700; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: var(--muted); }
.ccm-badge-soon { color: var(--primary); border-color: var(--primary); background: transparent; }
.ccm-badge-success { color: #1a7f37; border-color: #1a7f37; background: transparent; }
.ccm-badge-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.ccm-loader { display: flex; align-items: center; gap: var(--s3); padding: var(--s4); color: var(--muted); }
.ccm-spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--primary); animation: ccm-spin .8s linear infinite; }
.ccm-empty { display: flex; flex-direction: column; align-items: center; gap: var(--s3); padding: var(--s6) var(--s4); }
.ccm-empty-title { font-size: 1.3rem; margin: 0; }
.ccm-empty-icon { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%; background: var(--bg); color: var(--primary); }
.ccm-art { max-width: 100%; height: auto; }
.ccm-table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.ccm-table-wrap table { width: 100%; border-collapse: collapse; }
.ccm-table-wrap th, .ccm-table-wrap td { padding: var(--s3) var(--s4); text-align: start; border-bottom: 1px solid var(--border); white-space: nowrap; }
.ccm-select { appearance: auto; }
.ccm-hint { font-size: .9rem; color: var(--muted); margin-top: var(--s1); }
.ccm-error-text { font-size: .9rem; color: var(--danger); margin-top: var(--s1); font-weight: 600; }
.ccm-btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }

/* Toasts */
.ccm-toasts { position: fixed; z-index: 100; inset-inline: var(--s4); bottom: var(--s5); display: flex; flex-direction: column; align-items: center; gap: var(--s2); pointer-events: none; }
.ccm-toast {
	pointer-events: auto; display: flex; align-items: center; gap: var(--s3); max-width: 480px; padding: var(--s3) var(--s4); cursor: pointer;
	color: var(--text); background: var(--surface); border: 1px solid var(--border); border-inline-start: 5px solid var(--primary); border-radius: 12px; box-shadow: var(--shadow);
	animation: ccm-pop .2s ease;
}
.ccm-toast-success { border-inline-start-color: #1a7f37; }
.ccm-toast-error { border-inline-start-color: var(--danger); }
.ccm-toast.is-leaving { opacity: 0; transition: opacity .2s ease; }
@keyframes ccm-pop { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Modal and bottom sheet */
body.ccm-lock { overflow: hidden; }
.ccm-overlay { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: var(--s4); background: rgba(8, 15, 14, .55); }
.ccm-modal { width: 100%; max-width: 440px; max-height: 90vh; overflow-y: auto; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); outline: none; }
.ccm-modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--border); }
.ccm-modal-head h2 { margin: 0; font-size: 1.2rem; }
.ccm-modal-body { padding: var(--s5); }
.ccm-modal-actions { display: flex; justify-content: flex-end; gap: var(--s3); padding: 0 var(--s5) var(--s5); }
.ccm-more-list { display: flex; flex-direction: column; gap: var(--s1); }

/* Bottom navigation (phones) */
.ccm-bottomnav { display: none; }
@media (max-width: 767px) {
	.ccm-shell { grid-template-columns: minmax(0, 1fr); }
	.ccm-sidebar, .ccm-search, .ccm-userinfo, .ccm-userbtn > svg { display: none; }
	.ccm-topbar { padding: var(--s2) var(--s4); gap: var(--s2); }
	.ccm-top-mark { display: grid; place-items: center; color: var(--primary); }
	.ccm-page-title { font-size: 1.1rem; }
	.ccm-content { padding: var(--s4); padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
	.ccm-bottomnav {
		display: flex; position: fixed; z-index: 30; inset-inline: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--border);
		padding: var(--s1) var(--s2) calc(var(--s1) + env(safe-area-inset-bottom)); gap: var(--s1);
	}
	.ccm-bottom-link { flex: 1; flex-direction: column; justify-content: center; gap: 2px; min-width: 0; min-height: 56px; padding: var(--s1); font-size: .72rem; text-align: center; }
	.ccm-bottom-link .ccm-label { flex: none; max-width: 100%; }
	.ccm-bottom-link .ccm-soon-tag { display: none; }
	.ccm-toasts { bottom: calc(88px + env(safe-area-inset-bottom)); }
	.ccm-overlay { align-items: flex-end; padding: 0; }
	.ccm-modal-sheet { max-width: none; border-radius: var(--radius) var(--radius) 0 0; padding-bottom: env(safe-area-inset-bottom); }
	.ccm-modal-dialog { margin: auto var(--s4); }
	.ccm-overlay:has(.ccm-modal-dialog) { align-items: center; padding: var(--s4); }
	.ccm-modal-dialog { margin: 0; }
}

/* ===================== Step 3c: Urdu, RTL, theme, polish ===================== */
@font-face {
	font-family: "CCM Nastaliq"; font-weight: 400; font-style: normal; font-display: swap;
	src: url("../fonts/NotoNastaliqUrdu-Regular.woff") format("woff");
}
@font-face {
	font-family: "CCM Nastaliq"; font-weight: 700; font-style: normal; font-display: swap;
	src: url("../fonts/NotoNastaliqUrdu-Bold.woff") format("woff");
}
:root { --font-ur: "CCM Nastaliq", "Noto Nastaliq Urdu", "Noto Naskh Arabic", "Segoe UI", Tahoma, system-ui, sans-serif; }

/* The font file is only downloaded when Urdu is on (the browser fetches it when this rule first applies). */
html[lang="ur"] body { font-family: var(--font-ur); line-height: 2.05; }
html[lang="ur"] h1, html[lang="ur"] h2 { line-height: 2; }
html[lang="ur"] .ccm-btn, html[lang="ur"] .ccm-input, html[lang="ur"] .ccm-search { line-height: 1.9; }
html[lang="ur"] .ccm-label, html[lang="ur"] .ccm-side-name, html[lang="ur"] .ccm-username, html[lang="ur"] .ccm-userrole { line-height: 2; padding-block: 4px; }
html[lang="ur"] .ccm-nav-link { min-height: 52px; }
html[lang="ur"] .ccm-bottom-link { font-size: .8rem; line-height: 1.8; }
html[lang="ur"] .ccm-soon-tag, html[lang="ur"] .ccm-badge { line-height: 1.9; }

/* Logo: a soft white plate so logos with a white background look intentional in dark mode too */
.ccm-logo { background: #fff; border-radius: 14px; padding: 6px; }

/* Login card top row */
.ccm-card-top { display: flex; justify-content: flex-end; margin: calc(var(--s3) * -1) 0 var(--s2); }
.ccm-linkbtn {
	display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s3); font: inherit; font-weight: 600;
	color: var(--primary); background: none; border: 0; border-radius: 10px; cursor: pointer;
}
.ccm-linkbtn:hover { background: var(--bg); }

/* Menu check mark column and skip link */
.ccm-check-mark { width: 20px; display: inline-grid; place-items: center; color: var(--primary); }
.ccm-skip {
	position: absolute; inset-inline-start: var(--s3); top: -80px; z-index: 200; padding: var(--s3) var(--s4);
	background: var(--primary); color: var(--on-primary); border-radius: 10px; font-weight: 700; text-decoration: none;
}
.ccm-skip:focus { top: var(--s3); }

/* Right-to-left details */
[dir="rtl"] .ccm-nav-link, [dir="rtl"] .ccm-menu-item, [dir="rtl"] .ccm-userinfo { text-align: right; }
[dir="rtl"] .ccm-toast { border-inline-start-width: 5px; }
@media (max-width: 767px) {
	.ccm-topbar .ccm-icon-btn { min-width: 40px; }
	.ccm-topbar .ccm-popover { min-width: 200px; }
}

/* ===================== Part 4: Settings screen ===================== */
.ccm-subtitle { font-size: 1.05rem; margin: var(--s2) 0 0; }
.ccm-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 var(--s5); }
.ccm-textarea { resize: vertical; min-height: 96px; }
.ccm-two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s6); align-items: start; }
.ccm-margins { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--s4); }
.ccm-color-row { display: flex; align-items: flex-end; gap: var(--s4); }
.ccm-color-row .ccm-field { flex: 1; max-width: 320px; margin-bottom: 0; }
.ccm-color { width: 56px; height: 48px; padding: 2px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; }
.ccm-upload { padding-bottom: var(--s3); border-bottom: 1px solid var(--border); }
.ccm-upload-view { display: grid; place-items: center; min-height: 110px; margin: var(--s3) 0; padding: var(--s3); background: var(--bg); border: 1.5px dashed var(--border); border-radius: 12px; }
.ccm-upload-img { max-width: 100%; max-height: 200px; object-fit: contain; border-radius: 8px; }
.ccm-upload-img.is-logo { max-height: 90px; background: #fff; padding: 6px; }
.ccm-upload-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.ccm-preview-col { position: sticky; top: 90px; }
.ccm-preview-stage { direction: ltr; width: 100%; overflow: hidden; background: #e6ebea; border: 1px solid var(--border); border-radius: 12px; }
.ccm-preview-frame { display: block; width: 794px; height: 1123px; border: 0; background: #fff; transform-origin: top left; }

/* Switch */
.ccm-switch { display: flex; align-items: flex-start; gap: var(--s4); padding: var(--s3) 0; cursor: pointer; }
.ccm-switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ccm-switch-track { flex: none; position: relative; width: 52px; height: 30px; margin-top: 2px; border-radius: 999px; background: var(--border); transition: background-color .15s ease; }
.ccm-switch-thumb { position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: inset-inline-start .15s ease; }
.ccm-switch-input:checked + .ccm-switch-track { background: var(--primary); }
.ccm-switch-input:checked + .ccm-switch-track .ccm-switch-thumb { inset-inline-start: 25px; }
.ccm-switch-input:focus-visible + .ccm-switch-track { outline: 3px solid var(--focus); outline-offset: 2px; }
.ccm-switch-text { display: flex; flex-direction: column; gap: 2px; }
.ccm-switch-label { font-weight: 600; }

/* Save bar */
.ccm-savebar {
	position: sticky; bottom: var(--s3); z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
	padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.ccm-savebar-text { color: var(--muted); font-weight: 600; }
@media (max-width: 900px) {
	.ccm-two-col { grid-template-columns: minmax(0, 1fr); }
	.ccm-preview-col { position: static; }
}
@media (max-width: 767px) {
	.ccm-savebar { bottom: calc(76px + env(safe-area-inset-bottom)); }
	.ccm-savebar .ccm-btn { min-width: 120px; }
}

/* ===================== Part 4b: letterhead options ===================== */
.ccm-preview-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s5); margin: var(--s2) 0 var(--s3); }
.ccm-preview-tools .ccm-switch { padding: var(--s1) 0; }

/* ===================== Stage 2b: Users screen ===================== */
.ccm-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s3) var(--s4); margin-bottom: var(--s3); }
.ccm-toolbar-search { flex: 1 1 240px; min-width: 200px; }
.ccm-toolbar .ccm-field { margin-bottom: 0; min-width: 160px; }
.ccm-user-list { display: flex; flex-direction: column; gap: var(--s3); }
.ccm-user { display: flex; align-items: flex-start; gap: var(--s4); padding: var(--s4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.ccm-user.is-off { opacity: .78; }
.ccm-user-main { flex: 1; min-width: 0; }
.ccm-user-name { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.ccm-user-sub { font-size: .92rem; overflow-wrap: anywhere; }
.ccm-user-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s2); max-width: 340px; }
.ccm-indent { margin-inline-start: var(--s6); }
.ccm-temp-pass { font: 700 1.7rem ui-monospace, Menlo, Consolas, monospace; letter-spacing: .06em; text-align: center; padding: var(--s4); background: var(--bg); border: 2px dashed var(--primary); border-radius: 12px; user-select: all; direction: ltr; overflow-wrap: anywhere; }
@media (max-width: 767px) {
	.ccm-user { flex-wrap: wrap; }
	.ccm-user-actions { max-width: none; justify-content: flex-start; width: 100%; }
}

/* ===================== Projects ===================== */
a.ccm-project { color: inherit; text-decoration: none; align-items: center; transition: border-color .15s ease, box-shadow .15s ease; }
a.ccm-project:hover { border-color: var(--primary); }
a.ccm-project:focus-visible { outline: 3px solid var(--focus, #2563eb); outline-offset: 2px; }
.ccm-project-go { flex: none; }
html:not([dir="rtl"]) .ccm-project-go svg { transform: scaleX(-1); }
.ccm-project-title { font-size: 1.3rem; }
.ccm-project-actions { justify-content: flex-start; max-width: none; margin-top: var(--s3); }
.ccm-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.ccm-form-row .ccm-field { margin-bottom: 0; }
.ccm-details { display: grid; grid-template-columns: 1fr; gap: var(--s4); margin: 0; }
.ccm-detail dt { font-size: .88rem; }
.ccm-detail dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
@media (min-width: 768px) { .ccm-details { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .ccm-form-row { grid-template-columns: 1fr; } }

/* ---- Clients (3a) ---- */
button.ccm-client { width: 100%; font: inherit; color: inherit; text-align: start; cursor: pointer; align-items: center; transition: border-color .15s ease, box-shadow .15s ease; }
button.ccm-client:hover { border-color: var(--primary); }
button.ccm-client:focus-visible { outline: 3px solid var(--focus, #2563eb); outline-offset: 2px; }
.ccm-dim { opacity: .75; }
.ccm-hist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.ccm-hist-item { padding-block: var(--s2); border-bottom: 1px solid var(--border); }
.ccm-hist-item:last-child { border-bottom: 0; }
.ccm-hist-changes { margin: var(--s2) 0 0; padding-inline-start: var(--s5); font-size: .92rem; overflow-wrap: anywhere; }

/* ---- Projects list controls (3b): two filters per row on phones ---- */
@media (max-width: 480px) { .ccm-toolbar .ccm-field { flex: 1 1 110px; min-width: 110px; } .ccm-toolbar .ccm-field .ccm-input { width: 100%; } }
