/* Staff Activity (leadership). Builds on the staff panel intro card, the management analytics
   summary/segmented controls, and the global badge/button styles; only page layout lives here. */

.staff-activity {
	--analytics-accent: 76, 194, 255;
	--analytics-accent-strong: #61c9ff;
	--analytics-positive: #5de6a7;
	--analytics-negative: #ff708b;
	--staff-line: rgba(255, 255, 255, 0.06);
	--staff-surface: rgba(5, 11, 29, 0.45);
	--staff-success: #4ade80;
	--staff-warning: #facc15;
	--staff-info: #38bdf8;
	--staff-danger: #f87171;
	--staff-primary: #a5b4fc;
	--staff-secondary: #94a3b8;
}

.staff-activity .min-w-0 { min-width: 0; }

/* Intro + filters share one card. The dropdown must escape it, so the card cannot clip;
   the decorative glow is redrawn inside the card's own bounds instead. */
.staff-intro {
	z-index: 3;
	overflow: visible;
}
.staff-intro::after {
	inset: 0;
	width: auto;
	height: auto;
	border-radius: inherit;
	background: radial-gradient(circle at 100% 100%, rgba(125, 211, 252, 0.14), rgba(125, 211, 252, 0) 45%);
	filter: none;
}
.staff-intro .card-body { padding: 1rem 1.15rem; }
.staff-intro .breadcrumb { font-size: 0.78rem; }
.staff-intro-actions { display: flex; flex: 0 0 auto; gap: 0.35rem; margin-left: auto; align-self: flex-start; }
.staff-intro-actions .btn { display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; padding: 0; }
.staff-activity[aria-busy="true"] #staff-refresh i { animation: analytics-spin 0.75s linear infinite; }
.staff-online-list,
.staff-records .analytics-summary-grid,
.staff-table-wrap,
.staff-history-list { transition: opacity 0.15s ease; }
.staff-activity[aria-busy="true"] :is(.staff-online-list, .analytics-summary-grid, .staff-table-wrap, .staff-history-list) { opacity: 0.55; }

