/* Fire Safety PM — colourful mobile-app-style UI shared across /m/* pages */

:root {
	--fs-red: #C8102E;
	--fs-red-dark: #9A0C24;
	--fs-bg: #F7F8FA;
	--fs-text: #1B1F23;
	--fs-mute: #6B7280;
	--fs-card: #FFFFFF;
	--fs-shadow: 0 1px 3px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.04);
	--fs-shadow-md: 0 4px 14px rgba(0,0,0,.07);
	--fs-radius: 14px;

	--fs-blue: #1F6FEB;
	--fs-green: #10B981;
	--fs-yellow: #F59E0B;
	--fs-purple: #8B5CF6;
	--fs-teal: #14B8A6;
	--fs-pink: #EC4899;
}

html, body { background: var(--fs-bg) !important; }
body.fs-page-active main, body.fs-page-active .web-page-content { padding: 0 !important; max-width: none !important; }

.fs-app {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, sans-serif;
	color: var(--fs-text);
	max-width: 720px;
	margin: 0 auto;
	padding: 0 18px 110px;
	background: var(--fs-bg);
	min-height: 100vh;
}

/* ── Header ────────────────────────────────────────────── */
.fs-header { display: flex; align-items: center; justify-content: space-between; padding: 22px 0 12px; }
.fs-brand { display: flex; align-items: center; gap: 12px; }
.fs-brand-mark {
	width: 46px; height: 46px; border-radius: 12px;
	background: linear-gradient(135deg, var(--fs-red), var(--fs-red-dark));
	display: flex; align-items: center; justify-content: center;
	box-shadow: 0 6px 18px rgba(200,16,46,.30);
}
.fs-brand-title { font-size: 18px; font-weight: 700; line-height: 1.1; }
.fs-brand-sub { font-size: 12px; color: var(--fs-mute); margin-top: 2px; }
.fs-header-actions { display: flex; gap: 10px; }
.fs-icon-btn {
	width: 40px; height: 40px; border-radius: 50%; background: var(--fs-card);
	display: flex; align-items: center; justify-content: center;
	color: var(--fs-text); text-decoration: none; box-shadow: var(--fs-shadow);
	border: none; cursor: pointer;
}
.fs-icon-btn.fs-help { background: #ECE7FF; color: #6938EF; font-weight: 700; }

/* ── Greeting ─────────────────────────────────────────── */
.fs-greet { padding: 10px 0 18px; }
.fs-greet h1 { font-size: 26px; font-weight: 800; margin: 0; }
.fs-greet h1 span { display: inline-block; transform: translateY(-2px); }
.fs-greet-sub { font-size: 14px; color: var(--fs-mute); margin-top: 4px; }

/* ── KPI strip ────────────────────────────────────────── */
.fs-kpis {
	display: grid; grid-template-columns: repeat(4, 1fr);
	gap: 10px; margin-bottom: 22px;
}
.fs-kpi {
	background: var(--fs-card); border-radius: var(--fs-radius);
	padding: 16px 8px; text-align: center; text-decoration: none; color: inherit;
	box-shadow: var(--fs-shadow); transition: transform .12s ease;
}
.fs-kpi:active { transform: scale(.97); }
.fs-kpi-num { font-size: 24px; font-weight: 800; }
.fs-kpi-label { font-size: 10px; letter-spacing: .12em; color: var(--fs-mute); margin-top: 4px; font-weight: 600; }
.fs-kpi-num.danger { color: var(--fs-red); }
.fs-kpi-num.warn { color: var(--fs-yellow); }
.fs-kpi-num.ok { color: var(--fs-green); }

/* ── Sections ─────────────────────────────────────────── */
.fs-section { margin-bottom: 22px; }
.fs-section-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.fs-section-title-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.fs-link { font-size: 13px; color: var(--fs-blue); text-decoration: none; }

/* ── Tile grid ────────────────────────────────────────── */
.fs-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.fs-tile {
	border-radius: var(--fs-radius); padding: 22px 10px;
	display: flex; flex-direction: column; align-items: center; gap: 10px;
	text-decoration: none; transition: transform .12s ease, box-shadow .12s ease;
	box-shadow: 0 1px 0 rgba(0,0,0,.02);
}
.fs-tile:active { transform: scale(.97); box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.fs-tile-ic { font-size: 26px; line-height: 1; }
.fs-tile-lb { font-size: 13px; font-weight: 600; }

.fs-tile-green   { background: #DEFBE8; color: #056F3A; }
.fs-tile-blue    { background: #E0EDFF; color: #1F4FCB; }
.fs-tile-teal    { background: #DDF7F4; color: #0E7C72; }
.fs-tile-lavender{ background: #ECE6FF; color: #5B30D6; }
.fs-tile-red     { background: #FDE2E4; color: #B22231; }
.fs-tile-yellow  { background: #FFF4D6; color: #8A6300; }
.fs-tile-pink    { background: #FFE4F1; color: #BE185D; }
.fs-tile-grey    { background: #EEF1F4; color: #4B5563; }

/* ── Lists ────────────────────────────────────────────── */
.fs-list { background: var(--fs-card); border-radius: var(--fs-radius); padding: 4px; box-shadow: var(--fs-shadow); }
.fs-list-empty { padding: 36px 12px; text-align: center; color: var(--fs-mute); font-size: 14px; }
.fs-list-row {
	display: flex; align-items: center; justify-content: space-between;
	padding: 14px 12px; text-decoration: none; color: inherit;
	border-bottom: 1px solid #F0F1F4;
}
.fs-list-row:last-child { border-bottom: none; }
.fs-list-t { font-weight: 600; font-size: 14px; }
.fs-list-s { font-size: 12px; color: var(--fs-mute); margin-top: 2px; }

.fs-list-pill {
	font-size: 11px; font-weight: 700; letter-spacing: .04em;
	padding: 5px 10px; border-radius: 999px; background: #EEF1F4; color: #344;
}
.fs-pill-planned { background: #E0EDFF; color: #1F4FCB; }
.fs-pill-inprogress { background: #FFF4D6; color: #8A6300; }
.fs-pill-completed { background: #DEFBE8; color: #056F3A; }
.fs-pill-missed, .fs-pill-breached { background: #FDE2E4; color: #B22231; }
.fs-pill-ontrack { background: #DEFBE8; color: #056F3A; }
.fs-pill-atrisk { background: #FFF4D6; color: #8A6300; }
.fs-pill-met { background: #E0F2FE; color: #075985; }

.fs-pill-low { background: #EEF1F4; color: #4B5563; }
.fs-pill-medium { background: #E0EDFF; color: #1F4FCB; }
.fs-pill-high { background: #FFF4D6; color: #8A6300; }
.fs-pill-critical { background: #FDE2E4; color: #B22231; font-weight: 800; }

/* ── PWA install banner ──────────────────────────────── */
.fs-install-banner {
	display: flex; align-items: center; gap: 12px;
	background: var(--fs-card); border-radius: var(--fs-radius); padding: 12px 14px;
	box-shadow: var(--fs-shadow); margin-bottom: 22px;
}
.fs-install-ic { font-size: 26px; }
.fs-install-text { flex: 1; }
.fs-install-t { font-size: 14px; font-weight: 700; }
.fs-install-s { font-size: 12px; color: var(--fs-mute); }
.fs-install-btn { background: var(--fs-blue); color: #fff; border: none; padding: 8px 16px; border-radius: 999px; font-weight: 600; cursor: pointer; }
.fs-install-x { background: transparent; border: none; color: var(--fs-mute); font-size: 22px; cursor: pointer; }

/* ── Tab bar ──────────────────────────────────────────── */
.fs-tabbar {
	position: fixed; bottom: 0; left: 0; right: 0;
	max-width: 720px; margin: 0 auto;
	background: rgba(255,255,255,.95);
	backdrop-filter: blur(8px);
	display: grid; grid-template-columns: repeat(5, 1fr);
	padding: 10px 8px calc(10px + env(safe-area-inset-bottom)) 8px;
	border-top: 1px solid #E5E7EB; z-index: 50;
}
.fs-tab { color: var(--fs-mute); text-align: center; text-decoration: none; font-size: 11px; font-weight: 600; }
.fs-tab-ic { font-size: 20px; line-height: 1; margin-bottom: 4px; }
.fs-tab-active { color: var(--fs-red); }

/* ── Cards & forms (shared on visit/reactive/complaint pages) ── */
.fs-card { background: var(--fs-card); border-radius: var(--fs-radius); padding: 16px; box-shadow: var(--fs-shadow); margin-bottom: 14px; }
.fs-card-h { font-size: 16px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.fs-card-sub { color: var(--fs-mute); font-size: 13px; }

.fs-input, .fs-textarea, .fs-select {
	width: 100%; padding: 12px; border-radius: 10px; border: 1px solid #E5E7EB;
	font-size: 15px; background: #fff; outline: none; transition: border .15s, box-shadow .15s;
}
.fs-input:focus, .fs-textarea:focus, .fs-select:focus {
	border-color: var(--fs-blue); box-shadow: 0 0 0 3px rgba(31,111,235,.18);
}
.fs-textarea { min-height: 96px; resize: vertical; }
.fs-label { font-size: 12px; color: var(--fs-mute); margin-bottom: 6px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.fs-field { margin-bottom: 12px; }

/* Big primary action button */
.fs-btn-primary {
	display: flex; align-items: center; justify-content: center; gap: 8px;
	width: 100%; padding: 16px; border-radius: 14px;
	background: linear-gradient(135deg, var(--fs-red), var(--fs-red-dark)); color: #fff;
	border: none; font-size: 16px; font-weight: 700; cursor: pointer;
	box-shadow: 0 6px 16px rgba(200,16,46,.32);
}
.fs-btn-primary:active { transform: scale(.98); }
.fs-btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.fs-btn-secondary {
	display: flex; align-items: center; justify-content: center; gap: 8px;
	width: 100%; padding: 14px; border-radius: 12px;
	background: var(--fs-card); color: var(--fs-text); border: 1px solid #E5E7EB;
	font-size: 15px; font-weight: 600; cursor: pointer;
}
.fs-btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Checklist ────────────────────────────────────────── */
.fs-check-row {
	display: grid; grid-template-columns: 1fr auto; gap: 10px;
	padding: 12px 0; border-bottom: 1px dashed #E5E7EB;
}
.fs-check-row:last-child { border-bottom: none; }
.fs-check-label { font-size: 14px; font-weight: 500; }
.fs-check-sub { font-size: 12px; color: var(--fs-mute); margin-top: 2px; }

.fs-segment {
	display: inline-flex; background: #F1F4F7; border-radius: 12px; padding: 3px;
	align-self: start;
}
.fs-segment button {
	background: transparent; border: none; padding: 6px 12px;
	font-size: 12px; font-weight: 700; cursor: pointer; color: var(--fs-mute);
	border-radius: 9px; transition: all .12s;
}
.fs-segment button.active.pass { background: var(--fs-green); color: #fff; }
.fs-segment button.active.fail { background: var(--fs-red); color: #fff; }
.fs-segment button.active.na { background: var(--fs-mute); color: #fff; }

/* Equipment summary block */
.fs-eq-block {
	background: linear-gradient(135deg, #FFF7E6, #FFF);
	border: 1px solid #FCE3B0; border-radius: var(--fs-radius);
	padding: 14px; margin-bottom: 14px;
}
.fs-eq-name { font-size: 15px; font-weight: 700; }
.fs-eq-meta { font-size: 12px; color: var(--fs-mute); margin-top: 4px; }

/* Signature canvas */
.fs-sig-wrap {
	background: #fff; border: 1px dashed #C7CDD3; border-radius: 10px;
	overflow: hidden; touch-action: none;
}
.fs-sig-canvas { width: 100%; height: 160px; display: block; touch-action: none; }
.fs-sig-actions { display: flex; gap: 8px; margin-top: 8px; }
.fs-sig-clear { background: transparent; border: 1px solid #E5E7EB; padding: 6px 12px; border-radius: 8px; font-size: 12px; cursor: pointer; color: var(--fs-mute); }

/* Photo upload */
.fs-photo-pick { display: block; padding: 22px; text-align: center; border: 2px dashed #C7CDD3; border-radius: 12px; color: var(--fs-mute); cursor: pointer; font-size: 13px; }
.fs-photo-pick input { display: none; }
.fs-photo-thumb { width: 100%; max-height: 220px; object-fit: cover; border-radius: 12px; }

/* Compliance card */
.fs-compliance {
	background: #fff; border-radius: var(--fs-radius);
	padding: 18px; box-shadow: var(--fs-shadow); margin-bottom: 14px;
}
.fs-compliance.compliant { border-left: 6px solid var(--fs-green); }
.fs-compliance.expiring { border-left: 6px solid var(--fs-yellow); }
.fs-compliance.expired { border-left: 6px solid var(--fs-red); }
.fs-compliance-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; }
.fs-compliance-row.bad { color: var(--fs-red); font-weight: 600; }
.fs-compliance-row.warn { color: var(--fs-yellow); font-weight: 600; }

/* Top toast */
.fs-toast {
	position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
	background: var(--fs-text); color: #fff; padding: 10px 18px;
	border-radius: 999px; font-size: 13px; font-weight: 600;
	box-shadow: 0 10px 30px rgba(0,0,0,.18); z-index: 100;
	opacity: 0; transition: opacity .25s; pointer-events: none;
}
.fs-toast.show { opacity: 1; }
.fs-toast.green { background: var(--fs-green); }
.fs-toast.red { background: var(--fs-red); }

/* Top bar with back arrow (used on inner pages) */
.fs-topbar {
	display: flex; align-items: center; gap: 10px; padding: 18px 0;
}
.fs-back {
	width: 40px; height: 40px; border-radius: 50%; background: var(--fs-card);
	display: flex; align-items: center; justify-content: center; box-shadow: var(--fs-shadow);
	color: var(--fs-text); text-decoration: none; font-size: 22px; line-height: 1;
}
.fs-page-title { font-size: 18px; font-weight: 700; }
.fs-page-sub { font-size: 12px; color: var(--fs-mute); }

/* Sticky bottom action bar (above the tabbar) */
.fs-action-bar {
	position: sticky; bottom: 90px; left: 0; right: 0; padding: 10px 0;
	background: linear-gradient(180deg, transparent, var(--fs-bg) 30%);
}

/* Offline indicator */
.fs-offline {
	background: #FFF4D6; color: #8A6300; padding: 8px 14px; border-radius: 999px;
	font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px;
	margin-bottom: 12px;
}
.fs-offline.queued { background: #E0EDFF; color: #1F4FCB; }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 480px) {
	.fs-kpis { grid-template-columns: repeat(2, 1fr); }
	.fs-tiles { grid-template-columns: repeat(2, 1fr); }
	.fs-greet h1 { font-size: 22px; }
}
