/* =====================================================================
   mod_pnsgstat — Statistik Pengunjung (sidebar)  ·  prefix: spg-
   Pengadilan Negeri Sanggau · selaras Juknis SK 127/DJU/2026
   Warna: merah #9a2109 · aksen #FF9900 · teks #1a1a1a · bg #F9F9F9
   ===================================================================== */
.spg-wrap {
	--spg-red: #9a2109;
	--spg-red-dk: #6e1606;
	--spg-acc: #ff9900;
	--spg-tint: #fbf1ee;
	--spg-line: #ece6e4;
	--spg-text: #1a1a1a;
	--spg-muted: #5b5552;
	--spg-ok: #157f3c;
	--spg-ok-bg: #e9f8ef;
	--spg-head: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
	--spg-body: "Inter", system-ui, sans-serif;

	position: relative;
	box-sizing: border-box;
	width: 100%;
	margin: 0 0 1.5rem;
	padding: 1.125rem;
	background: #fff;
	border: 1px solid var(--spg-line);
	border-radius: 16px;
	box-shadow: 0 1px 2px rgba(26, 26, 26, .04), 0 8px 24px -12px rgba(154, 33, 9, .18);
	color: var(--spg-text);
	font-family: var(--spg-body);
	font-size: 1rem;
	line-height: 1.4;
	overflow: hidden;
}
.spg-wrap *,
.spg-wrap *::before,
.spg-wrap *::after { box-sizing: border-box; }
.spg-wrap *::first-letter { all: unset !important; }
.spg-wrap p { margin: 0; }

/* Netralkan pembungkus kartu Cassiopeia bila Module Style = card */
.card-body:has(> .spg-wrap) { padding: 0 !important; }
.card:has(> .card-body > .spg-wrap) { border: 0 !important; background: transparent !important; box-shadow: none !important; }

.spg-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	margin: -1px; padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.spg-wrap .material-symbols-outlined {
	font-size: 1.05em;
	line-height: 1;
	vertical-align: -.15em;
	font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 20;
}

/* ---------- Header ---------- */
.spg-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: .75rem;
	margin-bottom: 1rem;
}
.spg-head-text { min-width: 0; padding-left: .75rem; border-left: 4px solid var(--spg-red); }
.spg-wrap .spg-title {
	margin: 0 !important;
	padding: 0 !important;
	font-family: var(--spg-head);
	font-size: 1.125rem;
	font-weight: 800;
	line-height: 1.25;
	letter-spacing: -.01em;
	color: var(--spg-text) !important;
	border: 0 !important;
	background: none !important;
	text-transform: none;
}
.spg-sub { margin-top: .15rem !important; font-size: .8125rem; color: var(--spg-muted); }

.spg-live {
	flex: none;
	display: inline-flex;
	align-items: center;
	gap: .375rem;
	padding: .3rem .625rem;
	border-radius: 999px;
	background: var(--spg-ok-bg);
	color: var(--spg-ok);
	font-size: .75rem;
	font-weight: 700;
	white-space: nowrap;
}
.spg-dot {
	position: relative;
	width: .5rem; height: .5rem;
	border-radius: 50%;
	background: #22a052;
}
.spg-dot::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: inherit;
	animation: spg-pulse 2s ease-out infinite;
}
@keyframes spg-pulse {
	0%   { transform: scale(1); opacity: .6; }
	100% { transform: scale(2.6); opacity: 0; }
}

