/**
 * Rankolab CRM Hub — additive styles.
 *
 * Only uses the design tokens the app theme already defines
 * (--color-primary, --color-elevated, --color-border, --text-secondary, --text-color)
 * so the view inherits the existing look and any future theme restyle.
 * Everything is prefixed .rk-hub to avoid touching existing rules.
 */

/* ── Header row ─────────────────────────────────────────────────────────── */
.rk-hub-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
}

.rk-hub-header-actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

.rk-hub-stamp {
	font-size: 12px;
	color: var(--text-secondary);
	white-space: nowrap;
}

/* ── Stat cards ─────────────────────────────────────────────────────────── */
.rk-hub-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 14px;
	margin: 18px 0 22px;
}

.rk-hub-stat {
	background: var(--color-elevated);
	border: 1px solid var(--color-border);
	border-radius: 12px;
	padding: 16px 18px;
}

.rk-hub-stat-label {
	font-size: 12px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--text-secondary);
	margin-bottom: 6px;
}

.rk-hub-stat-value {
	font-size: 26px;
	font-weight: 700;
	line-height: 1.1;
}

.rk-hub-stat-sub {
	font-size: 12px;
	color: var(--text-secondary);
	margin-top: 6px;
}

/* ── Cards and tables ───────────────────────────────────────────────────── */
.rk-hub-card {
	background: var(--color-elevated);
	border: 1px solid var(--color-border);
	border-radius: 12px;
	margin-bottom: 18px;
	overflow: hidden;
}

.rk-hub-card-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 18px;
	border-bottom: 1px solid var(--color-border);
}

.rk-hub-card-title {
	font-size: 14px;
	font-weight: 600;
}

.rk-hub-card-note {
	font-size: 12px;
	color: var(--text-secondary);
}

.rk-hub-table-wrap {
	overflow-x: auto;
}

/* Reuses .leads-table typography from the theme; only spacing differs. */
.rk-hub-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
	margin: 0;
}

.rk-hub-table th {
	text-align: left;
	font-size: 11px;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--text-secondary);
	font-weight: 600;
	padding: 10px 18px;
	border-bottom: 1px solid var(--color-border);
	white-space: nowrap;
}

.rk-hub-table td {
	padding: 12px 18px;
	border-bottom: 1px solid var(--color-border);
	vertical-align: middle;
}

.rk-hub-table tr:last-child td {
	border-bottom: none;
}

.rk-hub-primary {
	font-weight: 600;
}

.rk-hub-muted {
	color: var(--text-secondary);
}

.rk-hub-mono {
	font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 12px;
	color: var(--text-secondary);
}

.rk-hub-url {
	display: block;
	font-size: 12px;
	color: var(--text-secondary);
	word-break: break-all;
}

/* ── Status pills ───────────────────────────────────────────────────────── */
.rk-hub-pill {
	display: inline-block;
	padding: 3px 9px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.02em;
	white-space: nowrap;
}

.rk-hub-pill-ok {
	background: rgba(16, 185, 129, 0.14);
	color: #34d399;
}

.rk-hub-pill-warn {
	background: rgba(245, 158, 11, 0.14);
	color: #fbbf24;
}

.rk-hub-pill-bad {
	background: rgba(239, 68, 68, 0.14);
	color: #fca5a5;
}

.rk-hub-pill-neutral {
	background: rgba(148, 163, 184, 0.14);
	color: #cbd5e1;
}

/* ── Per-card states: loading / empty / error ───────────────────────────── */
.rk-hub-state {
	padding: 22px 18px;
	font-size: 13px;
	color: var(--text-secondary);
}

.rk-hub-state-error {
	color: #fca5a5;
}

.rk-hub-skeleton {
	height: 12px;
	border-radius: 6px;
	background: linear-gradient(90deg, var(--color-elevated) 25%, rgba(255, 255, 255, 0.07) 37%, var(--color-elevated) 63%);
	background-size: 400% 100%;
	animation: rk-hub-shimmer 1.4s ease infinite;
	margin: 10px 18px;
}

@keyframes rk-hub-shimmer {
	0%   { background-position: 100% 50%; }
	100% { background-position: 0 50%; }
}

/* ── Nav item (mirrors the theme's .nav-item, adds only the badge colour) ─ */
.rk-hub-nav-badge {
	background: #6366f1;
}

@media (max-width: 782px) {
	.rk-hub-header-actions {
		width: 100%;
	}
	.rk-hub-table th,
	.rk-hub-table td {
		padding-left: 12px;
		padding-right: 12px;
	}
}
