/* =========================================================================
   PrintDeed HRMS — Enterprise Theme (ADR-0009)
   New shell + new pages use this. Legacy pages remain on base.css.
   ========================================================================= */

:root {
	/* Palette */
	--pd-primary: #0B2942;
	--pd-primary-soft: #13355A;
	--pd-primary-2: #1B4068;

	--pd-accent: #14B8A6;
	--pd-accent-soft: #CCFBF1;
	--pd-accent-dark: #0F9488;

	--pd-bg: #F8FAFC;
	--pd-surface: #FFFFFF;
	--pd-surface-2: #F1F5F9;
	--pd-border: #DCE7E5;
	--pd-border-strong: #B6CCC8;

	--pd-text: #0B2942;
	--pd-text-muted: #64748B;
	--pd-text-light: #94A3B8;

	--pd-success: #16A34A;
	--pd-success-soft: #DCFCE7;
	--pd-warning: #F59E0B;
	--pd-warning-soft: #FEF3C7;
	--pd-danger: #DC2626;
	--pd-danger-soft: #FEE2E2;
	--pd-info: #0891B2;
	--pd-info-soft: #CFFAFE;

	/* Shape & shadow */
	--pd-radius-sm: 8px;
	--pd-radius: 12px;
	--pd-radius-lg: 16px;
	--pd-radius-xl: 24px;

	--pd-shadow-sm: 0 1px 2px rgba(11, 41, 66, .04);
	--pd-shadow-md: 0 6px 24px rgba(11, 41, 66, .06);
	--pd-shadow-lg: 0 20px 50px rgba(11, 41, 66, .10);
	--pd-glass: rgba(255, 255, 255, .72);

	/* Layout */
	--pd-sidebar-w: 248px;
	--pd-topbar-h: 64px;

	/* ---- Aliases -----------------------------------------------------------
	   These names are used throughout the templates' inline styles but were
	   never declared, so every `color: var(--pd-muted)` was an invalid
	   declaration that silently fell back to the inherited colour (muted text
	   rendered the same as body text). Declaring them here fixes that and is
	   what lets the dark theme below recolour those inline styles too.
	   ------------------------------------------------------------------------ */
	--pd-muted: var(--pd-text-muted);
	--pd-text-soft: var(--pd-text-light);
	--pd-hover: var(--pd-surface-2);
	--pd-card-bg: var(--pd-surface);
	--pd-card-soft: var(--pd-surface-2);
	--pd-surface-raised: var(--pd-surface);
	--pd-success-dark: #15803D;
	/* A navy FILL (background under white text). Same value as --pd-primary in
	   light mode; the dark theme gives it its own value because --pd-primary
	   turns into a light text colour there. */
	--pd-primary-fill: var(--pd-primary);
	--pd-font: 'Inter', 'Space Grotesk', 'Segoe UI', sans-serif;

	color-scheme: light;
}

/* ---------- Base reset ---------- */
.pd-app * { box-sizing: border-box; }
.pd-app {
	margin: 0;
	font-family: 'Inter', 'Space Grotesk', 'Segoe UI', sans-serif;
	color: var(--pd-text);
	background: var(--pd-bg);
	min-height: 100vh;
	-webkit-font-smoothing: antialiased;
}
.pd-app a { color: inherit; text-decoration: none; }
.pd-app h1, .pd-app h2, .pd-app h3, .pd-app h4 {
	color: var(--pd-primary);
	margin: 0;
	font-weight: 600;
	letter-spacing: -0.01em;
}
.pd-app h1 { font-size: 28px; line-height: 1.2; }
.pd-app h2 { font-size: 20px; }
.pd-app h3 { font-size: 16px; }
.pd-app p  { margin: 0; color: var(--pd-text-muted); font-size: 14px; line-height: 1.5; }
.pd-app button { font-family: inherit; }

/* ---------- Shell layout ---------- */
.pd-shell {
	display: grid;
	grid-template-columns: var(--pd-sidebar-w) 1fr;
	min-height: 100vh;
}

/* Sidebar */
.pd-sidebar {
	background: var(--pd-primary);
	color: #E2E8F0;
	padding: 20px 16px;
	position: sticky;
	top: 0;
	height: 100vh;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 8px;
	border-right: 1px solid rgba(255,255,255,.04);
}
.pd-sidebar::-webkit-scrollbar { width: 6px; }
.pd-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.pd-brand {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 8px 8px 20px;
	border-bottom: 1px solid rgba(255,255,255,.06);
	margin-bottom: 8px;
}
.pd-brand-mark {
	width: 38px; height: 38px;
	border-radius: 10px;
	background: linear-gradient(135deg, var(--pd-accent) 0%, var(--pd-accent-dark) 100%);
	color: #fff;
	display: grid;
	place-items: center;
	font-weight: 700;
	letter-spacing: -0.02em;
	box-shadow: 0 4px 12px rgba(20,184,166,.3);
}
.pd-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.pd-brand-title { color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .2px; }
.pd-brand-sub   { color: #94A3B8; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }

.pd-nav-section { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; }
.pd-nav-label {
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 1.4px;
	color: #64748B;
	font-weight: 600;
	padding: 6px 12px;
}
.pd-nav-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 9px 12px;
	border-radius: 8px;
	color: #CBD5E1;
	font-size: 14px;
	font-weight: 500;
	transition: all .15s ease;
	cursor: pointer;
}
.pd-nav-item:hover {
	background: rgba(255,255,255,.05);
	color: #fff;
}
.pd-nav-item.active {
	background: linear-gradient(90deg, rgba(20,184,166,.18), rgba(20,184,166,0));
	color: #fff;
	box-shadow: inset 3px 0 0 var(--pd-accent);
}
.pd-nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }
.pd-nav-item.active .pd-nav-icon { color: var(--pd-accent); }

