/* API statistics pages — Figma layout (profile_api_stats*.html only) */

.page-profile-figma .profile-api-stats-subnav.profile-subnav--figma,
.page-profile-figma .profile-api-wh-subnav.profile-subnav--figma {
	margin-top: 0;
	margin-bottom: 0;
	padding: 6px;
	border: 0.8px solid rgb(45, 58, 79);
	border-radius: var(--pf-radius-card, 1rem) var(--pf-radius-card, 1rem) 0 0;
	border-bottom: none;
	background: var(--pf-modal-bg, rgb(17, 22, 35));
	backdrop-filter: blur(var(--pf-blur-card, 4px));
	-webkit-backdrop-filter: blur(var(--pf-blur-card, 4px));
	box-shadow: none;
}

html[data-theme="light"] .page-profile-figma .profile-api-stats-subnav.profile-subnav--figma,
html[data-theme="light"] .page-profile-figma .profile-api-wh-subnav.profile-subnav--figma {
	background: var(--pf-modal-bg, #ffffff);
	border-color: rgba(0, 0, 0, 0.08);
}

.page-profile-figma .profile-subnav--figma + .profile-api-stats-subnav,
.page-profile-figma .profile-subnav--figma + .profile-api-wh-subnav {
	margin-top: 0;
}

.profile-api-subnav {
	margin-bottom: 0.75rem;
}

.profile-api-subnav + .profile-api-stats-subnav,
.profile-api-subnav + .profile-api-wh-subnav {
	margin-top: 0;
}

.profile-api-stats-subnav,
.profile-api-wh-subnav {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 0;
	padding: 0.75rem 1rem;
	border-radius: 1rem 1rem 0 0;
	border: 0.8px solid rgb(45, 58, 79);
	border-bottom: none;
	background: var(--pf-modal-bg, rgb(17, 22, 35));
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	box-shadow: none;
}

html[data-theme="light"] .profile-api-stats-subnav,
html[data-theme="light"] .profile-api-wh-subnav {
	background: var(--pf-modal-bg, #ffffff);
	border-color: rgba(0, 0, 0, 0.08);
}

.profile-api-stats-subnav .profile-subnav-link,
.profile-api-wh-subnav .profile-subnav-link {
	padding: 0.5rem 1rem;
}

.profile-api-stats-subnav .profile-subnav-link--active,
.profile-api-wh-subnav .profile-subnav-link--active {
	box-shadow: none;
}

.page-profile-figma .profile-api-stats-subnav + .profile-api-stats-page,
.page-profile-figma .profile-api-wh-subnav + .profile-webhooks-page,
.page-profile-figma .profile-api-stats-subnav + .referral-panel {
	margin-top: 0;
}

.page-profile-figma .profile-api-stats-subnav + .profile-api-stats-page .profile-api-stats-panel,
.page-profile-figma .profile-api-wh-subnav + .profile-webhooks-page .profile-webhooks-panel,
.page-profile-figma .profile-api-stats-subnav + .referral-panel {
	margin-top: 0;
	border-radius: 0 0 var(--pf-radius-card, 1rem) var(--pf-radius-card, 1rem);
	border-top: 0.8px solid rgb(45, 58, 79);
}

html[data-theme="light"] .page-profile-figma .profile-api-stats-subnav + .profile-api-stats-page .profile-api-stats-panel,
html[data-theme="light"] .page-profile-figma .profile-api-wh-subnav + .profile-webhooks-page .profile-webhooks-panel,
html[data-theme="light"] .page-profile-figma .profile-api-stats-subnav + .referral-panel {
	border-top-color: rgba(0, 0, 0, 0.08);
}

.profile-api-stats-page .profile-api-stats-panel {
	border-radius: 1rem;
	background: var(--pf-modal-bg, rgb(17, 22, 35));
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	border: 0.8px solid rgb(45, 58, 79);
}

html[data-theme="light"] .profile-api-stats-page .profile-api-stats-panel {
	background: var(--pf-modal-bg, #ffffff);
}

/* No active API billing period — warning (like API key create hint) */
.api-stats-billing-gate-block--warning {
	display: block;
	margin-top: 1rem;
	padding: 0;
	border: none;
	background: transparent;
	box-shadow: none;
}

.api-stats-billing-gate-inner {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.75rem;
	width: 100%;
	max-width: 36rem;
}

.api-stats-billing-gate-block--warning .profile-api-create-blocked-hint--warning {
	display: inline-flex;
	align-items: flex-start;
	gap: 0.35rem;
	margin: 0;
	padding: 0;
	border: none;
	background: transparent;
	color: #fbbf24;
	font-size: 0.875rem;
	line-height: 1.45;
	text-align: left;
	max-width: 100%;
	white-space: normal;
}

html[data-theme="light"] .api-stats-billing-gate-block--warning .profile-api-create-blocked-hint--warning {
	color: #d97706;
}

.api-stats-billing-gate-block--warning .profile-api-create-blocked-hint-text {
	white-space: normal;
	min-width: 0;
}

.api-stats-billing-gate-btn {
	flex-shrink: 0;
}

.profile-api-stats-page .profile-api-stats-panel .profile-panel-section {
	padding: 2rem;
}

.profile-api-stats-heading {
	margin: 0 0 2rem;
	font-size: 1.5rem;
	font-weight: 600;
	line-height: 1.25;
	color: var(--text);
}

.profile-api-stats-billing--period,
.profile-api-stats-page .profile-api-stats-billing--period {
	background: transparent;
	border: 0.8px solid rgb(48, 74, 116);
	border-radius: 1rem;
	padding: 1.5rem;
	margin-bottom: 2rem;
	box-sizing: border-box;
}

html[data-theme="light"] .profile-api-stats-page .profile-api-stats-billing--period {
	border-color: rgba(48, 74, 116, 0.55);
}

.profile-api-stats-billing--compact {
	margin-bottom: 2rem;
}

.profile-api-stats-billing-title {
	margin: 0 0 1.25rem;
	font-size: 1.125rem;
	font-weight: 600;
	line-height: 1.35;
	color: var(--text);
}

.profile-api-stats-billing-dates,
.profile-api-stats-page .api-stats-billing-range {
	margin: 0 0 1.25rem;
	font-size: 0.9375rem;
	font-weight: 400;
	color: rgb(139, 156, 179);
	line-height: 1.5;
}

.profile-api-stats-billing--compact .profile-api-stats-billing-dates {
	margin-bottom: 0;
}

.profile-api-stats-cu-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	margin-bottom: 0.75rem;
}

.profile-api-stats-cu-label {
	font-size: 0.875rem;
	color: var(--text-muted);
}

.profile-api-stats-cu-values {
	font-size: 1rem;
	font-weight: 600;
	color: var(--text);
}

.profile-api-stats-page .profile-api-stats-progress-track,
.profile-api-stats-page .api-stats-progress-track.profile-api-stats-progress-track {
	height: 12px;
	border-radius: 999px;
	background: rgba(139, 156, 179, 0.12);
	border: none;
	overflow: hidden;
}

.profile-api-stats-page .profile-api-stats-progress-fill,
.profile-api-stats-page .api-stats-progress-fill.profile-api-stats-progress-fill {
	background: linear-gradient(90deg, rgb(59, 130, 246), rgb(37, 99, 235));
	min-width: 0;
}

.profile-api-stats-usage {
	margin-top: 0;
}

.profile-api-stats-section-title {
	margin: 0 0 1rem;
	font-size: 1.125rem;
	font-weight: 600;
	line-height: 1.35;
	color: var(--text);
}

.profile-api-stats-interval-btns {
	display: flex;
	justify-content: flex-end;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-bottom: 1.5rem;
}

.profile-api-stats-interval-btn {
	min-width: 5.625rem;
	padding: 0.375rem 0.75rem;
	border-radius: 0.5rem;
	border: 0.8px solid rgb(45, 58, 79);
	background: transparent;
	color: var(--text-muted);
	font-size: 0.875rem;
	font-weight: 500;
	font-family: inherit;
	cursor: pointer;
	transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.profile-api-stats-interval-btn:hover:not(:disabled) {
	border-color: rgba(59, 130, 246, 0.55);
	color: var(--text);
}

.profile-api-stats-interval-btn--active {
	background: rgb(59, 130, 246);
	border-color: rgb(59, 130, 246);
	color: #fff;
}

.profile-api-stats-interval-btn:disabled {
	opacity: 0.65;
	cursor: wait;
}

.profile-api-stats-kpi-grid {
	display: grid;
	gap: 1rem;
	margin-bottom: 2rem;
}

.profile-api-stats-kpi-grid--4 {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.profile-api-stats-kpi-grid--2 {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-api-stats-kpi-card {
	background: var(--pf-modal-bg, rgb(17, 22, 35));
	border: 0.8px solid rgb(45, 58, 79);
	border-radius: 0.75rem;
	padding: 1rem;
}

html[data-theme="light"] .profile-api-stats-kpi-card {
	background: var(--pf-modal-bg, #ffffff);
}

.profile-api-stats-kpi-label {
	margin-bottom: 0.5rem;
	font-size: 0.8125rem;
	color: var(--text-muted);
	line-height: 1.35;
}

.profile-api-stats-kpi-value {
	font-weight: 700;
	line-height: 1.2;
}

.profile-api-stats-kpi-card--total .profile-api-stats-kpi-value {
	font-size: 1.5rem;
}

.profile-api-stats-kpi-card:not(.profile-api-stats-kpi-card--total) .profile-api-stats-kpi-value {
	font-size: 1.25rem;
	margin-bottom: 0.25rem;
}

.profile-api-stats-kpi-value--total,
.profile-api-stats-kpi-value--rest {
	color: rgb(59, 130, 246);
}

.profile-api-stats-kpi-value--ws {
	color: rgb(39, 195, 112);
}

.profile-api-stats-kpi-value--wh {
	color: rgb(168, 85, 247);
}

.profile-api-stats-kpi-sub {
	margin-top: 0.35rem;
	font-size: 0.8125rem;
	color: var(--text-muted);
	line-height: 1.35;
}

.profile-api-stats-chart-panel {
	position: relative;
	margin-top: 0;
	padding: 1.5rem;
	border-radius: 0.75rem;
	border: 0.8px solid rgb(45, 58, 79);
	background: var(--pf-modal-bg, rgb(17, 22, 35));
}

html[data-theme="light"] .profile-api-stats-chart-panel {
	background: var(--pf-modal-bg, #ffffff);
}

.profile-api-stats-page .api-stats-chart-block--extra {
	margin-top: 1.5rem;
	border-top: none;
}

.profile-api-stats-chart-panel.api-stats-chart-block--extra {
	padding: 1.5rem;
}

.profile-api-stats-chart-heading {
	margin: 0 0 1.25rem;
	font-size: 1.125rem;
	font-weight: 600;
	line-height: 1.35;
	color: var(--text);
}

.profile-api-stats-chart-legend-wrap,
.profile-api-stats-chart-legend--center {
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
	gap: 0.5rem 2rem;
	margin-bottom: 1.5rem;
	font-size: 0.875rem;
	color: var(--text);
}

.profile-api-stats-legend-item {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
}

.profile-api-stats-legend-line {
	display: inline-block;
	width: 1rem;
	height: 3px;
	border-radius: 999px;
	flex-shrink: 0;
}

.profile-api-stats-legend-line--rest {
	background: #3b82f6;
}

.profile-api-stats-legend-line--ws {
	background: #27c370;
}

.profile-api-stats-legend-line--wh {
	background: #a855f7;
}

.profile-api-stats-page .profile-api-stats-chart-host,
.profile-api-stats-page .api-stats-chart-host {
	width: 100%;
	min-height: 400px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border: none;
	border-radius: 0;
	background: transparent;
	padding: 0;
	box-sizing: border-box;
}

.profile-api-stats-page .profile-api-stats-chart-svg,
.profile-api-stats-page .api-stats-chart-svg.profile-api-stats-chart-svg {
	display: block;
	min-height: 400px;
	min-width: 280px;
	color: var(--text-muted);
}

.profile-api-stats-page .api-stats-type-cards.profile-api-stats-kpi-grid {
	margin-bottom: 2rem;
}

.profile-api-stats-page .api-stats-type-card {
	border: 0.8px solid rgb(45, 58, 79);
	background: var(--pf-modal-bg, rgb(17, 22, 35));
	border-radius: 0.75rem;
	padding: 1rem;
}

@media (max-width: 1024px) {
	.profile-api-stats-kpi-grid--4 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 640px) {
	.profile-api-stats-page .profile-api-stats-panel .profile-panel-section {
		padding: 1.25rem;
	}

	.profile-api-stats-page .profile-api-stats-chart-host,
	.profile-api-stats-page .api-stats-chart-host {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	.profile-api-stats-chart-panel,
	.profile-api-stats-chart-panel.api-stats-chart-block--extra {
		padding: 0.75rem 0.5rem;
	}

	.profile-api-stats-chart-legend-wrap,
	.profile-api-stats-chart-legend--center {
		margin-bottom: 0.75rem;
		gap: 0.35rem 1rem;
	}

	.profile-api-stats-kpi-grid--4,
	.profile-api-stats-kpi-grid--2 {
		grid-template-columns: 1fr;
	}

	.profile-api-stats-interval-btns {
		justify-content: stretch;
	}

	.profile-api-stats-interval-btn {
		flex: 1 1 calc(50% - 0.25rem);
		min-width: 0;
	}
}

/* Chart tooltip — Figma */
.profile-api-stats-chart-tooltip,
.api-stats-chart-tooltip.profile-api-stats-chart-tooltip {
	background: rgb(26, 35, 50);
	border: 0.8px solid rgb(45, 58, 79);
	border-radius: 0.5rem;
	padding: 0.75rem;
	box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.35);
	pointer-events: none;
	max-width: min(24rem, calc(100vw - 24px));
	font-size: 0.8125rem;
	line-height: 1.4;
	z-index: 3000;
}

html[data-theme="light"] .profile-api-stats-chart-tooltip {
	background: rgb(26, 35, 50);
	color: #fff;
}

.profile-api-stats-tooltip-title {
	margin: 0 0 0.5rem;
	font-size: 0.875rem;
	font-weight: 400;
	color: rgb(230, 237, 243);
	line-height: 1.35;
}

.profile-api-stats-tooltip-lines {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.profile-api-stats-tooltip-line {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}

.profile-api-stats-tooltip-label {
	font-size: 0.8125rem;
	flex-shrink: 0;
}

.profile-api-stats-tooltip-label--rest {
	color: rgb(59, 130, 246);
}

.profile-api-stats-tooltip-label--ws {
	color: rgb(39, 195, 112);
}

.profile-api-stats-tooltip-label--wh {
	color: rgb(168, 85, 247);
}

.profile-api-stats-tooltip-label--get {
	color: rgb(34, 197, 94);
}

.profile-api-stats-tooltip-label--post {
	color: rgb(59, 130, 246);
}

.profile-api-stats-tooltip-label--put {
	color: rgb(251, 191, 36);
}

.profile-api-stats-tooltip-label--patch {
	color: rgb(168, 85, 247);
}

.profile-api-stats-tooltip-label--delete {
	color: rgb(239, 68, 68);
}

.profile-api-stats-tooltip-value {
	font-size: 0.8125rem;
	color: #fff;
	white-space: nowrap;
}

.profile-api-stats-chart-tooltip.profile-api-stats-tooltip--compact,
.api-stats-chart-tooltip.profile-api-stats-tooltip--compact {
	padding: 0.45rem 0.6rem;
	font-size: 0.72rem;
	line-height: 1.35;
	max-width: calc(100vw - 16px);
}

.profile-api-stats-tooltip--compact .profile-api-stats-tooltip-title,
.profile-api-stats-tooltip--compact .api-stats-tooltip-title {
	margin-bottom: 0.35rem;
	font-size: 0.75rem;
}

.profile-api-stats-tooltip--compact .profile-api-stats-tooltip-line,
.profile-api-stats-tooltip--compact .api-stats-tooltip-row {
	gap: 0.45rem;
	margin-top: 0.2rem;
}

.profile-api-stats-tooltip--compact .profile-api-stats-tooltip-value {
	white-space: normal;
}

.profile-api-stats-page .api-stats-card {
	position: relative;
}

.api-stats-card--preview #api-stats-content {
	filter: blur(1.5px);
	pointer-events: none;
	user-select: none;
}

.api-stats-billing-overlay {
	position: absolute;
	inset: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	padding-top: 0;
	overflow: visible;
	background: color-mix(in srgb, var(--card-bg, #161a2b) 40%, transparent);
	backdrop-filter: blur(1px);
	-webkit-backdrop-filter: blur(1px);
	pointer-events: none;
	border-radius: inherit;
}

.api-stats-billing-overlay.hidden {
	display: none;
}

html[data-theme="light"] .api-stats-billing-overlay {
	background: color-mix(in srgb, var(--card-bg, #fff) 45%, transparent);
}

.api-stats-billing-overlay .viewport-overlay-message {
	pointer-events: all;
}

.api-stats-billing-overlay .arb-access-error-block {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	gap: 0.65rem;
	padding: 1.5rem 1.25rem;
	max-width: 360px;
}

.api-stats-billing-overlay .arb-access-error-icon {
	color: var(--primary);
	opacity: 0.85;
	flex-shrink: 0;
}

.api-stats-billing-overlay .arb-access-error-title {
	font-size: 1rem;
	font-weight: 600;
	color: var(--text);
}

.api-stats-billing-overlay .arb-access-error-text {
	font-size: 0.875rem;
	color: var(--text-muted);
	margin: 0;
	line-height: 1.5;
}

.api-stats-billing-overlay .arb-access-error-actions {
	margin-top: 0.5rem;
}