.staff-filters {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.55rem 0.6rem;
	margin-top: 0.85rem;
}
.staff-filter { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; margin: 0; }
.staff-filter--staff,
.staff-filter--range { grid-column: 1 / -1; }
.staff-filter--range { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.staff-filter--range label { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; margin: 0; }
.staff-filter-label {
	color: rgba(226, 232, 240, 0.72);
	font-size: 0.64rem;
	font-weight: 700;
	letter-spacing: 0.09em;
	text-transform: uppercase;
}
.staff-filters .form-select,
.staff-filters .form-control { min-height: 2.35rem; font-size: 0.86rem; }

@media (min-width: 768px) {
	.staff-filters { display: flex; flex-wrap: wrap; align-items: flex-end; }
	.staff-filter { flex: 1 1 10rem; }
	.staff-filter--staff { flex: 2 1 17rem; }
	.staff-filter--range { flex: 2 1 19rem; }
}

/* Staff picker (Bootstrap dropdown styled like a select) */
.staff-picker-toggle {
	display: flex;
	align-items: center;
	min-width: 0;
	text-align: left;
	cursor: pointer;
}
.staff-picker-current { display: flex; align-items: center; gap: 0.5rem; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.staff-picker-current .staff-avatar { width: 1.4rem; height: 1.4rem; }
.staff-picker-menu {
	width: min(24rem, calc(100vw - 2rem));
	padding: 0.5rem;
}
.staff-picker-search { position: relative; margin-bottom: 0.4rem; }
.staff-picker-search i { position: absolute; top: 50%; left: 0.6rem; transform: translateY(-50%); color: var(--bs-secondary-color); pointer-events: none; }
.staff-picker-search input { padding-left: 1.9rem; }
.staff-picker-list { display: grid; gap: 0.1rem; max-height: min(22rem, 55vh); overflow-y: auto; }
.staff-picker-item {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	width: 100%;
	padding: 0.35rem 0.45rem;
	border: 0;
	border-radius: var(--radius-sm);
	background: transparent;
	color: inherit;
	text-align: left;
}
.staff-picker-item:hover,
.staff-picker-item:focus-visible { background: rgba(125, 211, 252, 0.12); outline: none; }
.staff-picker-item[aria-selected="true"] { background: rgba(var(--analytics-accent), 0.18); }
.staff-picker-item-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.staff-picker-item-text strong { overflow: hidden; font-size: 0.85rem; white-space: nowrap; text-overflow: ellipsis; }
.staff-picker-item-text small { overflow: hidden; color: var(--bs-secondary-color); font-size: 0.72rem; white-space: nowrap; text-overflow: ellipsis; }
.staff-picker-empty { padding: 0.5rem; color: var(--bs-secondary-color); font-size: 0.8rem; }

.staff-message { margin-top: 0.55rem; color: rgba(226, 232, 240, 0.7); font-size: 0.76rem; }
.staff-message:empty { display: none; }
.staff-message[data-tone="danger"] { color: #fecaca; }
.staff-message[data-tone="warning"] { color: #fde68a; }

/* Shared bits */
.staff-section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
.staff-section-title { display: flex; align-items: center; gap: 0.45rem; margin: 0; font-size: 0.95rem; font-weight: 700; }
.staff-section-note { color: var(--bs-secondary-color); font-size: 0.74rem; cursor: help; }
.staff-empty { padding: 0.85rem 1rem; color: var(--bs-secondary-color); font-size: 0.82rem; text-align: center; }

.staff-avatar {
	flex: 0 0 auto;
	width: 2rem;
	height: 2rem;
	border-radius: 50%;
	background: rgba(41, 41, 41, 0.35);
	object-fit: cover;
}
.staff-avatar--sm { width: 1.3rem; height: 1.3rem; }
.staff-avatar-wrap { position: relative; display: inline-flex; flex: 0 0 auto; }
.staff-dot {
	position: absolute;
	right: -0.1rem;
	bottom: -0.1rem;
	width: 0.7rem;
	height: 0.7rem;
	border: 2px solid #121a33;
	border-radius: 50%;
	background: var(--staff-secondary);
}
.staff-dot--active { background: var(--staff-success); }
.staff-dot--inactive { background: var(--staff-warning); }
.staff-dot--pending { background: var(--staff-info); }
.staff-dot--roleplay { background: var(--staff-primary); }

.staff-name { color: #e4edff; font-weight: 650; text-decoration: none; }
a.staff-name:hover { color: #fff; text-decoration: underline; }

.staff-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	padding: 0.08rem 0.4rem;
	border: 1px solid rgba(148, 163, 184, 0.22);
	border-radius: 999px;
	background: rgba(148, 163, 184, 0.08);
	color: rgba(226, 232, 240, 0.85);
	font-size: 0.7rem;
	font-weight: 600;
	line-height: 1.35;
	white-space: nowrap;
}
.staff-chip--warning { border-color: rgba(250, 204, 21, 0.35); background: rgba(250, 204, 21, 0.1); color: #fde68a; }
.staff-chip--danger { border-color: rgba(248, 113, 113, 0.38); background: rgba(248, 113, 113, 0.1); color: #fecaca; }
.staff-chip--info { border-color: rgba(56, 189, 248, 0.35); background: rgba(56, 189, 248, 0.1); color: #bae6fd; }
.staff-chips { display: flex; flex-wrap: wrap; gap: 0.2rem; margin-top: 0.2rem; }

.staff-badge { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.16rem 0.42rem; font-size: 0.68rem; }
.staff-pulse {
	display: inline-block;
	width: 0.55rem;
	height: 0.55rem;
	border-radius: 50%;
	background: var(--staff-success);
	box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6);
	animation: staff-pulse 2s ease-out infinite;
}
@keyframes staff-pulse { 70% { box-shadow: 0 0 0 0.45rem rgba(74, 222, 128, 0); } 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); } }

.staff-help { cursor: help; text-decoration: underline dotted rgba(226, 232, 240, 0.35); text-underline-offset: 0.2em; }

.staff-id {
	display: inline-flex;
	align-items: center;
	gap: 0.2rem;
	padding: 0;
	border: 0;
	background: none;
	color: rgba(148, 163, 184, 0.75);
	font-family: var(--bs-font-monospace);
	font-size: 0.66rem;
}
.staff-id:hover,
.staff-id:focus-visible { color: #bae6fd; }

.staff-tone--success { background: rgba(34, 197, 94, 0.14); color: #86efac; }
.staff-tone--warning { background: rgba(250, 204, 21, 0.13); color: #fde68a; }
.staff-tone--info { background: rgba(56, 189, 248, 0.14); color: #7dd3fc; }
.staff-tone--danger { background: rgba(248, 113, 113, 0.14); color: #fca5a5; }
.staff-tone--primary { background: rgba(129, 140, 248, 0.16); color: #c7d2fe; }
.staff-tone--secondary { background: rgba(148, 163, 184, 0.13); color: #cbd5e1; }

.staff-delta { display: inline-flex; align-items: center; color: var(--bs-secondary-color); font-size: 0.7rem; font-weight: 650; white-space: nowrap; }
.staff-delta i { font-size: 1rem; line-height: 1; }
.staff-delta--good { color: var(--analytics-positive); }
.staff-delta--bad { color: var(--analytics-negative); }

/* Online now: live status, visually separate from the confirmed period records below */
.staff-online {
	border-color: rgba(74, 222, 128, 0.22);
	background: linear-gradient(120deg, rgba(34, 197, 94, 0.07), transparent 55%), rgba(255, 255, 255, 0.04);
}
.staff-online .card-body { padding: 0.75rem 1rem; }
.staff-online-count { background: rgba(34, 197, 94, 0.2); color: #bbf7d0; font-size: 0.7rem; }
.staff-online-breakdown { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.staff-breakdown { padding: 0.05rem 0.4rem; border-radius: 999px; font-size: 0.68rem; font-weight: 650; }
.staff-breakdown--success { background: rgba(34, 197, 94, 0.14); color: #86efac; }
.staff-breakdown--warning { background: rgba(250, 204, 21, 0.13); color: #fde68a; }
.staff-breakdown--info { background: rgba(56, 189, 248, 0.14); color: #7dd3fc; }
.staff-breakdown--primary { background: rgba(129, 140, 248, 0.16); color: #c7d2fe; }
.staff-breakdown--secondary { background: rgba(148, 163, 184, 0.13); color: #cbd5e1; }
#staff-online-updated[data-stale="true"] { color: #fde68a; }
.staff-online-list > .staff-empty { grid-column: 1 / -1; padding: 0.4rem 0; text-align: left; }
.staff-period-chips:empty { display: none !important; }
.staff-online-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
	gap: 0.45rem;
	margin-top: 0.6rem;
}
.staff-online-item {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	min-width: 0;
	padding: 0.4rem 0.55rem;
	border: 1px solid rgba(125, 211, 252, 0.12);
	border-left: 3px solid var(--staff-secondary);
	border-radius: var(--radius-sm);
	background: var(--staff-surface);
	cursor: pointer;
	transition: border-color var(--transition-fast), background var(--transition-fast);
}
.staff-online-item:hover,
.staff-online-item:focus-visible { border-color: rgba(125, 211, 252, 0.4); background: rgba(14, 40, 80, 0.55); outline: none; }
.staff-online-item.is-selected { border-color: rgba(var(--analytics-accent), 0.6); }
.staff-online-item[data-status="active"] { border-left-color: var(--staff-success); }
.staff-online-item[data-status="inactive"] { border-left-color: var(--staff-warning); }
.staff-online-item[data-status="pending"] { border-left-color: var(--staff-info); }
.staff-online-item[data-status="roleplay"] { border-left-color: var(--staff-primary); }
.staff-online-body { display: flex; flex: 1 1 auto; flex-direction: column; gap: 0.15rem; min-width: 0; }
.staff-online-top { display: flex; align-items: baseline; gap: 0.4rem; min-width: 0; }
.staff-online-name { flex: 1 1 auto; min-width: 0; overflow: hidden; font-size: 0.86rem; white-space: nowrap; text-overflow: ellipsis; }
.staff-online-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem; }
.staff-ago { flex: 0 0 auto; color: var(--bs-secondary-color); font-size: 0.68rem; white-space: nowrap; cursor: help; }
.staff-online-more { padding: 0.25rem 0 0; font-size: 0.78rem; text-decoration: none; }
.staff-online-name .staff-sub { margin-left: 0.25rem; }

/* Active filter chips and picker extras */
.staff-filter-chip { gap: 0.3rem; padding-right: 0.15rem; font-size: 0.74rem; }
.staff-filter-chip .staff-avatar { width: 1.05rem; height: 1.05rem; }
.staff-chip-x {
	display: inline-grid;
	place-items: center;
	width: 1.1rem;
	height: 1.1rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	line-height: 1;
}
.staff-chip-x:hover,
.staff-chip-x:focus-visible { background: rgba(255, 255, 255, 0.14); outline: none; }
.staff-picker-all { display: inline-grid; flex: 0 0 auto; place-items: center; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: rgba(125, 211, 252, 0.14); font-size: 0.75rem; }
.staff-picker-live { flex: 0 0 auto; width: 0.5rem; height: 0.5rem; margin-left: auto; border-radius: 50%; background: var(--staff-success); }
.staff-picker-item .staff-avatar { width: 1.3rem; height: 1.3rem; }

/* Records: KPI row + summary table */
.staff-records-head { padding: 0.85rem 1rem; }
.staff-records-head .analytics-eyebrow { margin-bottom: 0.15rem; }
.staff-period { color: var(--bs-secondary-color); font-size: 0.78rem; }
.staff-records .analytics-summary { padding: 0.65rem 1rem; cursor: help; }
.staff-records .analytics-summary-icon { width: 1.9rem; height: 1.9rem; }
.staff-records .analytics-summary-value { font-size: 1.12rem; }
.staff-records .analytics-summary-detail { display: flex; flex-wrap: wrap; align-items: center; gap: 0.1rem 0.4rem; }

.staff-table-wrap { overflow-x: auto; }
.staff-table { margin: 0; font-size: 0.84rem; }
.staff-table th,
.staff-table td { padding: 0.45rem 0.6rem; }
.staff-table th:first-child,
.staff-table td:first-child { padding-left: 1rem; }
.staff-table th:last-child,
.staff-table td:last-child { padding-right: 1rem; }
.staff-table thead th {
	border-bottom: 1px solid var(--staff-line);
	color: rgba(226, 232, 240, 0.66);
	font-size: 0.64rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	white-space: nowrap;
}
.staff-sort {
	display: inline-flex;
	align-items: center;
	gap: 0.2rem;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	letter-spacing: inherit;
	text-transform: inherit;
}
.staff-sort-icon { font-size: 0.62rem; opacity: 0.35; }
th[aria-sort="ascending"] .staff-sort-icon,
th[aria-sort="descending"] .staff-sort-icon { opacity: 1; }
th[aria-sort="ascending"] .staff-sort,
th[aria-sort="descending"] .staff-sort { color: var(--analytics-accent-strong); }
.staff-sort:focus-visible { outline: 2px solid rgba(var(--analytics-accent), 0.9); outline-offset: 2px; }
.staff-table tbody tr { cursor: pointer; }
.staff-table tbody tr + tr > td { border-top: 1px solid var(--staff-line); }
.staff-table tbody tr:focus-visible { outline: 2px solid rgba(var(--analytics-accent), 0.8); outline-offset: -2px; }
.staff-table tbody tr.is-selected > td { background: rgba(var(--analytics-accent), 0.07) !important; }
.staff-table td { vertical-align: middle; }
.staff-person { display: flex; align-items: center; gap: 0.6rem; min-width: 12rem; max-width: 15rem; }
.staff-person-sub > span { overflow: hidden; max-width: 100%; white-space: nowrap; text-overflow: ellipsis; }
.staff-table td.staff-cell-inactive { min-width: 12rem; }
/* In the desktop table the Discord ID collapses to its icon (tooltip shows it, click copies it) to keep rows two lines tall. */
@media (min-width: 992px) {
	.staff-person-sub .staff-id span { display: none; }
}
@media (min-width: 992px) and (max-width: 1199.98px) {
	.staff-person { min-width: 10rem; max-width: 13rem; }
	.staff-table td.staff-cell-inactive { min-width: 9rem; }
	.staff-table th,
	.staff-table td { padding-right: 0.4rem; padding-left: 0.4rem; }
	.staff-table thead th { letter-spacing: 0.04em; }
}
.staff-person-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.staff-person-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 0.1rem 0.55rem; color: var(--bs-secondary-color); font-size: 0.72rem; }
.staff-value { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.staff-value.is-zero { color: rgba(148, 163, 184, 0.55); font-weight: 500; }
.staff-unit,
.staff-sub { color: var(--bs-secondary-color); font-size: 0.7rem; white-space: nowrap; }
.staff-ok { color: rgba(134, 239, 172, 0.55); }
.staff-sort-mobile { display: none; }

@media (max-width: 991.98px) {
	.staff-sort-mobile { display: block; width: auto; }
	.staff-table thead { display: none; }
	.staff-table,
	.staff-table tbody,
	.staff-table tr,
	.staff-table td { display: block; }
	.staff-table tbody tr {
		display: grid;
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: 0.45rem 0.5rem;
		padding: 0.65rem 0.85rem;
	}
	.staff-table tbody tr + tr > td { border-top: 0; }
	.staff-table tbody tr + tr { border-top: 1px solid var(--staff-line); }
	.staff-table tbody tr > td,
	.staff-table tbody tr > td:first-child,
	.staff-table tbody tr > td:last-child { padding: 0; text-align: left !important; }
	.staff-table td.staff-cell-person,
	.staff-table td.staff-cell-empty { grid-column: 1 / -1; }
	.staff-table td[data-label]:not(.staff-cell-person)::before {
		content: attr(data-label);
		display: block;
		color: rgba(226, 232, 240, 0.6);
		font-size: 0.58rem;
		font-weight: 700;
		letter-spacing: 0.08em;
		text-transform: uppercase;
	}
	.staff-person { min-width: 0; max-width: none; }
	.staff-table td.staff-cell-inactive { min-width: 0; }
	.staff-table .staff-sub { white-space: normal; }
}
/* Tablets: every stat on one line under the name (Inactive gets two tracks for its reason chips). */
@media (min-width: 768px) and (max-width: 991.98px) {
	.staff-table tbody tr { grid-template-columns: repeat(9, minmax(0, 1fr)); }
	.staff-table td.staff-cell-inactive { grid-column: span 2; }
}

/* History */
.staff-history-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--staff-line); }
.staff-history-head .staff-section-title { margin-right: auto; }
.staff-history-head .analytics-option[aria-selected="true"] {
	color: #07151d;
	background: linear-gradient(135deg, var(--analytics-accent-strong), #a9e5ff);
	box-shadow: 0 5px 16px rgba(var(--analytics-accent), 0.2);
}
.staff-tab-count { padding: 0.05rem 0.35rem; border-radius: 999px; background: rgba(0, 0, 0, 0.22); font-size: 0.64rem; }
.staff-tab-count:empty { display: none; }
.staff-action-select { width: auto; min-width: 11rem; max-width: 100%; }
.staff-history-list { max-height: min(38rem, 75vh); overflow-y: auto; }
.staff-history-row {
	display: grid;
	grid-template-columns: 1.9rem minmax(0, 1fr) auto;
	gap: 0.6rem;
	align-items: center;
	padding: 0.45rem 1rem;
}
.staff-history-row + .staff-history-row { border-top: 1px solid var(--staff-line); }
.staff-history-icon { display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 0.55rem; font-size: 0.9rem; }
.staff-history-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.45rem; font-size: 0.84rem; }
.staff-history-who { display: inline-flex; align-items: center; gap: 0.35rem; min-width: 0; }
.staff-history-action { font-weight: 650; }
.staff-history-detail {
	display: -webkit-box;
	overflow: hidden;
	margin-top: 0.1rem;
	color: var(--bs-secondary-color);
	font-size: 0.75rem;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow-wrap: anywhere;
}
.staff-history-meta { display: flex; align-items: center; justify-content: flex-end; gap: 0.45rem; color: var(--bs-secondary-color); font-size: 0.72rem; white-space: nowrap; }
.staff-history-line > strong { font-variant-numeric: tabular-nums; }
.staff-call-caller { color: rgba(226, 232, 240, 0.85); }
.staff-open { color: #86efac; font-weight: 650; }
.staff-ago--inline { cursor: help; }
.staff-pager { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.5rem 1rem; border-top: 1px solid var(--staff-line); }

@media (max-width: 575.98px) {
	.staff-intro .card-body { padding: 0.85rem; }
	.staff-intro .panel-page-intro-icon { display: none; }
	.staff-intro p.small { display: none; }
	.staff-records .analytics-summary { padding: 0.55rem 0.7rem; }
	.staff-history-head { padding: 0.65rem 0.75rem; }
	.staff-history-head .analytics-segmented { order: 3; width: 100%; max-width: 100%; }
	.staff-history-head .analytics-option { flex: 1 1 0; }
	.staff-history-head .analytics-option i { display: none; }
	.staff-action-select { order: 4; width: 100%; }
	.staff-history-row { grid-template-columns: 1.6rem minmax(0, 1fr); padding: 0.45rem 0.75rem; }
	.staff-history-icon { width: 1.6rem; height: 1.6rem; font-size: 0.8rem; }
	.staff-history-meta { grid-column: 2; flex-direction: row; align-items: center; justify-content: flex-start; }
	.staff-online-list { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 767.98px) {
	.staff-history-list { max-height: none; }
}