/* Topbar */
.pd-main { display: flex; flex-direction: column; min-width: 0; }
.pd-topbar {
	height: var(--pd-topbar-h);
	background: var(--pd-surface);
	border-bottom: 1px solid var(--pd-border);
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 0 28px;
	position: sticky;
	top: 0;
	z-index: 20;
	backdrop-filter: blur(8px);
}
.pd-topbar-search {
	flex: 1;
	max-width: 480px;
	position: relative;
}
.pd-topbar-search input {
	width: 100%;
	border: 1px solid var(--pd-border);
	background: var(--pd-surface-2);
	border-radius: 10px;
	padding: 9px 14px 9px 38px;
	font-size: 13px;
	color: var(--pd-text);
	outline: none;
	transition: all .15s ease;
}
.pd-topbar-search input:focus {
	border-color: var(--pd-accent);
	background: #fff;
	box-shadow: 0 0 0 3px var(--pd-accent-soft);
}
.pd-topbar-search-icon {
	position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
	color: var(--pd-text-light); pointer-events: none;
}

.pd-topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
/* IST clock in the topbar — HRMS runs on one time, Indian Standard Time. */
.pd-ist-clock {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 5px 10px; margin-right: 4px;
	border: 1px solid var(--pd-border); border-radius: 999px;
	background: var(--pd-surface); color: var(--pd-text-muted);
	font-size: 12px; line-height: 1; white-space: nowrap;
}
.pd-ist-time { color: var(--pd-text); font-weight: 600; font-variant-numeric: tabular-nums; }
.pd-ist-zone { font-size: 11px; }
@media (max-width: 640px) { .pd-ist-zone { display: none; } .pd-ist-clock { padding: 4px 8px; } }
.pd-icon-btn {
	width: 38px; height: 38px;
	border-radius: 10px;
	border: 1px solid transparent;
	background: transparent;
	color: var(--pd-text-muted);
	cursor: pointer;
	display: grid;
	place-items: center;
	position: relative;
	transition: all .15s ease;
}
.pd-icon-btn:hover { background: var(--pd-surface-2); color: var(--pd-primary); }
.pd-icon-btn .pd-badge-dot {
	position: absolute; top: 8px; right: 9px;
	width: 8px; height: 8px; border-radius: 50%;
	background: var(--pd-danger);
	border: 2px solid var(--pd-surface);
}

.pd-avatar-menu {
	display: flex; align-items: center; gap: 10px;
	padding: 4px 10px 4px 4px;
	border-radius: 999px;
	border: 1px solid var(--pd-border);
	cursor: pointer;
	transition: all .15s ease;
}
.pd-avatar-menu:hover { background: var(--pd-surface-2); }
.pd-avatar {
	width: 32px; height: 32px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--pd-accent) 0%, var(--pd-primary) 100%);
	color: #fff;
	display: grid;
	place-items: center;
	font-weight: 600;
	font-size: 13px;
}
.pd-avatar-name { font-size: 13px; font-weight: 600; color: var(--pd-text); line-height: 1.1; }
.pd-avatar-role { font-size: 11px; color: var(--pd-text-muted); line-height: 1.2; }
.pd-avatar-text { display: flex; flex-direction: column; }

/* Content area */
.pd-content {
	padding: 28px;
	flex: 1;
	min-width: 0;
}
.pd-page-head {
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
	margin-bottom: 24px;
	flex-wrap: wrap;
	gap: 16px;
}
.pd-kicker {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 1.6px;
	text-transform: uppercase;
	color: var(--pd-accent-dark);
	margin-bottom: 6px;
}
.pd-page-title { font-size: 26px; }
.pd-page-sub   { margin-top: 6px; color: var(--pd-text-muted); }

/* Cards */
.pd-card {
	background: var(--pd-surface);
	border: 1px solid var(--pd-border);
	border-radius: var(--pd-radius-lg);
	padding: 20px;
	box-shadow: var(--pd-shadow-sm);
	transition: box-shadow .2s ease, transform .2s ease;
}
.pd-card.is-hero {
	background: linear-gradient(135deg, var(--pd-primary) 0%, var(--pd-primary-2) 100%);
	color: #fff;
	border: none;
	padding: 28px;
	position: relative;
	overflow: hidden;
}
.pd-card.is-hero::after {
	content: '';
	position: absolute;
	right: -60px; top: -60px;
	width: 220px; height: 220px;
	background: radial-gradient(circle, rgba(20,184,166,.25), transparent 70%);
}
.pd-card.is-hero h1, .pd-card.is-hero h2, .pd-card.is-hero h3 { color: #fff; }
.pd-card.is-hero p { color: rgba(226,232,240,.85); }
.pd-card.is-hero .pd-kicker { color: var(--pd-accent); }
.pd-card.is-glass {
	background: rgba(255,255,255,.7);
	backdrop-filter: blur(12px);
	border: 1px solid rgba(255,255,255,.6);
}
.pd-card:hover { box-shadow: var(--pd-shadow-md); }

.pd-card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; gap: 12px; }
.pd-card-head h2, .pd-card-head h3 { margin-bottom: 4px; }

