/* =========================================================
   ScriptLK Lead Follow-Up System — frontend styles
   Mobile-first, one-hand friendly, large tap targets.
   Palette: deep navy ink, signal blue, WhatsApp green,
   warm amber for "today", alert red for overdue.
   ========================================================= */

.lfs-app {
	--lfs-ink: #101828;
	--lfs-ink-soft: #475467;
	--lfs-muted: #98a2b3;
	--lfs-line: #e4e7ec;
	--lfs-bg: #f5f7fa;
	--lfs-card: #ffffff;
	--lfs-blue: #1d4ed8;
	--lfs-blue-dark: #1e40af;
	--lfs-green: #16a34a;
	--lfs-amber: #d97706;
	--lfs-red: #dc2626;
	--lfs-radius: 14px;

	max-width: 680px;
	margin: 0 auto;
	padding: 14px 14px 40px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color: var(--lfs-ink);
	line-height: 1.45;
	-webkit-text-size-adjust: 100%;
}

.lfs-app *,
.lfs-app *::before,
.lfs-app *::after { box-sizing: border-box; }

/* ---------- Header / brand ---------- */

.lfs-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 16px;
}

.lfs-brand { display: flex; flex-direction: column; }
.lfs-brand-name {
	font-size: 1.02rem;
	font-weight: 800;
	letter-spacing: -0.01em;
}
.lfs-brand-sub {
	font-size: 0.8rem;
	color: var(--lfs-ink-soft);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

/* ---------- Stats ---------- */

.lfs-stats {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 8px;
	margin-bottom: 20px;
}

.lfs-stat {
	background: var(--lfs-card);
	border: 1px solid var(--lfs-line);
	border-radius: var(--lfs-radius);
	padding: 12px 6px;
	text-align: center;
}
.lfs-stat-num { display: block; font-size: 1.45rem; font-weight: 800; }
.lfs-stat-label { display: block; font-size: 0.68rem; color: var(--lfs-ink-soft); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }
.lfs-stat-alert .lfs-stat-num { color: var(--lfs-red); }
.lfs-stat-won .lfs-stat-num { color: var(--lfs-green); }

/* ---------- Sections ---------- */

.lfs-section { margin-bottom: 26px; }
.lfs-section-title {
	font-size: 0.95rem;
	font-weight: 700;
	margin: 0 0 10px;
	display: flex;
	align-items: center;
	gap: 8px;
}
.lfs-title-overdue { color: var(--lfs-red); }
.lfs-count {
	background: var(--lfs-line);
	color: var(--lfs-ink-soft);
	border-radius: 999px;
	font-size: 0.72rem;
	font-weight: 700;
	padding: 2px 9px;
}
.lfs-empty {
	background: var(--lfs-card);
	border: 1px dashed var(--lfs-line);
	border-radius: var(--lfs-radius);
	color: var(--lfs-muted);
	padding: 18px;
	text-align: center;
	font-size: 0.9rem;
}

/* ---------- Cards ---------- */

.lfs-card {
	background: var(--lfs-card);
	border: 1px solid var(--lfs-line);
	border-radius: var(--lfs-radius);
	padding: 14px;
	margin-bottom: 12px;
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}
.lfs-card-overdue { border-left: 4px solid var(--lfs-red); }
.lfs-card-today { border-left: 4px solid var(--lfs-amber); }

.lfs-card-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 8px;
}
.lfs-card-name { font-size: 1.05rem; font-weight: 700; margin: 0; word-break: break-word; }

.lfs-card-meta {
	list-style: none;
	margin: 0 0 12px;
	padding: 0;
	font-size: 0.88rem;
}
.lfs-card-meta li {
	display: flex;
	gap: 10px;
	padding: 3px 0;
}
.lfs-meta-label {
	flex: 0 0 92px;
	color: var(--lfs-muted);
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding-top: 1px;
}
.lfs-time { font-weight: 700; }
.lfs-time-overdue { color: var(--lfs-red); }

/* ---------- Badges ---------- */

