/* ==========================================================================
   Personal Library — private memories and characters scoped to a single user.

   Layers on top of shared library/card patterns. Token prefix: --sc-*.
   ========================================================================== */

/* ── Personal Dashboard Hero ────────────────────────────────────────────── */

.personal-hero {
	height: 160px;
	background: linear-gradient(135deg, var(--sc-sage) 0%, var(--sc-moss) 100%);
	border-radius: var(--sc-radius-lg);
	position: relative;
	overflow: hidden;
	display: flex;
	align-items: flex-end;
	padding: var(--sc-space-md) var(--sc-space-lg);
}

.personal-hero__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(58, 53, 48, 0.4) 0%, rgba(58, 53, 48, 0.05) 100%);
	pointer-events: none;
}

.personal-hero__content {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	gap: var(--sc-space-md);
}

.personal-hero__monogram {
	width: 48px;
	height: 48px;
	border-radius: var(--sc-radius-md);
	background: rgba(255, 255, 255, 0.15);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.personal-hero__monogram svg {
	width: 22px;
	height: 22px;
	stroke: white;
	fill: none;
}

.personal-hero__text {
	color: white;
}

.personal-hero__title {
	font-family: var(--sc-font-display);
	font-size: var(--sc-text-xl);
	line-height: var(--sc-leading-tight);
}

.personal-hero__subtitle {
	font-family: var(--sc-font-ui);
	font-size: var(--sc-text-sm);
	opacity: 0.8;
	margin-top: 2px;
}

/* ── Personal Badge (inline label next to titles) ───────────────────────── */

.personal-badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 3px var(--sc-space-sm);
	background: rgba(107, 127, 94, 0.1);
	border-radius: var(--sc-radius-full);
	font-family: var(--sc-font-ui);
	font-size: var(--sc-text-xs);
	font-weight: var(--sc-weight-medium);
	color: var(--sc-sage);
	margin-left: var(--sc-space-sm);
	vertical-align: middle;
}

.personal-badge svg {
	width: 13px;
	height: 13px;
	stroke: currentColor;
	fill: none;
}

/* ── Stats Bar ──────────────────────────────────────────────────────────── */

.personal-stats-bar {
	display: flex;
	gap: var(--sc-space-lg);
	padding: var(--sc-space-md) 0;
	border-bottom: 1px solid var(--sc-border-subtle);
}

.personal-stats-bar__item {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.personal-stats-bar__value {
	font-family: var(--sc-font-display);
	font-size: var(--sc-text-xl);
	font-weight: var(--sc-weight-bold);
	color: var(--sc-text-primary);
	line-height: 1;
}

.personal-stats-bar__label {
	font-family: var(--sc-font-ui);
	font-size: var(--sc-text-xs);
	color: var(--sc-text-tertiary);
	text-transform: uppercase;
	letter-spacing: var(--sc-tracking-wide);
}

/* ── Characters Section Headers (Personal vs Ghost groups) ─────────────── */

.personal-chars-section {
	margin-top: var(--sc-space-lg);
}

.personal-chars-section__header {
	display: flex;
	align-items: center;
	gap: var(--sc-space-sm);
	padding-bottom: var(--sc-space-sm);
	margin-bottom: var(--sc-space-md);
	border-bottom: 1px solid var(--sc-border-subtle);
	font-family: var(--sc-font-ui);
	font-size: var(--sc-text-xs);
	font-weight: var(--sc-weight-semibold);
	letter-spacing: var(--sc-tracking-wide);
	text-transform: uppercase;
	color: var(--sc-text-tertiary);
}

.personal-chars-section__header svg {
	width: 14px;
	height: 14px;
	stroke: currentColor;
	fill: none;
	opacity: 0.6;
}

.personal-chars-section__header .count {
	font-weight: var(--sc-weight-normal);
	color: var(--sc-text-tertiary);
}

/* ── Ghost Character Card ───────────────────────────────────────────────── */

.char-card--ghost {
	border-style: dashed;
	opacity: 0.88;
}

.char-card--ghost:hover {
	opacity: 1;
}

/* Ghost overlay icon — top-right of portrait */
.char-card__ghost-overlay {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 26px;
	height: 26px;
	border-radius: var(--sc-radius-full);
	background: rgba(255, 255, 255, 0.92);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	border: 1.5px solid var(--sc-border);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 2;
}

.char-card__ghost-overlay svg {
	width: 13px;
	height: 13px;
	stroke: var(--sc-text-tertiary);
	fill: none;
}

/* Source family label below character name */
.char-card__ghost-source {
	font-family: var(--sc-font-ui);
	font-size: 11px;
	color: var(--sc-text-tertiary);
	display: flex;
	align-items: center;
	gap: 4px;
	margin-top: 2px;
}

.char-card__ghost-source svg {
	width: 11px;
	height: 11px;
	stroke: currentColor;
	fill: none;
	opacity: 0.6;
}

/* Read-only pill badge on ghost card */
.char-card__ghost-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 2px var(--sc-space-sm);
	background: var(--sc-accent-subtle);
	border-radius: var(--sc-radius-sm);
	font-family: var(--sc-font-ui);
	font-size: 10px;
	font-weight: var(--sc-weight-medium);
	color: var(--sc-text-tertiary);
	text-transform: uppercase;
	letter-spacing: var(--sc-tracking-wide);
}