/* ---------- Hero: total ---------- */
.spg-hero {
	position: relative;
	padding: 1rem 1.125rem 1rem;
	border-radius: 12px;
	color: #fff;
	background:
		radial-gradient(120% 140% at 100% 0%, rgba(255, 153, 0, .28) 0, rgba(255, 153, 0, 0) 45%),
		radial-gradient(80% 90% at 0% 100%, rgba(0, 0, 0, .22) 0, rgba(0, 0, 0, 0) 60%),
		linear-gradient(135deg, var(--spg-red) 0%, var(--spg-red-dk) 100%);
	overflow: hidden;
}
.spg-hero::before {
	content: "";
	position: absolute;
	left: 1.125rem; top: 0;
	width: 2.25rem; height: 3px;
	border-radius: 0 0 3px 3px;
	background: var(--spg-acc);
}
.spg-hero-ico {
	position: absolute;
	right: -.25rem; bottom: -.9rem;
	font-size: 5.5rem !important;
	color: rgba(255, 255, 255, .12);
	pointer-events: none;
}
.spg-hero-label {
	font-size: .75rem;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, .88);
}
.spg-hero-num {
	margin-top: .125rem !important;
	font-family: var(--spg-head);
	font-size: clamp(1.875rem, 1.4rem + 1.6vw, 2.375rem);
	font-weight: 800;
	line-height: 1.1;
	letter-spacing: -.02em;
	font-variant-numeric: tabular-nums;
	color: #fff !important;
}
.spg-hero-meta {
	display: flex;
	flex-wrap: wrap;
	gap: .25rem .875rem;
	margin-top: .5rem !important;
	font-size: .78125rem;
	color: rgba(255, 255, 255, .9);
}
.spg-hero-meta strong { color: #fff; font-weight: 700; }

/* ---------- Tiles ---------- */
.spg-wrap .spg-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: .5rem;
	margin: .625rem 0 0 !important;
	padding: 0 !important;
	list-style: none !important;
}
.spg-wrap .spg-grid > li { margin: 0 !important; }
.spg-wrap .spg-grid > li::before { display: none !important; }
.spg-tile {
	display: flex;
	flex-direction: column;
	gap: .375rem;
	padding: .75rem .875rem;
	border-radius: 10px;
	background: var(--spg-tint);
	border: 1px solid rgba(154, 33, 9, .07);
}
.spg-tile-label {
	display: inline-flex;
	align-items: center;
	gap: .3rem;
	font-size: .75rem;
	font-weight: 600;
	color: var(--spg-muted);
}
.spg-tile-label .material-symbols-outlined { color: var(--spg-red); }
.spg-tile-num {
	font-family: var(--spg-head);
	font-size: 1.3125rem;
	font-weight: 800;
	line-height: 1.15;
	font-variant-numeric: tabular-nums;
	color: var(--spg-red);
	overflow-wrap: anywhere;
}
.spg-tile--today { background: #fff; border-color: rgba(255, 153, 0, .55); box-shadow: inset 4px 0 0 var(--spg-acc); }
/* Kunci jarak dalam kartu — menang atas aturan li/ul global template (user.css) */
.spg-wrap .spg-grid > li.spg-tile { padding: .75rem .875rem .75rem 1rem !important; text-indent: 0 !important; }
.spg-wrap .spg-grid > li.spg-tile--today { padding-left: 1.125rem !important; }
.spg-wrap .spg-tile-label { margin: 0 !important; padding: 0 !important; line-height: 1.2; }
.spg-wrap .spg-tile-num { margin: 0 !important; padding: 0 !important; }

/* ---------- Grafik 7 hari ---------- */
.spg-chart { margin-top: 1rem; }
.spg-chart-title {
	margin-bottom: .5rem !important;
	font-size: .6875rem;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--spg-muted);
}
.spg-bars {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	gap: .375rem;
	align-items: end;
}
.spg-bar { display: flex; flex-direction: column; align-items: center; gap: .25rem; min-width: 0; }
.spg-bar-val {
	font-size: .6875rem;
	font-weight: 700;
	color: var(--spg-text);
	font-variant-numeric: tabular-nums;
	line-height: 1;
}
.spg-bar-track {
	position: relative;
	display: block;
	width: 100%;
	max-width: 2rem;
	height: 5.5rem;
	border-radius: 6px;
	background: repeating-linear-gradient(to top, transparent 0 calc(25% - 1px), #f1ecea calc(25% - 1px) 25%);
}
.spg-bar-fill {
	position: absolute;
	left: 0; right: 0; bottom: 0;
	height: var(--h, 2%);
	border-radius: 6px 6px 3px 3px;
	background: linear-gradient(180deg, #b8361b 0%, var(--spg-red) 55%, var(--spg-red-dk) 100%);
	transform-origin: bottom;
	animation: spg-grow .6s cubic-bezier(.2, .7, .2, 1) both;
	transition: height .4s ease;
}
.spg-bar.is-today .spg-bar-fill { background: linear-gradient(180deg, #ffb340 0%, var(--spg-acc) 60%, #e08600 100%); }
.spg-bar-day { font-size: .6875rem; font-weight: 600; color: var(--spg-muted); white-space: nowrap; }
.spg-bar.is-today .spg-bar-day { color: var(--spg-red); font-weight: 800; }
.spg-bar.is-today .spg-bar-val { color: var(--spg-red); }
@keyframes spg-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* ---------- Footer ---------- */
.spg-foot {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: .375rem .75rem;
	margin-top: 1rem;
	padding-top: .75rem;
	border-top: 1px dashed var(--spg-line);
	font-size: .75rem;
	color: var(--spg-muted);
}
.spg-foot-item { display: inline-flex; align-items: center; gap: .3rem; }
.spg-foot-item .notranslate { font-weight: 700; color: var(--spg-text); }

/* ---------- Panel laporan (Super User) ---------- */
.spg-admin { margin-top: .75rem; border: 1px solid var(--spg-line); border-radius: 10px; font-size: .8125rem; }
.spg-admin > summary {
	display: flex; align-items: center; gap: .4rem;
	padding: .5rem .75rem;
	cursor: pointer;
	font-weight: 700;
	color: var(--spg-red);
	list-style: none;
}
.spg-admin > summary::-webkit-details-marker { display: none; }
.spg-admin-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: .4rem; padding: 0 .75rem .75rem; }
.spg-admin-form > *, .spg-admin-row > span { min-width: 0; }
.spg-admin-form label { font-weight: 600; font-size: .75rem; color: var(--spg-muted); }
.spg-admin-form select,
.spg-admin-form input[type="date"] {
	width: 100% !important; max-width: 100%; min-width: 0 !important; min-height: 2.25rem; padding: .25rem .5rem !important;
	border: 1px solid #cfc7c4; border-radius: 8px; background: #fff; color: var(--spg-text); font: inherit;
}
.spg-admin-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.spg-admin-row > span { display: grid; gap: .25rem; }
.spg-admin-btn {
	width: 100%;
	min-height: 2.5rem; margin-top: .25rem;
	border: 0; border-radius: 8px;
	background: var(--spg-red); color: #fff; font: inherit; font-weight: 700; cursor: pointer;
}
.spg-admin-btn:hover { background: var(--spg-red-dk); }
.spg-admin-note { font-size: .6875rem; color: var(--spg-muted); }
.spg-import form { display: grid; gap: .5rem; }
.spg-src {
	display: flex; gap: .5rem; align-items: flex-start;
	padding: .5rem .625rem; border: 1px solid var(--spg-line); border-radius: 8px; cursor: pointer;
}
.spg-src:has(input:checked) { border-color: var(--spg-red); background: var(--spg-tint); }
.spg-src input { margin-top: .2rem; accent-color: var(--spg-red); flex: none; }
.spg-src-body { display: grid; gap: .15rem; min-width: 0; }
.spg-src-name { font-weight: 700; font-size: .75rem; color: var(--spg-text); overflow-wrap: anywhere; }
.spg-src-meta { font-size: .6875rem; color: var(--spg-muted); }
.spg-src-nums { display: flex; flex-wrap: wrap; gap: .1rem .6rem; font-size: .6875rem; color: var(--spg-muted); }
.spg-src-nums b { color: var(--spg-red); }

/* ---------- Aksesibilitas ---------- */
.spg-wrap :focus-visible { outline: 3px solid var(--spg-acc); outline-offset: 2px; border-radius: 6px; }

@media (prefers-reduced-motion: reduce) {
	.spg-dot::after,
	.spg-bar-fill { animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
	.spg-hero, .spg-tile, .spg-bar-fill { forced-color-adjust: auto; border: 1px solid CanvasText; }
}
@media (prefers-contrast: more) {
	.spg-wrap { --spg-muted: #3a3432; --spg-line: #8f8683; }
}

/* Sidebar sempit / ponsel */
@media (max-width: 360px) {
	.spg-wrap { padding: .875rem; }
	.spg-tile-num { font-size: 1.125rem; }
	.spg-bars { gap: .25rem; }
}