.lfs-badge {
	flex-shrink: 0;
	font-size: 0.7rem;
	font-weight: 700;
	padding: 4px 10px;
	border-radius: 999px;
	background: #eef2f6;
	color: var(--lfs-ink-soft);
	white-space: nowrap;
}
.lfs-badge-new { background: #eff6ff; color: var(--lfs-blue); }
.lfs-badge-won { background: #ecfdf3; color: var(--lfs-green); }
.lfs-badge-lost,
.lfs-badge-not_interested { background: #fef3f2; color: var(--lfs-red); }
.lfs-badge-interested,
.lfs-badge-waiting_decision { background: #fffaeb; color: var(--lfs-amber); }

/* ---------- Buttons ---------- */

.lfs-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 10px 14px;
	border: 0;
	border-radius: 10px;
	font-size: 0.88rem;
	font-weight: 700;
	text-decoration: none !important;
	cursor: pointer;
	transition: filter 0.15s ease, transform 0.05s ease;
	-webkit-tap-highlight-color: transparent;
}
.lfs-btn:active { transform: scale(0.98); }
.lfs-btn:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }

.lfs-btn-primary { background: var(--lfs-blue); color: #fff !important; }
.lfs-btn-primary:hover { filter: brightness(1.08); }
.lfs-btn-call { background: var(--lfs-ink); color: #fff !important; }
.lfs-btn-wa { background: var(--lfs-green); color: #fff !important; }
.lfs-btn-view { background: #eef2f6; color: var(--lfs-ink) !important; }
.lfs-btn-complete { background: #eff6ff; color: var(--lfs-blue-dark) !important; }
.lfs-btn-ghost { background: transparent; color: var(--lfs-ink-soft) !important; border: 1px solid var(--lfs-line); }
.lfs-btn-block { width: 100%; }
.lfs-btn-lg { min-height: 52px; font-size: 1rem; }
.lfs-btn[disabled] { opacity: 0.6; cursor: wait; }

.lfs-card-actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}
.lfs-card-actions .lfs-btn-complete { grid-column: 1 / -1; }

/* ---------- Forms ---------- */

.lfs-form { }
.lfs-field { margin-bottom: 14px; }
.lfs-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lfs-field-row .lfs-field { margin-bottom: 14px; }

.lfs-label {
	display: block;
	font-size: 0.82rem;
	font-weight: 700;
	margin-bottom: 5px;
	color: var(--lfs-ink);
}
.lfs-required { color: var(--lfs-red); }
.lfs-optional { color: var(--lfs-muted); font-weight: 500; }

.lfs-input {
	width: 100%;
	min-height: 48px;
	padding: 11px 13px;
	font-size: 1rem;
	color: var(--lfs-ink);
	background: var(--lfs-card);
	border: 1.5px solid var(--lfs-line);
	border-radius: 10px;
	appearance: none;
}
textarea.lfs-input { min-height: 0; resize: vertical; }
.lfs-input:focus {
	outline: none;
	border-color: var(--lfs-blue);
	box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}
select.lfs-input {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23475467' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	padding-right: 36px;
}

.lfs-hint { font-size: 0.78rem; color: var(--lfs-muted); margin: 10px 0 0; text-align: center; }

/* ---------- Messages ---------- */

.lfs-msg { margin: 8px 0; }
.lfs-alert {
	border-radius: 10px;
	padding: 11px 14px;
	font-size: 0.88rem;
	font-weight: 600;
	margin: 0 0 10px;
}
.lfs-alert-error { background: #fef3f2; color: var(--lfs-red); }
.lfs-alert-success { background: #ecfdf3; color: var(--lfs-green); }

/* ---------- Status row ---------- */

.lfs-status-row { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--lfs-line); }

/* ---------- Timeline ---------- */

.lfs-timeline {
	list-style: none;
	margin: 0;
	padding: 0 0 0 18px;
	border-left: 2px solid var(--lfs-line);
}
.lfs-timeline-item {
	position: relative;
	padding: 0 0 18px 14px;
}
.lfs-timeline-item::before {
	content: "";
	position: absolute;
	left: -24px;
	top: 5px;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--lfs-blue);
	border: 2px solid #fff;
	box-shadow: 0 0 0 2px var(--lfs-line);
}
.lfs-tl-reminder_sent::before { background: var(--lfs-amber); }
.lfs-tl-followup_call::before { background: var(--lfs-green); }
.lfs-tl-status_changed::before { background: var(--lfs-ink-soft); }

.lfs-timeline-date { display: block; font-size: 0.75rem; color: var(--lfs-muted); font-weight: 600; }
.lfs-timeline-action { display: block; font-size: 0.92rem; font-weight: 700; margin: 2px 0; }
.lfs-timeline-note { display: block; font-size: 0.88rem; color: var(--lfs-ink-soft); white-space: pre-line; }

/* ---------- PIN gate ---------- */

.lfs-pin-gate {
	display: flex;
	justify-content: center;
	padding-top: 40px;
}
.lfs-pin-card {
	width: 100%;
	max-width: 360px;
	background: var(--lfs-card);
	border: 1px solid var(--lfs-line);
	border-radius: var(--lfs-radius);
	padding: 26px 22px;
	text-align: center;
	box-shadow: 0 4px 12px rgba(16, 24, 40, 0.06);
}
.lfs-pin-card .lfs-brand { margin-bottom: 20px; align-items: center; }
.lfs-pin-form { text-align: left; }
.lfs-pin-input {
	text-align: center;
	font-size: 1.5rem;
	letter-spacing: 0.5em;
	margin-bottom: 12px;
}

/* ---------- Footer ---------- */

.lfs-footer {
	margin-top: 34px;
	padding-top: 16px;
	border-top: 1px solid var(--lfs-line);
	text-align: center;
	font-size: 0.78rem;
	color: var(--lfs-muted);
	line-height: 1.6;
}
.lfs-footer a { color: var(--lfs-ink-soft); }


/* ---------- Filters ---------- */

.lfs-filters {
	background: var(--lfs-card);
	border: 1px solid var(--lfs-line);
	border-radius: var(--lfs-radius);
	padding: 12px;
	margin-bottom: 22px;
}
.lfs-filter-search {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 8px;
	margin-bottom: 8px;
}
.lfs-filter-row {
	display: grid;
	grid-template-columns: 1fr;
	gap: 8px;
}
.lfs-filter-row .lfs-input { min-height: 44px; font-size: 0.92rem; }
.lfs-filter-actions {
	display: flex;
	gap: 8px;
	margin-top: 8px;
}
.lfs-filter-actions .lfs-btn { flex: 1; }

/* ---------- Secondary card links ---------- */

.lfs-card-links {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 10px;
	padding-top: 10px;
	border-top: 1px solid var(--lfs-line);
}
.lfs-link-btn {
	appearance: none;
	background: none;
	border: 0;
	padding: 8px 10px;
	min-height: 40px;
	font: inherit;
	font-size: 0.83rem;
	font-weight: 700;
	color: var(--lfs-ink-soft) !important;
	text-decoration: none !important;
	border-radius: 8px;
	cursor: pointer;
}
.lfs-link-btn:hover { background: #eef2f6; }
.lfs-link-btn:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.lfs-link-primary { color: var(--lfs-blue) !important; }
.lfs-link-danger { color: var(--lfs-red) !important; margin-left: auto; }
.lfs-link-danger:hover { background: #fef3f2; }
.lfs-link-btn[disabled] { opacity: 0.5; cursor: wait; }

.lfs-muted-text { color: var(--lfs-muted); }

/* ---------- Pagination ---------- */

.lfs-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin: 4px 0 20px;
}
.lfs-page-info { font-size: 0.83rem; color: var(--lfs-ink-soft); font-weight: 600; }

/* ---------- Card fade out on delete ---------- */

.lfs-card-removing {
	opacity: 0.35;
	transition: opacity 0.2s ease;
}

/* ---------- Desktop ---------- */

@media (min-width: 700px) {
	.lfs-app { padding: 24px 20px 60px; }
	.lfs-filter-row { grid-template-columns: repeat(3, 1fr); }
	.lfs-filter-actions .lfs-btn { flex: 0 0 auto; min-width: 150px; }
	.lfs-stats { gap: 12px; }
	.lfs-brand-name { font-size: 1.15rem; }
}

@media (prefers-reduced-motion: reduce) {
	.lfs-btn,
	.lfs-card-removing { transition: none; }
}
