/* CuroInsight design system for web pages (enrolment app, partner portal, clinical desks, My Health,
 * HR dashboard, compliance and card pages, login). Tokens follow curoinsight.com.
 * Phone-first: 16px side gutter, 44px touch targets; tables scroll inside their own container.
 */

:root,
[data-theme="light"] {
	--ci-purple: #6b52c8;
	--ci-purple-hover: #5a43b3;
	--ci-purple-soft: #eee9ff;
	--ci-brand-purple: #7c71b1;
	--ci-teal: #1dafa0;
	--ci-teal-text: #148a7d;
	--ci-teal-soft: #e6f7f5;
	--ci-logo-teal: #8ec0c3;
	--ci-ink: #0f172a;
	--ci-ink-2: #334155;
	--ci-ink-3: #64748b;
	--ci-ink-4: #94a3b8;
	--ci-line: #e2e8f0;
	--ci-line-soft: #f1f5f9;
	--ci-surface: #ffffff;
	--ci-ground: #f8fafc;
	--ci-warn-bg: #fff7e6;
	--ci-warn-text: #8a5a00;
	--ci-bad-bg: #fdecec;
	--ci-bad-text: #a12622;
	--ci-ok-bg: var(--ci-teal-soft);
	--ci-ok-text: var(--ci-teal-text);
	--ci-r-sm: 10px;
	--ci-r: 16px;
	--ci-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
	--ci-shadow: 0 4px 16px rgba(15, 23, 42, 0.07), 0 2px 6px rgba(15, 23, 42, 0.04);

	--primary: var(--ci-purple);
	--primary-color: var(--ci-purple);
	--btn-primary: var(--ci-purple);
	--brand-color: var(--ci-purple);
}

[data-theme="dark"] {
	--ci-purple: #a493f0;
	--ci-purple-hover: #b8aaf4;
	--ci-purple-soft: #2c2547;
	--ci-teal-text: #5fd6c8;
	--ci-teal-soft: #12302d;
	--ci-ink: #f1f5f9;
	--ci-ink-2: #cbd5e1;
	--ci-ink-3: #94a3b8;
	--ci-line: #334155;
	--ci-line-soft: #1e293b;
	--ci-surface: #111827;
	--ci-ground: #0b1120;
	--ci-warn-bg: #3a2c0c;
	--ci-warn-text: #f5c26b;
	--ci-bad-bg: #3b1515;
	--ci-bad-text: #f19c9c;
}

/* --- Page frame ------------------------------------------------------------------------------- */