/* ── Ghost Character in Search / Autocomplete Results ───────────────────── */

.char-search__result--ghost {
	opacity: 0.85;
	border-left: 2px dashed var(--sc-border);
	padding-left: var(--sc-space-sm);
}

.char-search__result--ghost .char-search__family-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 2px var(--sc-space-sm);
	background: rgba(107, 127, 94, 0.08);
	border-radius: var(--sc-radius-sm);
	font-family: var(--sc-font-ui);
	font-size: 11px;
	color: var(--sc-sage);
	margin-left: var(--sc-space-xs);
}

/* ── Ghost Character Chips (in memory detail / memory new) ─────────────── */

.char-chip--ghost {
	border-style: dashed;
	opacity: 0.85;
}

.char-chip--ghost .char-chip__ghost-icon {
	width: 12px;
	height: 12px;
	stroke: var(--sc-text-tertiary);
	fill: none;
	margin-left: 2px;
}

/* ── Migrate to Family CTA button ───────────────────────────────────────── */

.migrate-cta {
	display: inline-flex;
	align-items: center;
	gap: var(--sc-space-sm);
	padding: var(--sc-space-sm) var(--sc-space-md);
	background: rgba(107, 127, 94, 0.08);
	border: 1px solid rgba(107, 127, 94, 0.2);
	border-radius: var(--sc-radius-md);
	font-family: var(--sc-font-ui);
	font-size: var(--sc-text-sm);
	font-weight: var(--sc-weight-medium);
	color: var(--sc-sage);
	cursor: pointer;
	text-decoration: none;
	transition: background var(--sc-transition-fast), border-color var(--sc-transition-fast),
	            color var(--sc-transition-fast);
}

.migrate-cta:hover {
	background: rgba(107, 127, 94, 0.14);
	border-color: var(--sc-sage);
	color: var(--sc-moss);
}

.migrate-cta svg {
	width: 16px;
	height: 16px;
	stroke: currentColor;
	fill: none;
}

/* ── Ghost Character Detail Page — Header modifier ──────────────────────── */

.char-header--ghost .char-header__portrait {
	border: 2px dashed var(--sc-border);
	border-radius: var(--sc-radius-lg);
}

/* ── Ghost Source Line (linked-from indicator in detail header) ─────────── */

.ghost-source-line {
	display: flex;
	align-items: center;
	gap: var(--sc-space-xs);
	font-family: var(--sc-font-ui);
	font-size: var(--sc-text-sm);
	color: var(--sc-text-secondary);
	margin-bottom: var(--sc-space-md);
	padding: var(--sc-space-xs) 0;
}

.ghost-source-line > svg {
	width: 13px;
	height: 13px;
	stroke: var(--sc-sage);
	fill: none;
	flex-shrink: 0;
	opacity: 0.7;
}

.ghost-source-line a {
	color: var(--sc-accent-text);
	text-decoration: none;
	font-weight: var(--sc-weight-medium);
	transition: color var(--sc-transition-fast);
}