/* KPI cards */
.pd-kpi-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 16px;
	margin-bottom: 24px;
}
.pd-kpi {
	background: var(--pd-surface);
	border: 1px solid var(--pd-border);
	border-radius: var(--pd-radius-lg);
	padding: 18px 20px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	position: relative;
	overflow: hidden;
	transition: all .2s ease;
}
.pd-kpi:hover { transform: translateY(-2px); box-shadow: var(--pd-shadow-md); }
.pd-kpi-head { display: flex; justify-content: space-between; align-items: center; }
.pd-kpi-label { font-size: 12px; color: var(--pd-text-muted); font-weight: 500; }
.pd-kpi-icon {
	width: 36px; height: 36px;
	border-radius: 10px;
	display: grid; place-items: center;
	background: var(--pd-accent-soft);
	color: var(--pd-accent-dark);
}
.pd-kpi-icon.is-success { background: var(--pd-success-soft); color: var(--pd-success); }
.pd-kpi-icon.is-warning { background: var(--pd-warning-soft); color: var(--pd-warning); }
.pd-kpi-icon.is-danger  { background: var(--pd-danger-soft); color: var(--pd-danger); }
.pd-kpi-icon.is-info    { background: var(--pd-info-soft); color: var(--pd-info); }
.pd-kpi-value { font-size: 28px; font-weight: 700; color: var(--pd-primary); letter-spacing: -0.02em; line-height: 1; }
.pd-kpi-meta { font-size: 12px; color: var(--pd-text-muted); }
.pd-kpi-meta .up { color: var(--pd-success); font-weight: 600; }
.pd-kpi-meta .down { color: var(--pd-danger); font-weight: 600; }

/* Grids */
.pd-grid { display: grid; gap: 16px; }
.pd-grid-2  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pd-grid-3  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pd-grid-23 { grid-template-columns: 2fr 1fr; }
.pd-grid-32 { grid-template-columns: 1fr 2fr; }

/* Chips & badges */
.pd-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 10px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 500;
	background: var(--pd-surface-2);
	color: var(--pd-text-muted);
	border: 1px solid var(--pd-border);
}
.pd-chip.is-success { background: var(--pd-success-soft); color: var(--pd-success); border-color: transparent; }
.pd-chip.is-warning { background: var(--pd-warning-soft); color: #B45309; border-color: transparent; }
.pd-chip.is-danger  { background: var(--pd-danger-soft);  color: var(--pd-danger);  border-color: transparent; }
.pd-chip.is-info    { background: var(--pd-info-soft);    color: var(--pd-info);    border-color: transparent; }
.pd-chip.is-accent  { background: var(--pd-accent-soft);  color: var(--pd-accent-dark); border-color: transparent; }
.pd-chip.is-primary { background: var(--pd-primary); color: #fff; border-color: transparent; }

.pd-status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.pd-status-dot.is-online  { background: var(--pd-success); box-shadow: 0 0 0 3px var(--pd-success-soft); }
.pd-status-dot.is-warning { background: var(--pd-warning); }
.pd-status-dot.is-offline { background: var(--pd-text-light); }

/* Buttons */
.pd-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 9px 16px;
	border-radius: 10px;
	font-size: 13px;
	font-weight: 600;
	border: 1px solid transparent;
	cursor: pointer;
	transition: all .15s ease;
	text-decoration: none;
}
.pd-btn.is-primary {
	background: var(--pd-accent);
	color: #fff;
	box-shadow: 0 1px 2px rgba(20,184,166,.2);
}
.pd-btn.is-primary:hover { background: var(--pd-accent-dark); box-shadow: 0 4px 12px rgba(20,184,166,.3); }
.pd-btn.is-navy {
	background: var(--pd-primary);
	color: #fff;
}
.pd-btn.is-navy:hover { background: var(--pd-primary-soft); }
.pd-btn.is-ghost {
	background: transparent;
	color: var(--pd-text);
	border-color: var(--pd-border);
}
.pd-btn.is-ghost:hover { background: var(--pd-surface-2); border-color: var(--pd-border-strong); }
.pd-btn.is-danger { background: var(--pd-danger); color: #fff; }
.pd-btn.is-lg { padding: 12px 22px; font-size: 14px; }
.pd-btn.is-sm { padding: 6px 12px; font-size: 12px; }
.pd-btn.is-block { width: 100%; }

/* Forms */
.pd-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.pd-label { font-size: 12px; font-weight: 600; color: var(--pd-text); }
.pd-input, .pd-select, .pd-textarea {
	width: 100%;
	padding: 10px 14px;
	border: 1px solid var(--pd-border);
	border-radius: 10px;
	background: var(--pd-surface);
	color: var(--pd-text);
	font-size: 14px;
	font-family: inherit;
	outline: none;
	transition: all .15s ease;
}
.pd-input:focus, .pd-select:focus, .pd-textarea:focus {
	border-color: var(--pd-accent);
	box-shadow: 0 0 0 3px var(--pd-accent-soft);
}
.pd-textarea { min-height: 96px; resize: vertical; }

/* Tables */
.pd-table-wrap { background: var(--pd-surface); border: 1px solid var(--pd-border); border-radius: var(--pd-radius-lg); overflow: hidden; }
.pd-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pd-table thead th {
	background: var(--pd-surface-2);
	color: var(--pd-text-muted);
	font-weight: 600;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: .5px;
	padding: 14px 16px;
	text-align: left;
	border-bottom: 1px solid var(--pd-border);
}
.pd-table tbody td { padding: 14px 16px; border-bottom: 1px solid var(--pd-border); color: var(--pd-text); vertical-align: middle; }
.pd-table tbody tr:hover { background: var(--pd-surface-2); }
.pd-table tbody tr:last-child td { border-bottom: 0; }

/* Filter strip */
.pd-filter-strip {
	display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
	padding: 14px 18px;
	background: var(--pd-surface); border: 1px solid var(--pd-border);
	border-radius: var(--pd-radius-lg);
	margin-bottom: 16px;
}

/* Avatar in lists */
.pd-emp {
	display: flex; align-items: center; gap: 10px;
}
.pd-emp-avatar {
	width: 32px; height: 32px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--pd-accent-soft), var(--pd-accent));
	color: var(--pd-primary);
	display: grid; place-items: center;
	font-weight: 600;
	font-size: 12px;
}
.pd-emp-name { font-weight: 500; font-size: 13px; color: var(--pd-text); }
.pd-emp-code { font-size: 11px; color: var(--pd-text-muted); }