.ci-page {
	max-width: 1240px;
	margin: 0 auto;
	padding-block: 20px 40px;
	padding-inline: 0; /* Frappe's page container already gives the side gutter */
	color: var(--ci-ink);
	font-family: Inter, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.ci-page.ci-narrow { max-width: 600px; }
.ci-page.ci-medium { max-width: 860px; }
.ci-page > h3:first-child,
.ci-page .ci-title {
	color: var(--ci-ink);
	font-size: 1.5rem;
	font-weight: 700;
	letter-spacing: -0.01em;
	margin: 4px 0 6px;
}
.ci-page > h3:first-child::before {
	content: "";
	display: block;
	width: 36px;
	height: 4px;
	border-radius: 2px;
	background: linear-gradient(90deg, var(--ci-logo-teal) 0 40%, var(--ci-brand-purple) 40% 100%);
	margin-bottom: 10px;
}
.ci-page h3,
.ci-page h4 { color: var(--ci-ink); }

/* --- Building blocks ---------------------------------------------------------------------------- */

.ci-card {
	background: var(--ci-surface);
	border: 1px solid var(--ci-line);
	border-radius: var(--ci-r);
	box-shadow: var(--ci-shadow-sm);
	padding: 16px;
	margin-bottom: 16px;
}
.ci-muted { color: var(--ci-ink-3); font-size: 13px; }
.ci-strong { font-weight: 600; }
.ci-step-title { font-weight: 700; margin-bottom: 8px; color: var(--ci-ink); }
.ci-big { font-size: 18px; font-weight: 600; }
.ci-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ci-row.ci-fill > * { flex: 1; }
.ci-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.ci-grid.ci-2-3 { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
@media (max-width: 900px) {
	.ci-grid,
	.ci-grid.ci-2-3 { grid-template-columns: 1fr; }
}
.ci-note { background: var(--ci-warn-bg); color: var(--ci-ink); border-radius: var(--ci-r-sm); padding: 10px 12px; margin: 8px 0; }

/* Status pills. Modifiers: ok / warn / bad / info, and result bands b-Normal / b-Borderline / b-Abnormal. */
.ci-pill {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	background: var(--ci-line-soft);
	color: var(--ci-ink-2);
	white-space: nowrap;
}
.ci-pill.ok,
.ci-pill.b-Normal { background: var(--ci-ok-bg); color: var(--ci-ok-text); }
.ci-pill.warn,
.ci-pill.b-Borderline { background: var(--ci-warn-bg); color: var(--ci-warn-text); }
.ci-pill.bad,
.ci-pill.b-Abnormal { background: var(--ci-bad-bg); color: var(--ci-bad-text); }
.ci-pill.info { background: var(--ci-purple-soft); color: var(--ci-purple); }

/* KPI tiles */
.ci-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 700px) { .ci-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ci-kpi { background: var(--ci-surface); border: 1px solid var(--ci-line); border-radius: var(--ci-r); padding: 14px; text-align: center; color: var(--ci-ink-3); }
.ci-kpi b { display: block; font-size: 26px; color: var(--ci-purple); line-height: 1.2; }

/* Tables: compact on desktop, scroll inside their card on phones. */
.ci-scroll { overflow-x: auto; }
.ci-page table { width: 100%; font-size: 13px; border-collapse: collapse; }
.ci-page td,
.ci-page th { padding: 6px; vertical-align: top; border-bottom: 1px solid var(--ci-line-soft); }
.ci-page th { color: var(--ci-ink-3); font-weight: 600; text-align: left; }
.ci-page tr.sel { background: var(--ci-purple-soft); }
.ci-page tr[data-item],
.ci-page tr[data-case],
.ci-page tr[data-name] { cursor: pointer; }
.ci-page .num { text-align: right; white-space: nowrap; }
.ci-page .out,
.ci-page .up { color: var(--ci-bad-text); font-weight: 600; }
.ci-page .down { color: var(--ci-teal-text); font-weight: 600; }
.ci-page .out input { border-color: var(--ci-bad-text); color: var(--ci-bad-text); }

/* Controls */
.ci-page .form-control { border-radius: var(--ci-r-sm); }
.ci-page .btn { border-radius: var(--ci-r-sm); font-weight: 600; }
.ci-page .btn-primary { background: var(--ci-purple); border-color: var(--ci-purple); color: #fff; }
.ci-page .btn-primary:hover,
.ci-page .btn-primary:focus { background: var(--ci-purple-hover); border-color: var(--ci-purple-hover); }
.ci-page .btn:focus-visible,
.ci-page .form-control:focus { box-shadow: 0 0 0 3px rgba(107, 82, 200, 0.25); border-color: var(--ci-purple); }
.ci-block { width: 100%; }

/* Phone-first pages (enrolment, partner scan, My Health, card): large touch targets. */
.ci-touch .btn,
.ci-touch .form-control { min-height: 44px; font-size: 16px; }
.ci-touch .btn-sm,
.ci-touch .btn-xs { min-height: 36px; font-size: 14px; }
.ci-code-input { font-size: 22px !important; letter-spacing: 6px; text-align: center; }
.ci-code { font-size: 32px; letter-spacing: 4px; font-weight: 700; text-align: center; margin: 8px 0; color: var(--ci-purple); }

/* Upload drop zone */
.ci-drop { border: 2px dashed var(--ci-line); border-radius: var(--ci-r); padding: 24px; text-align: center; cursor: pointer; color: var(--ci-ink-3); }
.ci-drop.over { background: var(--ci-purple-soft); border-color: var(--ci-purple); }

/* Result rows (My Health) */
.ci-test { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--ci-line-soft); }
.ci-test:last-child { border-bottom: 0; }
.ci-val { font-weight: 600; font-size: 16px; text-align: right; white-space: nowrap; }

/* --- Website frame: navbar, footer and login in CuroInsight colours ---------------------------- */

.navbar .navbar-brand img { max-height: 28px; width: auto; }
.web-footer { border-top: 1px solid var(--ci-line); }
.page-card,
.login-content.page-card { border-radius: var(--ci-r); box-shadow: var(--ci-shadow); border: 1px solid var(--ci-line); }
.for-login .page-card-head img,
.for-forgot .page-card-head img { max-height: 40px; width: auto; }
.for-login .btn-primary,
.for-forgot .btn-primary,
.for-signup .btn-primary { background: var(--ci-purple); border-color: var(--ci-purple); }
.for-login .btn-primary:hover { background: var(--ci-purple-hover); border-color: var(--ci-purple-hover); }
a { color: var(--ci-purple); }

/* Co-branding strip: the client's or partner's logo with "with CuroInsight". */
.ci-cobrand { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.ci-cobrand .ci-own-logo { max-height: 48px; max-width: 180px; width: auto; object-fit: contain; }
.ci-cobrand .ci-own-name { font-size: 1.5rem; font-weight: 700; color: var(--ci-ink); letter-spacing: -0.01em; line-height: 1.2; }
.ci-cobrand .ci-with { display: inline-flex; align-items: center; gap: 6px; color: var(--ci-ink-3); font-size: 12px; }
.ci-cobrand .ci-with img { height: 16px; width: auto; }
.ci-cobrand .ci-divider { width: 1px; align-self: stretch; background: var(--ci-line); }