.ghost-source-line a:hover {
	color: var(--sc-accent-hover);
	text-decoration: underline;
}

.ghost-source-line__sync {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-left: var(--sc-space-sm);
	padding: 2px var(--sc-space-sm);
	background: rgba(107, 127, 94, 0.07);
	border-radius: var(--sc-radius-sm);
	font-size: 11px;
	font-weight: var(--sc-weight-medium);
	color: var(--sc-sage);
}

.ghost-source-line__sync svg {
	width: 11px;
	height: 11px;
	stroke: currentColor;
	fill: none;
}

/* ── Family Link action button (ghost detail header) ────────────────────── */

.char-header__action-btn--family-link {
	text-decoration: none;
	background: rgba(107, 127, 94, 0.06);
	border-color: rgba(107, 127, 94, 0.2);
	color: var(--sc-sage);
}

.char-header__action-btn--family-link:hover {
	background: rgba(107, 127, 94, 0.12);
	border-color: var(--sc-sage);
	color: var(--sc-moss);
}

/* ── Ghost Family CTA card (bottom of ghost detail page) ────────────────── */

.ghost-family-cta {
	max-width: var(--sc-content-max);
	margin: 0 auto;
	padding: var(--sc-space-lg) var(--sc-space-lg) 0;
}

.ghost-family-cta__link {
	display: flex;
	align-items: center;
	gap: var(--sc-space-md);
	padding: var(--sc-space-md) var(--sc-space-lg);
	background: rgba(107, 127, 94, 0.04);
	border: 1px solid rgba(107, 127, 94, 0.15);
	border-radius: var(--sc-radius-lg);
	text-decoration: none;
	color: inherit;
	transition: background var(--sc-transition-fast), border-color var(--sc-transition-fast);
}

.ghost-family-cta__link:hover {
	background: rgba(107, 127, 94, 0.08);
	border-color: rgba(107, 127, 94, 0.3);
}

.ghost-family-cta__link > svg {
	width: 22px;
	height: 22px;
	stroke: var(--sc-sage);
	fill: none;
	flex-shrink: 0;
	opacity: 0.7;
}