/* Activity list */
.pd-activity { display: flex; flex-direction: column; gap: 4px; }
.pd-activity-item {
	display: flex; gap: 12px; align-items: flex-start;
	padding: 10px 0;
	border-bottom: 1px dashed var(--pd-border);
}
.pd-activity-item:last-child { border-bottom: 0; }
.pd-activity-dot {
	width: 8px; height: 8px; margin-top: 6px; flex-shrink: 0;
	border-radius: 50%;
	background: var(--pd-accent);
}
.pd-activity-text { flex: 1; }
.pd-activity-title { font-size: 13px; color: var(--pd-text); font-weight: 500; }
.pd-activity-meta  { font-size: 12px; color: var(--pd-text-muted); margin-top: 2px; }

/* Tabs */
.pd-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--pd-border); margin-bottom: 20px; }
.pd-tab {
	padding: 10px 16px;
	font-size: 13px;
	font-weight: 500;
	color: var(--pd-text-muted);
	border-bottom: 2px solid transparent;
	cursor: pointer;
	transition: all .15s ease;
}
.pd-tab:hover { color: var(--pd-primary); }
.pd-tab.active { color: var(--pd-primary); border-bottom-color: var(--pd-accent); font-weight: 600; }

/* Login (split-screen) */
.pd-login {
	min-height: 100vh;
	display: grid;
	grid-template-columns: 1.1fr .9fr;
	background: var(--pd-bg);
}
.pd-login-hero {
	background: linear-gradient(135deg, var(--pd-primary) 0%, #051A2E 100%);
	color: #fff;
	padding: 56px 56px 40px;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	position: relative;
	overflow: hidden;
}
.pd-login-hero::before {
	content: '';
	position: absolute;
	top: -120px; right: -120px;
	width: 400px; height: 400px;
	background: radial-gradient(circle, rgba(20,184,166,.25), transparent 70%);
}
.pd-login-hero::after {
	content: '';
	position: absolute;
	bottom: -200px; left: -200px;
	width: 500px; height: 500px;
	background: radial-gradient(circle, rgba(20,184,166,.12), transparent 70%);
}
.pd-login-hero > * { position: relative; z-index: 1; }
.pd-login-hero h1 { color: #fff; font-size: 40px; line-height: 1.15; letter-spacing: -0.02em; margin-bottom: 16px; }
.pd-login-hero .pd-kicker { color: var(--pd-accent); }
.pd-login-hero p { color: rgba(226,232,240,.8); font-size: 16px; max-width: 460px; }
.pd-login-features { display: flex; flex-direction: column; gap: 14px; margin-top: 36px; }
.pd-login-feature {
	display: flex; gap: 12px; align-items: center;
	color: rgba(226,232,240,.92); font-size: 14px;
}
.pd-login-feature .check {
	width: 22px; height: 22px;
	border-radius: 50%;
	background: rgba(20,184,166,.15);
	border: 1px solid var(--pd-accent);
	color: var(--pd-accent);
	display: grid; place-items: center;
	font-size: 12px;
}

.pd-login-form-wrap {
	display: grid;
	place-items: center;
	padding: 40px;
}
.pd-login-card {
	width: 100%;
	max-width: 420px;
	background: var(--pd-surface);
	border: 1px solid var(--pd-border);
	border-radius: 18px;
	padding: 36px;
	box-shadow: var(--pd-shadow-lg);
}
.pd-login-card h2 { font-size: 24px; margin-bottom: 4px; }
.pd-login-card .pd-card-sub { color: var(--pd-text-muted); font-size: 14px; margin-bottom: 26px; }
.pd-login-meta {
	display: flex; justify-content: space-between; align-items: center;
	font-size: 12px; color: var(--pd-text-muted);
	margin: -6px 0 18px;
}
.pd-login-meta a { color: var(--pd-accent-dark); font-weight: 600; }
.pd-login-error {
	background: var(--pd-danger-soft); color: var(--pd-danger);
	padding: 10px 14px; border-radius: 10px; font-size: 13px; font-weight: 500;
	margin-bottom: 16px;
}
.pd-login-footer { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--pd-border); font-size: 12px; color: var(--pd-text-muted); text-align: center; }

/* Employee hero (check-in card) */
.pd-checkin {
	background: linear-gradient(135deg, var(--pd-primary) 0%, #0E2D4D 60%, #143A66 100%);
	color: #fff;
	border-radius: 18px;
	padding: 28px;
	position: relative;
	overflow: hidden;
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 24px;
	align-items: center;
}
.pd-checkin::before {
	content: '';
	position: absolute;
	inset: 0;
	background: radial-gradient(circle at top right, rgba(20,184,166,.25), transparent 60%);
	pointer-events: none;
}
.pd-checkin > * { position: relative; z-index: 1; }
.pd-checkin .pd-kicker { color: var(--pd-accent); }
.pd-checkin h1 { color: #fff; font-size: 28px; margin-bottom: 8px; }
.pd-checkin p  { color: rgba(226,232,240,.8); font-size: 14px; }
.pd-checkin-stats { display: flex; gap: 24px; margin-top: 18px; }
.pd-checkin-stat { display: flex; flex-direction: column; gap: 2px; }
.pd-checkin-stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: rgba(226,232,240,.6); }
.pd-checkin-stat-value { font-size: 18px; font-weight: 600; color: #fff; }
.pd-checkin-cta {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	background: rgba(255,255,255,.08);
	padding: 22px;
	border-radius: 16px;
	border: 1px solid rgba(255,255,255,.12);
	backdrop-filter: blur(8px);
}
.pd-timer {
	font-family: 'JetBrains Mono', monospace;
	font-size: 30px;
	font-weight: 700;
	color: var(--pd-accent);
	letter-spacing: 1px;
}

/* Calendar */
.pd-cal {
	background: var(--pd-surface);
	border: 1px solid var(--pd-border);
	border-radius: var(--pd-radius-lg);
	padding: 20px;
}
.pd-cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 12px; }
.pd-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.pd-cal-day-head { font-size: 11px; text-align: center; color: var(--pd-text-muted); padding: 6px 0; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.pd-cal-cell {
	aspect-ratio: 1 / 1;
	border-radius: 10px;
	border: 1px solid var(--pd-border);
	padding: 6px;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	font-size: 12px;
	background: var(--pd-surface);
	cursor: pointer;
	transition: all .15s ease;
	min-height: 64px;
}
.pd-cal-cell:hover { border-color: var(--pd-accent); }
.pd-cal-cell.is-muted { background: var(--pd-surface-2); color: var(--pd-text-light); border-color: transparent; cursor: default; }
.pd-cal-cell.is-today { border-color: var(--pd-accent); box-shadow: 0 0 0 2px var(--pd-accent-soft); }
/* Status-driven calendar cells — class names match attendance/service.py _cal_css() output */
.pd-cal-cell { position: relative; }
.pd-cal-cell.pd-cal-present  { background: var(--pd-success-soft); border-color: transparent; }
.pd-cal-cell.pd-cal-absent   { background: var(--pd-danger-soft);  border-color: transparent; }
.pd-cal-cell.pd-cal-late     { background: var(--pd-warning-soft); border-color: transparent; }
.pd-cal-cell.pd-cal-half     { background: #FFEDD5;                border-color: transparent; }  /* orange-100 */
.pd-cal-cell.pd-cal-early-out { background: #FED7AA;               border-color: transparent; }  /* orange-200 */
.pd-cal-cell.pd-cal-missing  { background: #FECACA;                border-color: transparent; }  /* red-200 — missing punch */
.pd-cal-cell.pd-cal-leave    { background: #DBEAFE;                border-color: transparent; }  /* blue-100 */
.pd-cal-cell.pd-cal-holiday  { background: #EDE9FE;                border-color: transparent; }  /* purple-100 */
.pd-cal-cell.pd-cal-weekoff  { background: #F1F5F9;                border-color: transparent; }  /* slate-100 */
.pd-cal-cell.pd-cal-empty    { background: var(--pd-surface); }

/* Status dot — small colored indicator in top-left of each cell */
.pd-cal-cell::before { content: ''; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: transparent; }
.pd-cal-cell.pd-cal-present::before  { background: #16A34A; }
.pd-cal-cell.pd-cal-absent::before   { background: #DC2626; }
.pd-cal-cell.pd-cal-late::before     { background: #F59E0B; }
.pd-cal-cell.pd-cal-half::before     { background: #EA580C; }
.pd-cal-cell.pd-cal-early-out::before { background: #C2410C; }
.pd-cal-cell.pd-cal-missing::before  { background: #B91C1C; }
.pd-cal-cell.pd-cal-leave::before    { background: #2563EB; }
.pd-cal-cell.pd-cal-holiday::before  { background: #7C3AED; }
.pd-cal-cell.pd-cal-weekoff::before  { background: #64748B; }

/* Legacy is-* aliases (some templates may still use these) */
.pd-cal-cell.is-present { background: var(--pd-success-soft); border-color: transparent; }
.pd-cal-cell.is-absent  { background: var(--pd-danger-soft); border-color: transparent; }
.pd-cal-cell.is-late    { background: var(--pd-warning-soft); border-color: transparent; }
.pd-cal-cell.is-leave   { background: #DBEAFE; border-color: transparent; }
.pd-cal-cell.is-holiday { background: #EDE9FE; border-color: transparent; }

.pd-cal-date { font-weight: 600; color: var(--pd-text); font-size: 12px; }
.pd-cal-status { font-size: 10px; color: var(--pd-text-muted); }

.pd-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--pd-text-muted); }
.pd-legend-item { display: flex; align-items: center; gap: 6px; }
.pd-legend-swatch { width: 10px; height: 10px; border-radius: 3px; }

/* Profile */
.pd-profile-head {
	display: flex;
	align-items: center;
	gap: 20px;
	padding: 24px;
	background: linear-gradient(135deg, var(--pd-primary) 0%, var(--pd-primary-2) 100%);
	border-radius: var(--pd-radius-lg);
	color: #fff;
	margin-bottom: 16px;
}
.pd-profile-avatar {
	width: 80px; height: 80px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--pd-accent), var(--pd-accent-dark));
	display: grid; place-items: center;
	font-size: 28px;
	font-weight: 700;
	color: #fff;
	border: 3px solid rgba(255,255,255,.2);
}
.pd-profile-info h1 { color: #fff; font-size: 24px; margin-bottom: 4px; }
.pd-profile-info p  { color: rgba(226,232,240,.8); }

.pd-info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 32px; }
.pd-info-row { display: flex; flex-direction: column; gap: 2px; }
.pd-info-label { font-size: 11px; color: var(--pd-text-muted); text-transform: uppercase; letter-spacing: .8px; font-weight: 600; }
.pd-info-value { font-size: 14px; color: var(--pd-text); font-weight: 500; }

/* Misc helpers */
.pd-spacer-sm { height: 8px; }
.pd-spacer    { height: 16px; }
.pd-spacer-lg { height: 24px; }
.pd-flex { display: flex; }
.pd-flex-between { display: flex; justify-content: space-between; align-items: center; }
.pd-flex-end { display: flex; justify-content: flex-end; gap: 8px; }
.pd-muted { color: var(--pd-text-muted); }
.pd-mono  { font-family: 'JetBrains Mono', monospace; }

/* Responsive */
@media (max-width: 1080px) {
	.pd-kpi-grid { grid-template-columns: repeat(2, 1fr); }
	.pd-grid-23, .pd-grid-32 { grid-template-columns: 1fr; }
	.pd-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
	.pd-shell { grid-template-columns: 1fr; }
	.pd-sidebar { display: none; }
	.pd-login { grid-template-columns: 1fr; }
	.pd-login-hero { padding: 32px; min-height: 240px; }
	.pd-content { padding: 18px; }
	.pd-checkin { grid-template-columns: 1fr; }
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.pd-badge {
	display: inline-flex; align-items: center;
	padding: 2px 8px; border-radius: 5px; font-size: 11px; font-weight: 600;
	letter-spacing: .03em; background: var(--pd-surface-2); color: var(--pd-text-muted);
	border: 1px solid var(--pd-border);
}
.pd-badge.is-success { background: var(--pd-success-soft); color: var(--pd-success); border-color: transparent; }
.pd-badge.is-warning { background: var(--pd-warning-soft); color: #B45309; border-color: transparent; }
.pd-badge.is-danger  { background: var(--pd-danger-soft);  color: var(--pd-danger);  border-color: transparent; }
.pd-badge.is-info    { background: var(--pd-info-soft);    color: var(--pd-info);    border-color: transparent; }
.pd-badge.is-muted   { background: var(--pd-surface-2);    color: var(--pd-text-muted); }
.pd-badge.is-secondary { background: var(--pd-surface-2);  color: var(--pd-text-light); }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.pd-alert {
	padding: 12px 16px; border-radius: var(--pd-radius); font-size: 13px;
	border-left: 3px solid currentColor;
}
.pd-alert.is-success { background: var(--pd-success-soft); color: var(--pd-success); }
.pd-alert.is-danger  { background: var(--pd-danger-soft);  color: var(--pd-danger); }
.pd-alert.is-warning { background: var(--pd-warning-soft); color: #B45309; }
.pd-alert.is-info    { background: var(--pd-info-soft);    color: var(--pd-info); }
.pd-alert.is-secondary { background: var(--pd-surface-2);  color: var(--pd-text-muted); border-left-color: var(--pd-border); }

/* ── Hint text ───────────────────────────────────────────────────────────── */
.pd-hint { font-size: 11px; color: var(--pd-text-muted); margin-top: 2px; }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.pd-empty-state {
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	padding: 64px 24px; text-align: center;
	background: var(--pd-surface); border: 1px solid var(--pd-border);
	border-radius: var(--pd-radius-lg);
}
.pd-empty-title { font-size: 15px; font-weight: 600; color: var(--pd-text); margin: 0 0 6px; }
.pd-empty-sub   { font-size: 13px; color: var(--pd-text-muted); margin: 0 0 20px; max-width: 360px; }

/* ── Danger ghost button ─────────────────────────────────────────────────── */
.pd-btn.is-danger-ghost {
	background: transparent; color: var(--pd-danger);
	border: 1px solid var(--pd-danger-soft);
}
.pd-btn.is-danger-ghost:hover { background: var(--pd-danger-soft); border-color: var(--pd-danger); }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.pd-modal-backdrop {
	display: none; position: fixed; inset: 0; z-index: 1000;
	background: rgba(0,0,0,.45); align-items: center; justify-content: center;
	overflow-y: auto; padding: 24px;
}
.pd-modal {
	background: var(--pd-surface); border-radius: var(--pd-radius-lg);
	box-shadow: 0 20px 60px rgba(0,0,0,.25); width: 100%; max-width: 420px;
	margin: auto;
}
.pd-modal-head {
	display: flex; align-items: center; justify-content: space-between;
	padding: 18px 20px; border-bottom: 1px solid var(--pd-border);
}
.pd-modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.pd-modal-body { padding: 20px; }
.pd-modal-foot {
	display: flex; justify-content: flex-end; gap: 8px;
	padding: 14px 20px; border-top: 1px solid var(--pd-border);
}
.pd-modal-close {
	background: none; border: none; cursor: pointer; color: var(--pd-text-muted);
	font-size: 16px; padding: 4px; line-height: 1; border-radius: 4px;
}
.pd-modal-close:hover { color: var(--pd-text); background: var(--pd-surface-2); }

/* A list capped at 4 items (the cap itself is set by the script in
   layouts/app_shell.html); only a capped list scrolls, so up to 4 items it
   renders exactly as before. */
.pd-scroll-4.is-capped {
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	scrollbar-color: var(--pd-border-strong) transparent;
	padding-right: 4px;
}
.pd-scroll-4.is-capped::-webkit-scrollbar { width: 6px; }
.pd-scroll-4.is-capped::-webkit-scrollbar-thumb { background: var(--pd-border-strong); border-radius: 6px; }
.pd-scroll-4.is-capped::-webkit-scrollbar-track { background: transparent; }

/* ═══════════════════════════════════════════════════════════════════════════
   DARK THEME
   Activated by `data-theme="dark"` on <html>, set by the topbar theme toggle
   and restored from localStorage by the inline script in layouts/app_shell.html.

   Everything below only REDEFINES existing tokens — no component rule is
   duplicated unless it hardcoded a light colour that cannot follow a token.
   Light mode is completely untouched.
   ═══════════════════════════════════════════════════════════════════════════ */
:root[data-theme="dark"] {
	/* `--pd-primary` does double duty in light mode: it is both the sidebar
	   background AND the heading/KPI text colour. In dark mode those two needs
	   diverge, so the token becomes the LIGHT text colour here and the sidebar
	   gets its own explicit background a few rules down. */
	--pd-primary: #CBD9EC;
	--pd-primary-soft: #93A9C4;
	--pd-primary-2: #1B4068;

	--pd-accent: #2DD4BF;
	--pd-accent-soft: rgba(45, 212, 191, .16);
	--pd-accent-dark: #14B8A6;

	--pd-bg: #0B1220;
	--pd-surface: #141D2E;
	--pd-surface-2: #1C2839;
	--pd-border: #263449;
	--pd-border-strong: #36485F;

	--pd-text: #E6EDF7;
	--pd-text-muted: #94A3B8;
	--pd-text-light: #6B7C93;

	--pd-success: #4ADE80;
	--pd-success-soft: rgba(74, 222, 128, .14);
	--pd-warning: #FBBF24;
	--pd-warning-soft: rgba(251, 191, 36, .14);
	--pd-danger: #F87171;
	--pd-danger-soft: rgba(248, 113, 113, .14);
	--pd-info: #38BDF8;
	--pd-info-soft: rgba(56, 189, 248, .14);

	--pd-shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
	--pd-shadow-md: 0 6px 24px rgba(0, 0, 0, .40);
	--pd-shadow-lg: 0 20px 50px rgba(0, 0, 0, .50);
	--pd-glass: rgba(20, 29, 46, .72);

	--pd-success-dark: #22C55E;

	/* Navy fill for surfaces that carry white text (see --pd-primary above). */
	--pd-primary-fill: #1E3A5F;

	color-scheme: dark;
}

/* Surfaces that paint --pd-primary as a BACKGROUND under white text. With
   --pd-primary turned light in dark mode they went pale and the white text on
   them became unreadable, so they get a real navy here. */
:root[data-theme="dark"] .pd-checkin {
	background: linear-gradient(135deg, #12304F 0%, #0E2742 60%, #143A66 100%);
	border: 1px solid var(--pd-border);
}
:root[data-theme="dark"] .pd-card.is-hero,
:root[data-theme="dark"] .pd-profile-head {
	background: linear-gradient(135deg, #12304F 0%, #1B4068 100%);
	border: 1px solid var(--pd-border);
}
:root[data-theme="dark"] .pd-login-hero { background: linear-gradient(135deg, #12304F 0%, #051A2E 100%); }
:root[data-theme="dark"] .pd-avatar { background: linear-gradient(135deg, var(--pd-accent-dark) 0%, #1E3A5F 100%); }
:root[data-theme="dark"] .pd-btn.is-navy,
:root[data-theme="dark"] .pd-chip.is-primary { background: var(--pd-primary-fill); }
:root[data-theme="dark"] .pd-btn.is-navy:hover { background: #24476E; }

/* Calendar cells hardcoded light pastels; in dark they become tinted fills. */
:root[data-theme="dark"] .pd-cal-cell.pd-cal-half      { background: rgba(234, 88, 12, .18); }
:root[data-theme="dark"] .pd-cal-cell.pd-cal-early-out { background: rgba(251, 146, 60, .22); }
:root[data-theme="dark"] .pd-cal-cell.pd-cal-missing   { background: rgba(248, 113, 113, .20); }
:root[data-theme="dark"] .pd-cal-cell.pd-cal-leave,
:root[data-theme="dark"] .pd-cal-cell.is-leave         { background: rgba(96, 165, 250, .18); }
:root[data-theme="dark"] .pd-cal-cell.pd-cal-holiday,
:root[data-theme="dark"] .pd-cal-cell.is-holiday       { background: rgba(167, 139, 250, .18); }
:root[data-theme="dark"] .pd-cal-cell.pd-cal-weekoff   { background: var(--pd-surface-2); }

/* Sidebar keeps a dark background — see the note on --pd-primary above. */
:root[data-theme="dark"] .pd-sidebar {
	background: #0E1726;
	border-right: 1px solid var(--pd-border);
}

/* Rules that hardcoded a light colour on a light surface. */
:root[data-theme="dark"] .pd-topbar-search input:focus { background: var(--pd-surface-2); }
:root[data-theme="dark"] .pd-card.is-glass {
	background: var(--pd-glass);
	border: 1px solid var(--pd-border);
}

/* Images and charts are authored for a light canvas; take the edge off. */
:root[data-theme="dark"] img:not([src*=".svg"]) { filter: brightness(.92); }

/* Native controls (date pickers, selects, scrollbars) follow color-scheme. */
:root[data-theme="dark"] .pd-input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
	background: var(--pd-surface-2);
	color: var(--pd-text);
	border-color: var(--pd-border);
}

/* Theme toggle icon: show sun in dark mode, moon in light mode. */
.pd-theme-icon-dark { display: none; }
:root[data-theme="dark"] .pd-theme-icon-light { display: none; }
:root[data-theme="dark"] .pd-theme-icon-dark { display: block; }

/* ── Avatar dropdown ─────────────────────────────────────────────────────── */
.pd-avatar-wrap { position: relative; }
.pd-avatar-menu .pd-avatar-caret { transition: transform .15s ease; }
.pd-avatar-wrap.is-open .pd-avatar-caret { transform: rotate(180deg); }
.pd-avatar-dropdown {
	display: none;
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	min-width: 232px;
	max-width: calc(100vw - 24px);
	background: var(--pd-surface);
	border: 1px solid var(--pd-border);
	border-radius: 10px;
	box-shadow: var(--pd-shadow-md);
	z-index: 500;
	overflow: hidden;
	padding: 6px;
}
.pd-avatar-wrap.is-open .pd-avatar-dropdown { display: block; }
.pd-avatar-dropdown-head {
	padding: 10px 12px 12px;
	border-bottom: 1px solid var(--pd-border);
	margin: -6px -6px 6px;
}
.pd-avatar-dropdown-name {
	font-size: 13px; font-weight: 600; color: var(--pd-text);
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pd-avatar-dropdown-meta {
	font-size: 11px; color: var(--pd-text-muted); margin-top: 2px;
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pd-avatar-item {
	display: flex; align-items: center; gap: 10px;
	width: 100%;
	padding: 9px 12px;
	border: none;
	background: none;
	border-radius: 8px;
	font: inherit;
	font-size: 13px;
	color: var(--pd-text);
	cursor: pointer;
	text-align: left;
	text-decoration: none;
	transition: background .12s ease;
}
.pd-avatar-item:hover { background: var(--pd-surface-2); }
.pd-avatar-item svg { flex-shrink: 0; color: var(--pd-text-muted); }
.pd-avatar-item.is-danger { color: var(--pd-danger); }
.pd-avatar-item.is-danger svg { color: var(--pd-danger); }
.pd-avatar-item .pd-avatar-item-state {
	margin-left: auto; font-size: 11px; color: var(--pd-text-muted);
}
.pd-avatar-sep { height: 1px; background: var(--pd-border); margin: 6px 0; }