.ghost-family-cta__text {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.ghost-family-cta__label {
	font-family: var(--sc-font-ui);
	font-size: var(--sc-text-sm);
	font-weight: var(--sc-weight-semibold);
	color: var(--sc-text-primary);
}

.ghost-family-cta__sub {
	font-family: var(--sc-font-ui);
	font-size: var(--sc-text-xs);
	color: var(--sc-text-tertiary);
}

.ghost-family-cta__arrow {
	width: 18px;
	height: 18px;
	stroke: var(--sc-text-tertiary);
	fill: none;
	flex-shrink: 0;
	transition: transform var(--sc-transition-fast);
}

.ghost-family-cta__link:hover .ghost-family-cta__arrow {
	transform: translateX(3px);
}

/* ── Personal page utilities ────────────────────────────────────────────── */

/* Section heading used on personal dashboard + sub-pages */
.section-heading {
	font-family: var(--sc-font-ui);
	font-size: var(--sc-text-xs);
	font-weight: var(--sc-weight-semibold);
	letter-spacing: var(--sc-tracking-wide);
	text-transform: uppercase;
	color: var(--sc-text-tertiary);
	margin: 0 0 var(--sc-space-sm);
}

/* "View all →" link below grids */
.sc-link-more {
	display: inline-block;
	margin-top: var(--sc-space-sm);
	font-family: var(--sc-font-ui);
	font-size: var(--sc-text-xs);
	font-weight: var(--sc-weight-medium);
	color: var(--sc-accent-text);
	text-decoration: none;
	transition: color var(--sc-transition-fast);
}

.sc-link-more:hover {
	color: var(--sc-accent-hover);
}

/* Sidebar card title (used in personal dashboard sidebar) */
.dash-sidebar__card-title {
	font-family: var(--sc-font-ui);
	font-size: var(--sc-text-xs);
	font-weight: var(--sc-weight-semibold);
	letter-spacing: var(--sc-tracking-wide);
	text-transform: uppercase;
	color: var(--sc-text-tertiary);
	margin: 0 0 var(--sc-space-sm);
}

/* Compact character list in sidebar */
.char-list-compact {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.char-list-compact__item {
	display: flex;
	align-items: center;
	gap: var(--sc-space-sm);
	padding: 6px var(--sc-space-xs);
	border-radius: var(--sc-radius-sm);
	text-decoration: none;
	color: inherit;
	transition: background var(--sc-transition-fast);
}

.char-list-compact__item:hover {
	background: var(--sc-accent-subtle);
}

.char-list-compact__avatar {
	width: 28px;
	height: 28px;
	font-size: var(--sc-text-xs);
	border-radius: var(--sc-radius-full);
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: var(--sc-font-ui);
	font-weight: var(--sc-weight-semibold);
	color: var(--sc-text-inverse);
	flex-shrink: 0;
}

.char-list-compact__name {
	flex: 1;
	font-family: var(--sc-font-ui);
	font-size: var(--sc-text-sm);
	color: var(--sc-text-primary);
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.char-list-compact__count {
	font-family: var(--sc-font-ui);
	font-size: var(--sc-text-xs);
	color: var(--sc-text-tertiary);
	flex-shrink: 0;
}

/* Compact family list in sidebar */
.family-list-compact {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.family-list-compact__item {
	display: flex;
	align-items: center;
	gap: var(--sc-space-sm);
	padding: 6px var(--sc-space-xs);
	border-radius: var(--sc-radius-sm);
	text-decoration: none;
	color: inherit;
	transition: background var(--sc-transition-fast);
}

.family-list-compact__item:hover {
	background: var(--sc-accent-subtle);
}

.family-list-compact__avatar {
	width: 28px;
	height: 28px;
	font-size: var(--sc-text-xs);
	border-radius: var(--sc-radius-sm);
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: var(--sc-font-ui);
	font-weight: var(--sc-weight-semibold);
	color: var(--sc-text-inverse);
	flex-shrink: 0;
}

.family-list-compact__name {
	flex: 1;
	font-family: var(--sc-font-ui);
	font-size: var(--sc-text-sm);
	font-weight: var(--sc-weight-medium);
	color: var(--sc-text-primary);
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.family-list-compact__count {
	font-family: var(--sc-font-ui);
	font-size: var(--sc-text-xs);
	color: var(--sc-text-tertiary);
	flex-shrink: 0;
}

/* Personal page container */
.personal-page {
	max-width: var(--sc-width-full);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Personal dashboard — `/app/personal/` matches mockup `pages/personal/dashboard.php`
   (hero, stats, explore, activity, sidebar). Uses shared `.dash-*` from
   `family-landing.css`; overrides and activity UI live here.
   ═══════════════════════════════════════════════════════════════════════════ */

.dash-hero.dash-hero--personal {
	height: 160px;
	background: linear-gradient(135deg, var(--sc-sage) 0%, var(--sc-moss) 100%);
}

.dash-hero--personal .dash-hero__overlay {
	background: linear-gradient(to top, rgba(58, 53, 48, 0.5) 0%, rgba(58, 53, 48, 0.1) 100%);
}

.dash-hero--personal .dash-hero__monogram {
	width: 48px;
	height: 48px;
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.15);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	box-shadow: none;
	font-size: unset;
}

.dash-hero--personal .dash-hero__monogram svg {
	width: 22px;
	height: 22px;
	stroke: white;
	fill: none;
}

.dash-hero__info {
	flex: 1;
	min-width: 0;
}

.dash-hero--personal .dash-hero__username {
	margin: 10px 0 0;
	font-family: var(--sc-font-ui);
	font-size: 0.88rem;
	font-weight: 500;
	color: rgba(255, 255, 255, 0.92);
	letter-spacing: 0.02em;
}

.dash-hero--personal .dash-hero__username::selection {
	background: rgba(255, 255, 255, 0.25);
}

/* Recent Activity — mockup `dashboard.css` (tokens → --sc-) */
.dash-section--activity {
	margin-bottom: 0;
}

.dash-activity__header {
	margin-bottom: 14px;
}

.dash-activity__header .dash-section-title {
	margin-bottom: 10px;
}

.dash-activity__controls {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
}

.dash-activity__filters {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}

.dash-activity__quantity {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
}

.dash-activity__quantity-label {
	font-family: var(--sc-font-ui);
	font-size: 0.72rem;
	color: var(--sc-text-tertiary);
}

.dash-activity__quantity-select {
	font-family: var(--sc-font-ui);
	font-size: 0.75rem;
	color: var(--sc-bark);
	background: var(--sc-warm-white);
	border: 1px solid var(--sc-border);
	border-radius: 6px;
	padding: 4px 8px;
	cursor: pointer;
	outline: none;
}

.dash-activity__quantity-select:focus {
	border-color: var(--sc-rust-soft);
}

.dash-activity__filter {
	font-family: var(--sc-font-ui);
	font-size: 0.75rem;
	font-weight: 500;
	color: var(--sc-text-tertiary);
	background: var(--sc-warm-white);
	border: 1px solid var(--sc-border);
	border-radius: 20px;
	padding: 5px 12px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.dash-activity__filter svg {
	width: 13px;
	height: 13px;
	stroke: currentColor;
	fill: none;
	stroke-width: 2;
}

.dash-activity__filter:hover {
	border-color: var(--sc-sand);
	color: var(--sc-bark);
}

.dash-activity__filter.active {
	background: rgba(184, 96, 63, 0.08);
	border-color: var(--sc-rust-soft);
	color: var(--sc-rust);
}

.dash-activity__list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.dash-activity__card {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	background: var(--sc-warm-white);
	border: 1px solid var(--sc-border);
	border-radius: 12px;
	padding: 14px 16px;
	text-decoration: none;
	color: inherit;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.dash-activity__card:hover {
	border-color: var(--sc-sand);
	box-shadow: 0 2px 10px rgba(90, 64, 50, 0.05);
}

.dash-activity__card-left {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	flex: 1;
	min-width: 0;
}

.dash-activity__avatar {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: var(--sc-font-ui);
	font-weight: 600;
	font-size: 0.65rem;
	color: white;
	line-height: 1;
}

.dash-activity__card-body {
	flex: 1;
	min-width: 0;
}

.dash-activity__card-text {
	font-family: var(--sc-font-ui);
	font-size: 0.85rem;
	color: var(--sc-text-secondary);
	line-height: 1.4;
}

.dash-activity__card-text strong {
	color: var(--sc-bark);
	font-weight: 600;
}

.dash-activity__card-ref {
	font-family: var(--sc-font-ui);
	font-size: 0.78rem;
	color: var(--sc-text-tertiary);
	margin-top: 3px;
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 4px;
}

.dash-activity__type-pill {
	display: inline-block;
	padding: 1px 6px;
	border-radius: 4px;
	background: var(--sc-cream);
	color: var(--sc-bark-faint);
	font-size: 0.72rem;
	font-weight: 500;
}

.dash-activity__chev {
	width: 18px;
	height: 18px;
	stroke: var(--sc-text-tertiary);
	opacity: 0.35;
	flex-shrink: 0;
	fill: none;
}

.dash-activity__empty {
	font-family: var(--sc-font-body);
	font-size: 0.88rem;
	color: var(--sc-text-tertiary);
	margin: 12px 0 0;
	line-height: 1.5;
}

.dash-activity__more {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 16px;
	font-family: var(--sc-font-ui);
	font-size: 0.82rem;
	font-weight: 500;
	color: var(--sc-rust);
	text-decoration: none;
}

.dash-activity__more:hover {
	color: var(--sc-bark);
	text-decoration: underline;
}

.dash-sidebar__ghost-badge {
	display: inline-block;
	margin-left: 6px;
	padding: 1px 6px;
	border-radius: 4px;
	background: rgba(107, 127, 94, 0.12);
	color: var(--sc-sage);
	font-size: 0.65rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	vertical-align: middle;
}

@media (max-width: 640px) {
	.dash-activity__controls {
		flex-direction: column;
		align-items: stretch;
	}

	.dash-activity__quantity {
		justify-content: flex-end;
	}
}
