/* Tailwind CSS Entry Point */
@tailwind base;
@tailwind components;
@tailwind utilities;

/* Import custom CSS (not purged by Tailwind) */
@import './custom.css';

/* Base */
:root{
	/* MTG color palette (approx from provided values) */
	--banner-h: 52px;
	--sidebar-w: 260px;
	--green-main: rgb(0,115,62);
	--green-light: rgb(196,211,202);
	--blue-main: rgb(14,104,171);
	--blue-light: rgb(179,206,234);
	--red-main: rgb(211,32,42);
	--red-light: rgb(235,159,130);
	--white-main: rgb(249,250,244);
	--white-light: rgb(248,231,185);
	--black-main: rgb(21,11,0);
	--black-light: rgb(166,159,157);
	--bg: #0f0f10;
	--panel: #1a1b1e;
	--text: #e8e8e8;
	--muted: #b6b8bd;
	--border: #2a2b2f;
	--ring: #60a5fa; /* focus ring */
	--ok: #16a34a; /* success */
	--warn: #f59e0b; /* warning */
	--err: #ef4444; /* error */
	/* Surface overrides for specific regions (default to panel) */
	--surface-banner: var(--panel);
	--surface-banner-text: var(--text);
	--surface-sidebar: var(--panel);
	--surface-sidebar-text: var(--text);
}

/* Light blend between Slate and Parchment (leans gray) */
[data-theme="light-blend"]{
	--bg: #e8e2d0;               /* warm beige background (keep existing) */
	--panel: #ebe5d8;            /* lighter warm cream - more contrast with bg, subtle panels */
	--text: #0d0a08;             /* very dark brown/near-black for strong readability */
	--muted: #5a544c;            /* darker muted brown for better contrast */
	--border: #bfb5a3;           /* darker warm-gray border for better definition */
	/* Navbar/banner: darker warm brown for hierarchy */
	--surface-banner: #9b8f7a;   /* warm medium brown - darker than panels, lighter than dark theme */
	--surface-sidebar: #9b8f7a;  /* match banner for consistency */
	--surface-banner-text: #1a1410;     /* dark brown text on medium brown bg */
	--surface-sidebar-text: #1a1410;    /* dark brown text on medium brown bg */
	/* Button colors: use taupe for buttons so they stand out from light panels */
	--btn-bg: #d4cbb8;           /* medium warm taupe - stands out against light panels */
	--btn-text: #1a1410;         /* dark brown text */
	--btn-hover-bg: #c4b9a5;     /* darker taupe on hover */
}

[data-theme="dark"]{
	--bg: #0f0f10;
	--panel: #1a1b1e;
	--text: #e8e8e8;
	--muted: #b6b8bd;
	--border: #2a2b2f;
}
[data-theme="high-contrast"]{
	--bg: #000;
	--panel: #000;
	--text: #fff;
	--muted: #e5e7eb;
	--border: #fff;
	--ring: #ff0;
}
[data-theme="cb-friendly"]{
	/* Tweak accents for color-blind friendliness */
	--green-main: #2e7d32; /* darker green */
	--red-main: #c62828;   /* deeper red */
	--blue-main: #1565c0;  /* balanced blue */
}
*{box-sizing:border-box}
html{height:100%; overflow-x:hidden; overflow-y:scroll; max-width:100vw;}
body {
	font-family: system-ui, Arial, sans-serif;
	margin: 0;
	color: var(--text);
	background: var(--bg);
	display: flex;
	flex-direction: column;
	height: 100%;
	width: 100%;
	overflow-x: hidden;
	overflow-y: scroll;
}
/* Honor HTML hidden attribute across the app */
[hidden] { display: none !important; }
/* Accessible focus ring for keyboard navigation */
.focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
/* Top banner - simplified, no changes on sidebar toggle */
.top-banner{ position:sticky; top:0; z-index:10; background: var(--surface-banner); color: var(--surface-banner-text); border-bottom:1px solid var(--border); box-shadow:0 2px 6px rgba(0,0,0,.4); min-height: var(--banner-h); }
.top-banner .top-inner{ margin:0; padding:.4rem 15px; display:flex; align-items:center; width:100%; box-sizing:border-box; }
.top-banner h1{ font-size: 1.1rem; margin:0; margin-left: 25px; }
.flex-row{ display: flex; align-items: center; gap: 25px; }
.top-banner .banner-left{ width: 260px !important; flex-shrink: 0 !important; }
/* Hide elements on all screen sizes */
#btn-open-permalink{ display:none !important; }
#banner-status{ display:none !important; }
.top-banner #theme-reset{ display:none !important; }

/* Layout */
.layout{ display:grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); flex: 1 0 auto; }
.sidebar{
	background: var(--surface-sidebar);
	color: var(--surface-sidebar-text);
	border-right: 1px solid var(--border);
	padding: 1rem;
	position: fixed;
	top: var(--banner-h);
	left: 0;
	bottom: 0;
	overflow: auto;
	width: var(--sidebar-w);
	z-index: 9; /* below the banner (z=10) */
	box-shadow: 2px 0 10px rgba(0,0,0,.18);
	display: flex;
	flex-direction: column;
}
.content{ padding: 1.25rem 1.5rem; grid-column: 2; min-width: 0; }

/* Collapsible sidebar behavior */
body.nav-collapsed .layout{ grid-template-columns: 0 minmax(0, 1fr); }
body.nav-collapsed .sidebar{ transform: translateX(-100%); visibility: hidden; }
body.nav-collapsed .content{ grid-column: 2; }
/* Sidebar collapsed state doesn't change banner grid on desktop anymore */
/* Smooth hide/show on mobile while keeping fixed positioning */
.sidebar{ transition: transform .2s ease-out, visibility .2s linear; overflow-x: hidden; }
/* Suppress sidebar transitions during page load to prevent pop-in */
body.no-transition .sidebar{ transition: none !important; }
/* Suppress sidebar transitions during HTMX partial updates to prevent distracting animations */
body.htmx-settling .sidebar{ transition: none !important; }
body.htmx-settling .layout{ transition: none !important; }
body.htmx-settling .content{ transition: none !important; }
body.htmx-settling *{ transition-duration: 0s !important; }

/* Mobile tweaks */
@media (max-width: 900px){
	:root{ --sidebar-w: 240px; }
	.layout{ grid-template-columns: 0 1fr; }
	.sidebar{ transform: translateX(-100%); visibility: hidden; }
	body:not(.nav-collapsed) .layout{ grid-template-columns: var(--sidebar-w) 1fr; }
	body:not(.nav-collapsed) .sidebar{ transform: translateX(0); visibility: visible; }
	.content{ padding: .9rem .6rem; max-width: 100vw; box-sizing: border-box; overflow-x: hidden; }
}

/* Additional mobile spacing for bottom floating controls */
@media (max-width: 720px) {
	.content { 
		padding-bottom: 6rem !important; /* Extra bottom padding to account for floating controls */
	}
}

.brand h1{ display:none; }
.brand{ padding-top: 0; margin-top: 0; }
.mana-dots{ display:flex; gap:.35rem; margin-bottom:.5rem; margin-top: 0; padding-top: 0; }
.mana-dots .dot{ width:12px; height:12px; border-radius:50%; display:inline-block; border:1px solid rgba(0,0,0,.35); box-shadow:0 1px 2px rgba(0,0,0,.3) inset; }
.dot.green{ background: var(--green-main); }
.dot.blue{ background: var(--blue-main); }
.dot.red{ background: var(--red-main); }
.dot.white{ background: var(--white-light); border-color: rgba(0,0,0,.2); }
.dot.black{ background: var(--black-light); }

.nav{ display:flex; flex-direction:column; gap:.35rem; }
.nav a{ color: var(--surface-sidebar-text); text-decoration:none; padding:.4rem .5rem; border-radius:6px; border:1px solid transparent; }
.nav a:hover{ background: color-mix(in srgb, var(--surface-sidebar) 85%, var(--surface-sidebar-text) 15%); border-color: var(--border); }

/* Sidebar theme controls anchored at bottom */
.sidebar .nav { flex: 1 1 auto; }
.sidebar-theme { margin-top: auto; padding-top: .75rem; border-top: 1px solid var(--border); }
.sidebar-theme-label { display:block; color: var(--surface-sidebar-text); font-size: 12px; opacity:.8; margin: 0 0 .35rem .1rem; }
.sidebar-theme-row { display:flex; align-items:center; gap:.5rem; flex-wrap: nowrap; }
.sidebar-theme-row select { background: var(--panel); color: var(--text); border:1px solid var(--border); border-radius:6px; padding:.3rem .4rem; flex: 1 1 auto; min-width: 0; }
.sidebar-theme-row .btn-ghost { background: transparent; color: var(--surface-sidebar-text); border:1px solid var(--border); flex-shrink: 0; white-space: nowrap; }

/* Simple two-column layout for inspect panel */
.two-col { display: grid; grid-template-columns: 1fr 320px; gap: 1rem; align-items: start; }
.two-col .grow { min-width: 0; }
.card-preview img { width: 100%; height: auto; border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.35); border:1px solid var(--border); background: var(--panel); }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* Left-rail variant puts the image first */
.two-col.two-col-left-rail{ grid-template-columns: 320px 1fr; }
/* Ensure left-rail variant also collapses to 1 column on small screens */
@media (max-width: 900px){
	.two-col.two-col-left-rail{ grid-template-columns: 1fr; }
	/* So the commander image doesn't dominate on mobile */
	.two-col .card-preview{ max-width: 360px; margin: 0 auto; }
	.two-col .card-preview img{ width: 100%; height: auto; }
}
.card-preview.card-sm{ max-width:200px; }

/* Page header - consistent section heading across all pages */
.page-header {
	margin-bottom: 1.25rem;
	padding-bottom: 1rem;
	border-bottom: 1px solid var(--border);
}
.page-header > h2 {
	font-size: 1.5rem;
	font-weight: 600;
	margin: 0 0 0.25rem 0;
}
.page-header > p {
	font-size: 0.9rem;
	margin: 0;
}

/* Buttons, inputs */
button{ background: var(--blue-main); color:#fff; border:none; border-radius:6px; padding:.45rem .7rem; cursor:pointer; }
button:hover{ filter:brightness(1.05); }
/* Anchor-style buttons */
.btn{ display:inline-block; background: var(--blue-main); color:#fff; border:none; border-radius:6px; padding:.45rem .7rem; cursor:pointer; text-decoration:none; line-height:1; }
.btn:hover{ filter:brightness(1.05); text-decoration:none; }
.btn.disabled, .btn[aria-disabled="true"]{ opacity:.6; cursor:default; pointer-events:none; }
label{ display:inline-flex; flex-direction:column; gap:.25rem; margin-right:.75rem; }
.color-identity{ display:inline-flex; align-items:center; gap:.35rem; }
.color-identity .mana + .mana{ margin-left:4px; }
.mana{ display:inline-block; width:16px; height:16px; border-radius:50%; border:1px solid var(--border); box-shadow:0 0 0 1px rgba(0,0,0,.25) inset; }
.mana-W{ background:#f9fafb; border-color:#d1d5db; }
.mana-U{ background:#3b82f6; border-color:#1d4ed8; }
.mana-B{ background:#111827; border-color:#1f2937; }
.mana-R{ background:#ef4444; border-color:#b91c1c; }
.mana-G{ background:#10b981; border-color:#047857; }
.mana-C{ background:#d3d3d3; border-color:#9ca3af; }
select,input[type="text"],input[type="number"]{ background: var(--panel); color:var(--text); border:1px solid var(--border); border-radius:6px; padding:.35rem .4rem; }
/* Range slider styling */
input[type="range"]{ 
  -webkit-appearance: none; 
  appearance: none; 
  width: 100%; 
  height: 8px; 
  background: var(--bg); 
  border-radius: 4px; 
  outline: none; 
  border: 1px solid var(--border);
}
input[type="range"]::-webkit-slider-thumb{ 
  -webkit-appearance: none; 
  appearance: none; 
  width: 20px; 
  height: 20px; 
  background: var(--blue-main); 
  border-radius: 50%; 
  cursor: pointer; 
  border: 2px solid var(--panel);
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
input[type="range"]::-moz-range-thumb{ 
  width: 20px; 
  height: 20px; 
  background: var(--blue-main); 
  border-radius: 50%; 
  cursor: pointer; 
  border: 2px solid var(--panel);
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
fieldset{ border:1px solid var(--border); border-radius:8px; padding:.75rem; margin:.75rem 0; }
small, .muted{ color: var(--muted); }
.partner-preview{ border:1px solid var(--border); border-radius:8px; background: var(--panel); padding:.75rem; margin-bottom:.5rem; }
.partner-preview[hidden]{ display:none !important; }
.partner-preview__header{ font-weight:600; }
.partner-preview__layout{ display:flex; gap:.75rem; align-items:flex-start; flex-wrap:wrap; }
.partner-preview__art{ flex:0 0 auto; }
.partner-preview__art img{ width:140px; max-width:100%; border-radius:6px; box-shadow:0 4px 12px rgba(0,0,0,.35); }
.partner-preview__details{ flex:1 1 180px; min-width:0; }
.partner-preview__role{ margin-top:.2rem; font-size:12px; color:var(--muted); letter-spacing:.04em; text-transform:uppercase; }
.partner-preview__pairing{ margin-top:.35rem; }
.partner-preview__themes{ margin-top:.35rem; font-size:12px; }
.partner-preview--static{ margin-bottom:.5rem; }
.partner-card-preview img{ box-shadow:0 4px 12px rgba(0,0,0,.3); }

/* Toasts */
.toast-host{ position: fixed; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; }
.toast{ background: var(--panel); color:var(--text); border:1px solid var(--border); border-radius:10px; padding:.5rem .65rem; box-shadow: 0 8px 24px rgba(0,0,0,.35); transition: transform .2s ease, opacity .2s ease; }
.toast.hide{ opacity:0; transform: translateY(6px); }
.toast.success{ border-color: rgba(22,163,74,.4); }
.toast.error{ border-color: rgba(239,68,68,.45); }
.toast.warn{ border-color: rgba(245,158,11,.45); }

/* Skeletons */
[data-skeleton]{ position: relative; }
[data-skeleton].is-loading > :not([data-skeleton-placeholder]){ opacity: 0; }
[data-skeleton-placeholder]{ display:none; pointer-events:none; }
[data-skeleton].is-loading > [data-skeleton-placeholder]{ display:flex; flex-direction:column; opacity:1; }
[data-skeleton][data-skeleton-overlay="false"]::after,
[data-skeleton][data-skeleton-overlay="false"]::before{ display:none !important; }
[data-skeleton]::after{
	content: '';
	position: absolute; inset: 0;
	border-radius: 8px;
	background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.08), rgba(255,255,255,0.04));
	background-size: 200% 100%;
	animation: shimmer 1.1s linear infinite;
	display: none;
}
[data-skeleton].is-loading::after{ display:block; }
[data-skeleton].is-loading::before{
	content: attr(data-skeleton-label);
	position:absolute;
	top:50%;
	left:50%;
	transform:translate(-50%, -50%);
	color: var(--muted);
	font-size:.85rem;
	text-align:center;
	line-height:1.4;
	max-width:min(92%, 360px);
	padding:.3rem .5rem;
	pointer-events:none;
	z-index:1;
	filter: drop-shadow(0 2px 4px rgba(15,23,42,.45));
}
[data-skeleton][data-skeleton-label=""]::before{ content:''; }
@keyframes shimmer{ 0%{ background-position: 200% 0; } 100%{ background-position: -200% 0; } }

/* Banner */
.banner{ background: linear-gradient(90deg, rgba(0,0,0,.25), rgba(0,0,0,0)); border: 1px solid var(--border); border-radius: 10px; padding: 2rem 1.6rem; margin-bottom: 1rem; box-shadow: 0 8px 30px rgba(0,0,0,.25) inset; }
.banner h1{ font-size: 2rem; margin:0 0 .35rem; }
.banner .subtitle{ color: var(--muted); font-size:.95rem; }

/* Home actions */
.actions-grid{ display:grid; grid-template-columns: repeat( auto-fill, minmax(220px, 1fr) ); gap: .75rem; }
.action-button{ display:block; text-decoration:none; color: var(--text); border:1px solid var(--border); background: var(--panel); padding:1.25rem; border-radius:10px; text-align:center; font-weight:600; }
.action-button:hover{ border-color: color-mix(in srgb, var(--border) 70%, var(--text) 30%); background: color-mix(in srgb, var(--panel) 80%, var(--text) 20%); }
.action-button.primary{ background: linear-gradient(180deg, rgba(14,104,171,.25), rgba(14,104,171,.05)); border-color: #274766; }

/* Home page darker buttons */
.home-button.btn-secondary {
  background: var(--btn-bg, #1a1d24);
  color: var(--btn-text, #e8e8e8);
  border-color: var(--border);
}
.home-button.btn-secondary:hover {
  background: var(--btn-hover-bg, #22252d);
  border-color: var(--border);
}
.home-button.btn-primary {
  background: var(--blue-main);
  color: white;
  border-color: var(--blue-main);
}
.home-button.btn-primary:hover {
  background: #0c5aa6;
  border-color: #0c5aa6;
}

/* Card grid for added cards (responsive, compact tiles) */
.card-grid{
	display:grid;
	grid-template-columns: repeat(auto-fill, minmax(170px, 170px)); /* ~160px image + padding */
	gap: .5rem;
	margin-top:.5rem;
	justify-content: start; /* pack as many as possible per row */
	/* Prevent scroll chaining bounce that can cause flicker near bottom */
	overscroll-behavior: contain;
	content-visibility: auto;
	contain: layout paint;
	contain-intrinsic-size: 640px 420px;
}
@media (max-width: 420px){
	.card-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.card-tile{ width: 100%; }
	.card-tile img{ width: 100%; max-width: 160px; margin: 0 auto; }
}
.card-tile{
	width:170px;
	position: relative;
	background: var(--panel);
	border:1px solid var(--border);
	border-radius:6px;
	padding:.25rem .25rem .4rem;
	text-align:center;
}
.card-tile.game-changer{ border-color: var(--red-main); box-shadow: 0 0 0 1px rgba(211,32,42,.35) inset; }
.card-tile.locked{
	/* Subtle yellow/goldish-white accent for locked cards */
	border-color: #f5e6a8; /* soft parchment gold */
	box-shadow: 0 0 0 2px rgba(245,230,168,.28) inset;
}
.card-tile.must-include{
	border-color: rgba(74,222,128,.85);
	box-shadow: 0 0 0 1px rgba(74,222,128,.32) inset, 0 0 12px rgba(74,222,128,.2);
}
.card-tile.must-exclude{
	border-color: rgba(239,68,68,.85);
	box-shadow: 0 0 0 1px rgba(239,68,68,.35) inset;
	opacity: .95;
}
.card-tile.must-include.must-exclude{
	border-color: rgba(249,115,22,.85);
	box-shadow: 0 0 0 1px rgba(249,115,22,.4) inset;
}
.card-tile img{ width:160px; height:auto; border-radius:6px; box-shadow: 0 6px 18px rgba(0,0,0,.35); background:#111; }
.card-tile .name{ font-weight:600; margin-top:.25rem; font-size:.92rem; }
.card-tile .reason{ color:var(--muted); font-size:.85rem; margin-top:.15rem; }

.must-have-controls{
	display:flex;
	justify-content:center;
	gap:.35rem;
	flex-wrap:wrap;
	margin-top:.35rem;
}
.must-have-btn{
	border:1px solid var(--border);
	background:rgba(30,41,59,.6);
	color:#f8fafc;
	font-size:11px;
	text-transform:uppercase;
	letter-spacing:.06em;
	padding:.25rem .6rem;
	border-radius:9999px;
	cursor:pointer;
	transition: all .18s ease;
}
.must-have-btn.include[data-active="1"], .must-have-btn.include:hover{
	border-color: rgba(74,222,128,.75);
	background: rgba(74,222,128,.18);
	color: #bbf7d0;
	box-shadow: 0 0 0 1px rgba(16,185,129,.25);
}
.must-have-btn.exclude[data-active="1"], .must-have-btn.exclude:hover{
	border-color: rgba(239,68,68,.75);
	background: rgba(239,68,68,.18);
	color: #fecaca;
	box-shadow: 0 0 0 1px rgba(239,68,68,.25);
}
.must-have-btn:focus-visible{
	outline:2px solid rgba(59,130,246,.6);
	outline-offset:2px;
}
.card-tile.must-exclude .must-have-btn.include[data-active="0"],
.card-tile.must-include .must-have-btn.exclude[data-active="0"]{
	opacity:.65;
}

.group-grid{ content-visibility: auto; contain: layout paint; contain-intrinsic-size: 540px 360px; }
.alt-list{ list-style:none; padding:0; margin:0; display:grid; gap:.25rem; content-visibility: auto; contain: layout paint; contain-intrinsic-size: 320px 220px; }
.alt-option{ display:block !important; width:100%; max-width:100%; text-align:left; white-space:normal !important; word-wrap:break-word !important; overflow-wrap:break-word !important; line-height:1.3 !important; padding:0.5rem 0.7rem !important; }

/* Shared ownership badge for card tiles and stacked images */
.owned-badge{
	position:absolute;
	top:6px;
	left:6px;
	background:var(--panel);
	color:var(--text);
	border:1px solid var(--border);
	border-radius:12px;
	font-size:12px;
	line-height:18px;
	height:18px;
	min-width:18px;
	padding:0 6px;
	text-align:center;
	pointer-events:none;
	z-index:2;
}

/* Step 1 candidate grid (200px-wide scaled images) */
.candidate-grid{
	display:grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap:.75rem;
}
.candidate-tile{
	background: var(--panel);
	border:1px solid var(--border);
	border-radius:8px;
	padding:.4rem;
}
.candidate-tile .img-btn{ display:block; width:100%; padding:0; background:transparent; border:none; cursor:pointer; }
.candidate-tile img{ width:100%; max-width:200px; height:auto; border-radius:8px; box-shadow:0 6px 18px rgba(0,0,0,.35); background: var(--panel); display:block; margin:0 auto; }
.candidate-tile .meta{ text-align:center; margin-top:.35rem; }
.candidate-tile .name{ font-weight:600; font-size:.95rem; }
.candidate-tile .score{ color:var(--muted); font-size:.85rem; }

/* Deck summary: highlight game changers */
.game-changer { color: var(--green-main); }
.stack-card.game-changer { outline: 2px solid var(--green-main); }

/* Image button inside card tiles */
.card-tile .img-btn{ display:block; padding:0; background:transparent; border:none; cursor:pointer; width:100%; }

/* Stage Navigator */
.stage-nav { margin:.5rem 0 1rem; }
.stage-nav ol { list-style:none; padding:0; margin:0; display:flex; gap:.35rem; flex-wrap:wrap; }
.stage-nav .stage-link { display:flex; align-items:center; gap:.4rem; background: var(--panel); border:1px solid var(--border); color:var(--text); border-radius:999px; padding:.25rem .6rem; cursor:pointer; }
.stage-nav .stage-item.done .stage-link { opacity:.75; }
.stage-nav .stage-item.current .stage-link { box-shadow: 0 0 0 2px rgba(96,165,250,.4) inset; border-color:#3b82f6; }
.stage-nav .idx { display:inline-grid; place-items:center; width:20px; height:20px; border-radius:50%; background:var(--bg); font-size:12px; }
.stage-nav .name { font-size:12px; }

/* Build controls sticky box tweaks */
.build-controls { 
	position: sticky; 
	top: calc(var(--banner-offset, 48px) + 6px); 
	z-index: 100;
	background: var(--panel);
	backdrop-filter: blur(8px);
	border: 1px solid var(--border);
	border-radius: 10px;
	margin: 0.5rem 0;
	box-shadow: 0 4px 12px rgba(0,0,0,.25);
}

@media (max-width: 1024px){
	:root { --banner-offset: 56px; }
	.build-controls { 
		position: fixed !important; /* Fixed to viewport instead of sticky */
		bottom: 0 !important; /* Anchor to bottom of screen */
		left: 0 !important;
		right: 0 !important;
		top: auto !important; /* Override top positioning */
		border-radius: 0 !important; /* Remove border radius for full width */
		margin: 0 !important; /* Remove margins for full edge-to-edge */
		padding: 0.5rem !important; /* Reduced padding */
		box-shadow: 0 -6px 20px rgba(0,0,0,.4) !important; /* Upward shadow */
		border-left: none !important;
		border-right: none !important;
		border-bottom: none !important; /* Remove bottom border */
		background: linear-gradient(180deg, rgba(15,17,21,.99), rgba(15,17,21,.95)) !important;
		z-index: 1000 !important; /* Higher z-index to ensure it's above content */
	}
}
@media (min-width: 721px){
	:root { --banner-offset: 48px; }
}

/* Progress bar */
.progress { position: relative; height: 10px; background: var(--panel); border:1px solid var(--border); border-radius: 999px; overflow: hidden; }
.progress .bar { position:absolute; left:0; top:0; bottom:0; width: 0%; background: linear-gradient(90deg, rgba(96,165,250,.6), rgba(14,104,171,.9)); }
.progress.flash { box-shadow: 0 0 0 2px rgba(245,158,11,.35) inset; }

/* Chips */
.chip { display:inline-flex; align-items:center; gap:.35rem; background: var(--panel); border:1px solid var(--border); color:var(--text); border-radius:999px; padding:.2rem .55rem; font-size:12px; }
.chip .dot { width:8px; height:8px; border-radius:50%; background:#6b7280; }
.chip:hover { background: color-mix(in srgb, var(--panel) 85%, var(--text) 15%); border-color: color-mix(in srgb, var(--border) 70%, var(--text) 30%); }
.chip.active { 
  background: linear-gradient(135deg, rgba(59,130,246,.25), rgba(14,104,171,.15));
  border-color: #3b82f6;
  color: #60a5fa;
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(59,130,246,.2) inset;
}
.chip.active:hover {
  background: linear-gradient(135deg, rgba(59,130,246,.35), rgba(14,104,171,.25));
  border-color: #60a5fa;
}

/* Cards toolbar */
.cards-toolbar{ display:flex; flex-wrap:wrap; gap:.5rem .75rem; align-items:center; margin:.5rem 0 .25rem; }
.cards-toolbar input[type="text"]{ min-width: 220px; }
.cards-toolbar .sep{ width:1px; height:20px; background: var(--border); margin:0 .25rem; }
.cards-toolbar .hint{ color: var(--muted); font-size:12px; }

/* Collapse groups and reason toggle */
.group{ margin:.5rem 0; }
.group-header{ display:flex; align-items:center; gap:.5rem; }
.group-header h5{ margin:.4rem 0; }
.group-header .count{ color: var(--muted); font-size:12px; }
.group-header .toggle{ margin-left:auto; background: color-mix(in srgb, var(--panel) 80%, var(--text) 20%); color: var(--text); border:1px solid var(--border); border-radius:6px; padding:.2rem .5rem; font-size:12px; cursor:pointer; }
.group-grid[data-collapsed]{ display:none; }
.hide-reasons .card-tile .reason{ display:none; }
.card-tile.force-show .reason{ display:block !important; }
.card-tile.force-hide .reason{ display:none !important; }
.btn-why{ background: color-mix(in srgb, var(--panel) 80%, var(--text) 20%); color: var(--text); border:1px solid var(--border); border-radius:6px; padding:.15rem .4rem; font-size:12px; cursor:pointer; }
.chips-inline{ display:flex; gap:.35rem; flex-wrap:wrap; align-items:center; }
.chips-inline .chip{ cursor:pointer; user-select:none; }

/* Inline error banner */
.inline-error-banner{ background: color-mix(in srgb, var(--panel) 85%, #b91c1c 15%); border:1px solid #b91c1c; color:#b91c1c; padding:.5rem .6rem; border-radius:8px; margin-bottom:.5rem; }
.inline-error-banner .muted{ color:#fda4af; }

/* Alternatives panel */
.alts ul{ list-style:none; padding:0; margin:0; }
.alts li{ display:flex; align-items:center; gap:.4rem; }
/* LQIP blur/fade-in for thumbnails */
img.lqip { filter: blur(8px); opacity: .6; transition: filter .25s ease-out, opacity .25s ease-out; }
img.lqip.loaded { filter: blur(0); opacity: 1; }

/* Respect reduced motion: avoid blur/fade transitions for users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
	* { scroll-behavior: auto !important; }
	img.lqip { transition: none !important; filter: none !important; opacity: 1 !important; }
}

/* Virtualization wrapper should mirror grid to keep multi-column flow */
.virt-wrapper { display: grid; }

/* Mobile responsive fixes for horizontal scrolling issues */
@media (max-width: 768px) {
	/* Prevent horizontal overflow */
	html, body { 
		overflow-x: hidden !important; 
		width: 100% !important;
		max-width: 100vw !important;
	}

	/* Test hand responsive adjustments */
	#test-hand{ --card-w: 170px !important; --card-h: 238px !important; --overlap: .5 !important; }

	/* Modal & form layout fixes (original block retained inside media query) */
	/* Fix modal layout on mobile */
	.modal { 
		padding: 10px !important; 
		box-sizing: border-box;
	}
	.modal-content { 
		width: 100% !important;
		max-width: calc(100vw - 20px) !important;
		box-sizing: border-box !important;
		overflow-x: hidden !important;
	}
	/* Force single column for include/exclude grid */
	.include-exclude-grid { display: flex !important; flex-direction: column !important; gap: 1rem !important; }
	/* Fix basics grid */
	.basics-grid { grid-template-columns: 1fr !important; gap: 1rem !important; }
	/* Ensure all inputs and textareas fit properly */
	.modal input,
	.modal textarea,
	.modal select { width: 100% !important; max-width: 100% !important; box-sizing: border-box !important; min-width: 0 !important; }
	/* Fix chips containers */
	.modal [id$="_chips_container"] { max-width: 100% !important; overflow-x: hidden !important; word-wrap: break-word !important; }
	/* Ensure fieldsets don't overflow */
	.modal fieldset { max-width: 100% !important; box-sizing: border-box !important; overflow-x: hidden !important; }
	/* Fix any inline styles that might cause overflow */
	.modal fieldset > div,
	.modal fieldset > div > div { max-width: 100% !important; overflow-x: hidden !important; }
}

@media (max-width: 640px){
	#test-hand{ --card-w: 150px !important; --card-h: 210px !important; }
	/* Generic stack shrink */
	.stack-wrap:not(#test-hand){ --card-w: 150px; --card-h: 210px; }
}

@media (max-width: 560px){
	#test-hand{ --card-w: 140px !important; --card-h: 196px !important; padding-bottom:.75rem; }
	#test-hand .stack-grid{ display:flex !important; gap:.5rem; grid-template-columns:none !important; overflow-x:auto; padding-bottom:.25rem; }
	#test-hand .stack-card{ flex:0 0 auto; }
	.stack-wrap:not(#test-hand){ --card-w: 140px; --card-h: 196px; }
}

@media (max-width: 480px) {
	.modal-content {
		padding: 12px !important;
		margin: 5px !important;
	}
	
	.modal fieldset {
		padding: 8px !important;
		margin: 6px 0 !important;
	}
	
	/* Enhanced mobile build controls */
	.build-controls {
		flex-direction: column !important;
		gap: 0.25rem !important; /* Reduced gap */
		align-items: stretch !important;
		padding: 0.5rem !important; /* Reduced padding */
	}
	
	/* Two-column grid layout for mobile build controls */
	.build-controls {
		display: grid !important;
		grid-template-columns: 1fr 1fr !important; /* Two equal columns */
		grid-gap: 0.25rem !important;
		align-items: stretch !important;
	}
	
	.build-controls form {
		display: contents !important; /* Allow form contents to participate in grid */
		width: auto !important;
	}
	
	.build-controls button {
		flex: none !important;
		padding: 0.4rem 0.5rem !important; /* Much smaller padding */
		font-size: 12px !important; /* Smaller font */
		min-height: 36px !important; /* Smaller minimum height */
		line-height: 1.2 !important;
		width: 100% !important; /* Full width within grid cell */
		box-sizing: border-box !important;
		white-space: nowrap !important;
		display: flex !important;
		align-items: center !important;
		justify-content: center !important;
	}
	
	/* Hide non-essential elements on mobile to keep it clean */
	.build-controls .sep, 
	.build-controls .replace-toggle,
	.build-controls label[style*="margin-left"] {
		display: none !important;
	}
	
	.build-controls .sep {
		display: none !important; /* Hide separators on mobile */
	}
}

/* Desktop sizing for Test Hand */
@media (min-width: 900px) {
	#test-hand { --card-w: 280px !important; --card-h: 392px !important; }
}

/* Analytics accordion styling */
.analytics-accordion {
	transition: all 0.2s ease;
}

.analytics-accordion summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.analytics-accordion summary:hover {
	background: color-mix(in srgb, var(--bg) 70%, var(--text) 30%);
	border-color: var(--text);
}

.analytics-accordion summary:active {
	transform: scale(0.99);
}

.analytics-accordion[open] summary {
	border-bottom-left-radius: 0;
	border-bottom-right-radius: 0;
	margin-bottom: 0;
}

.analytics-accordion .analytics-content {
	animation: accordion-slide-down 0.3s ease-out;
}

@keyframes accordion-slide-down {
	from {
		opacity: 0;
		transform: translateY(-8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.analytics-placeholder .skeleton-pulse {
	animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
	0% { background-position: -200% 0; }
	100% { background-position: 200% 0; }
}

/* Ideals Slider Styling */
.ideals-slider {
	-webkit-appearance: none;
	appearance: none;
	height: 6px;
	background: var(--border);
	border-radius: 3px;
	outline: none;
}

.ideals-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 18px;
	height: 18px;
	background: var(--ring);
	border-radius: 50%;
	cursor: pointer;
	transition: all 0.15s ease;
}

.ideals-slider::-webkit-slider-thumb:hover {
	transform: scale(1.15);
	box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.2);
}

.ideals-slider::-moz-range-thumb {
	width: 18px;
	height: 18px;
	background: var(--ring);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	transition: all 0.15s ease;
}

.ideals-slider::-moz-range-thumb:hover {
	transform: scale(1.15);
	box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.2);
}

.slider-value {
	display: inline-block;
	padding: 0.25rem 0.5rem;
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 4px;
}

/* ========================================
   Card Browser Styles
   ======================================== */

/* Card browser container */
.card-browser-container {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

/* Filter panel */
.card-browser-filters {
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 1rem;
}

.filter-section {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.filter-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
}

.filter-row label {
	font-weight: 600;
	min-width: 80px;
	color: var(--text);
	font-size: 0.95rem;
}

.filter-row select,
.filter-row input[type="text"],
.filter-row input[type="search"] {
	flex: 1;
	min-width: 150px;
	max-width: 300px;
}

/* Search bar styling */
.card-search-wrapper {
	position: relative;
	flex: 1;
	max-width: 100%;
}

.card-search-wrapper input[type="search"] {
	width: 100%;
	padding: 0.5rem 0.75rem;
	font-size: 1rem;
}

/* Results count and info bar */
.card-browser-info {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.5rem;
	padding: 0.5rem 0;
}

.results-count {
	font-size: 0.95rem;
	color: var(--muted);
}

.page-indicator {
	font-size: 0.95rem;
	color: var(--text);
	font-weight: 600;
}

/* Card browser grid */
.card-browser-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 240px));
	gap: 0.5rem;
	padding: 0.5rem;
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 8px;
	min-height: 480px;
	justify-content: start;
}

/* Individual card tile in browser */
.card-browser-tile {
	break-inside: avoid;
	display: flex;
	flex-direction: column;
	background: var(--card-bg, #1a1d24);
	border: 1px solid var(--border);
	border-radius: 8px;
	overflow: hidden;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	cursor: pointer;
}

.card-browser-tile:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
	border-color: color-mix(in srgb, var(--border) 50%, var(--ring) 50%);
}

.card-browser-tile-image {
	position: relative;
	width: 100%;
	aspect-ratio: 488/680;
	overflow: hidden;
	background: #0a0b0e;
}

.card-browser-tile-image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	transition: transform 0.3s ease;
}

.card-browser-tile:hover .card-browser-tile-image img {
	transform: scale(1.05);
}

.card-browser-tile-info {
	padding: 0.75rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.card-browser-tile-name {
	font-weight: 600;
	font-size: 0.95rem;
	word-wrap: break-word;
	overflow-wrap: break-word;
	line-height: 1.3;
}

.card-browser-tile-type {
	font-size: 0.85rem;
	color: var(--muted);
	word-wrap: break-word;
	overflow-wrap: break-word;
	line-height: 1.3;
}

.card-browser-tile-stats {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 0.85rem;
}

.card-browser-tile-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
	margin-top: 0.25rem;
}

.card-browser-tile-tags .tag {
	font-size: 0.7rem;
	padding: 0.15rem 0.4rem;
	background: rgba(148, 163, 184, 0.15);
	color: var(--muted);
	border-radius: 3px;
	white-space: nowrap;
}

/* Card Details button on tiles */
.card-details-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.35rem;
	padding: 0.5rem 0.75rem;
	background: var(--primary);
	color: white;
	text-decoration: none;
	border-radius: 6px;
	font-weight: 500;
	font-size: 0.85rem;
	transition: all 0.2s;
	margin-top: 0.5rem;
	border: none;
	cursor: pointer;
}

.card-details-btn:hover {
	background: var(--primary-hover);
	transform: translateY(-1px);
	box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.card-details-btn svg {
	flex-shrink: 0;
}

/* Card Preview Modal */
.preview-modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.85);
	z-index: 9999;
	align-items: center;
	justify-content: center;
}

.preview-modal.active {
	display: flex;
}

.preview-content {
	position: relative;
	max-width: 90%;
	max-height: 90%;
}

.preview-content img {
	max-width: 100%;
	max-height: 90vh;
	border-radius: 12px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.preview-close {
	position: absolute;
	top: -40px;
	right: 0;
	background: rgba(255, 255, 255, 0.9);
	color: #000;
	border: none;
	border-radius: 50%;
	width: 36px;
	height: 36px;
	font-size: 24px;
	font-weight: bold;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
}

.preview-close:hover {
	background: #fff;
	transform: scale(1.1);
}

/* Pagination controls */
.card-browser-pagination {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 1rem;
	padding: 1rem 0;
	flex-wrap: wrap;
}

.card-browser-pagination .btn {
	min-width: 120px;
}

.card-browser-pagination .page-info {
	font-size: 0.95rem;
	color: var(--text);
	padding: 0 1rem;
}

/* No results message */
.no-results {
	text-align: center;
	padding: 3rem 1rem;
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 8px;
}

.no-results-title {
	font-size: 1.25rem;
	font-weight: 600;
	color: var(--text);
	margin-bottom: 0.5rem;
}

.no-results-message {
	color: var(--muted);
	margin-bottom: 1rem;
	line-height: 1.5;
}

.no-results-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	justify-content: center;
	margin-bottom: 1rem;
}

.no-results-filter-tag {
	padding: 0.25rem 0.75rem;
	background: rgba(148, 163, 184, 0.15);
	border: 1px solid var(--border);
	border-radius: 6px;
	font-size: 0.9rem;
	color: var(--text);
}

/* Loading indicator */
.card-browser-loading {
	text-align: center;
	padding: 2rem;
	color: var(--muted);
}

/* Responsive adjustments */
/* Large tablets and below - reduce to ~180px cards */
@media (max-width: 1024px) {
	.card-browser-grid {
		grid-template-columns: repeat(auto-fill, minmax(200px, 200px));
	}
}

/* Tablets - reduce to ~160px cards */
@media (max-width: 768px) {
	.card-browser-grid {
		grid-template-columns: repeat(auto-fill, minmax(180px, 180px));
		gap: 0.5rem;
		padding: 0.5rem;
	}
	
	.filter-row {
		flex-direction: column;
		align-items: stretch;
	}
	
	.filter-row label {
		min-width: auto;
	}
	
	.filter-row select,
	.filter-row input {
		max-width: 100%;
	}
	
	.card-browser-info {
		flex-direction: column;
		align-items: flex-start;
	}
}

/* Small tablets/large phones - reduce to ~140px cards */
@media (max-width: 600px) {
	.card-browser-grid {
		grid-template-columns: repeat(auto-fill, minmax(160px, 160px));
		gap: 0.5rem;
	}
}

/* Phones - 2 column layout with flexible width */
@media (max-width: 480px) {
	.card-browser-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 0.375rem;
	}
	
	.card-browser-tile-name {
		font-size: 0.85rem;
	}
	
	.card-browser-tile-type {
		font-size: 0.75rem;
	}
	
	.card-browser-tile-info {
		padding: 0.5rem;
	}
}

/* Theme chips for multi-select */
.theme-chip {
	display: inline-flex;
	align-items: center;
	background: var(--primary-bg);
	color: var(--primary-fg);
	padding: 0.25rem 0.75rem;
	border-radius: 1rem;
	font-size: 0.9rem;
	border: 1px solid var(--border-color);
}

.theme-chip button {
	margin-left: 0.5rem;
	background: none;
	border: none;
	color: inherit;
	cursor: pointer;
	padding: 0;
	font-weight: bold;
	font-size: 1.2rem;
	line-height: 1;
}

.theme-chip button:hover {
	color: var(--error-color);
}

/* Card Detail Page Styles */
.card-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: 1rem;
	margin-bottom: 1rem;
}

.card-tag {
	background: var(--ring);
	color: white;
	padding: 0.35rem 0.75rem;
	border-radius: 16px;
	font-size: 0.85rem;
	font-weight: 500;
}

.back-button {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.75rem 1.5rem;
	background: var(--panel);
	color: var(--text);
	text-decoration: none;
	border-radius: 8px;
	border: 1px solid var(--border);
	font-weight: 500;
	transition: all 0.2s;
	margin-bottom: 2rem;
}

.back-button:hover {
	background: var(--ring);
	color: white;
	border-color: var(--ring);
}

/* Card Detail Page - Main Card Image */
.card-image-large {
	flex: 0 0 auto;
	max-width: 360px !important;
	width: 100%;
}

.card-image-large img {
	width: 100%;
	height: auto;
	border-radius: 12px;
}

/* ============================================
   M2 Component Library Styles
   ============================================ */

/* === BUTTONS === */
/* Button Base - enhanced from existing .btn */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	background: var(--blue-main);
	color: #fff;
	border: none;
	border-radius: 6px;
	padding: 0.5rem 1rem;
	cursor: pointer;
	text-decoration: none;
	line-height: 1.5;
	font-weight: 500;
	transition: filter 0.15s ease, transform 0.05s ease;
	white-space: nowrap;
}

.btn:hover {
	filter: brightness(1.1);
	text-decoration: none;
}

.btn:active {
	transform: scale(0.98);
}

.btn:disabled,
.btn.disabled,
.btn[aria-disabled="true"] {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: none;
}

/* Button Variants */
.btn-primary {
	background: var(--blue-main);
	color: #fff;
}

.btn-secondary {
	background: var(--muted);
	color: var(--text);
}

.btn-ghost {
	background: transparent;
	color: var(--text);
	border: 1px solid var(--border);
}

.btn-ghost:hover {
	background: var(--panel);
	border-color: var(--text);
}

.btn-danger {
	background: var(--err);
	color: #fff;
}

/* Button Sizes */
.btn-sm {
	padding: 0.25rem 0.75rem;
	font-size: 0.875rem;
}

.btn-md {
	padding: 0.5rem 1rem;
	font-size: 0.875rem;
}

.btn-lg {
	padding: 0.75rem 1.5rem;
	font-size: 1rem;
}

/* Icon Button */
.btn-icon {
	padding: 0.5rem;
	aspect-ratio: 1;
	justify-content: center;
}

.btn-icon.btn-sm {
	padding: 0.25rem;
	font-size: 1rem;
}

/* Close Button */
.btn-close {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
	font-size: 1.5rem;
	line-height: 1;
	z-index: 10;
}

/* Tag/Chip Button */
.btn-tag {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	background: var(--panel);
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: 16px;
	padding: 0.25rem 0.75rem;
	font-size: 0.875rem;
	transition: all 0.15s ease;
}

.btn-tag:hover {
	background: var(--border);
	border-color: var(--text);
}

.btn-tag-selected {
	background: var(--blue-main);
	color: #fff;
	border-color: var(--blue-main);
}

.btn-tag-remove {
	background: transparent;
	border: none;
	color: inherit;
	padding: 0;
	margin: 0;
	font-size: 1rem;
	line-height: 1;
	cursor: pointer;
	opacity: 0.7;
}

.btn-tag-remove:hover {
	opacity: 1;
}

/* Button Group */
.btn-group {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.btn-group-left {
	justify-content: flex-start;
}

.btn-group-center {
	justify-content: center;
}

.btn-group-right {
	justify-content: flex-end;
}

.btn-group-between {
	justify-content: space-between;
}

/* Legacy action-btn compatibility */
.action-btn {
	padding: 0.75rem 1.5rem;
	font-size: 1rem;
}

/* === MODALS === */
.modal {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.modal-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	backdrop-filter: blur(2px);
	z-index: -1;
}

.modal-content {
	position: relative;
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 10px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
	padding: 1rem;
	width: 100%;
	max-height: min(92vh, 100%);
	display: flex;
	flex-direction: column;
}

/* Modal Sizes */
.modal-sm .modal-content {
	max-width: 480px;
}

.modal-md .modal-content {
	max-width: 620px;
}

.modal-lg .modal-content {
	max-width: 720px;
}

.modal-xl .modal-content {
	max-width: 960px;
}

/* Modal Position */
.modal-center {
	align-items: center;
}

.modal-top {
	align-items: flex-start;
	padding-top: 2rem;
}

/* Modal Scrollable */
.modal-scrollable .modal-content {
	overflow: auto;
	-webkit-overflow-scrolling: touch;
}

/* Modal Structure */
.modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1rem;
	padding-right: 2rem;
}

.modal-title {
	font-size: 1.25rem;
	font-weight: 600;
	margin: 0;
	color: var(--text);
}

.modal-body {
	flex: 1;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.modal-footer {
	display: flex;
	gap: 0.5rem;
	justify-content: flex-end;
	margin-top: 1rem;
	padding-top: 1rem;
	border-top: 1px solid var(--border);
}

/* Modal Variants */
.modal-confirm .modal-body {
	padding: 1rem 0;
	font-size: 0.95rem;
}

.modal-alert {
	text-align: center;
}

.modal-alert .modal-body {
	padding: 1.5rem 0;
}

.modal-alert .alert-icon {
	font-size: 3rem;
	margin-bottom: 1rem;
}

.modal-alert-info .alert-icon::before {
	content: 'ℹ️';
}

.modal-alert-success .alert-icon::before {
	content: '✅';
}

.modal-alert-warning .alert-icon::before {
	content: '⚠️';
}

.modal-alert-error .alert-icon::before {
	content: '❌';
}

/* === FORMS === */
.form-field {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin-bottom: 1rem;
}

.form-label {
	font-weight: 500;
	font-size: 0.875rem;
	color: var(--text);
	display: flex;
	align-items: center;
	gap: 0.25rem;
}

.form-required {
	color: var(--err);
	font-weight: bold;
}

.form-input-wrapper {
	display: flex;
	flex-direction: column;
}

.form-input,
.form-textarea,
.form-select {
	background: var(--panel);
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: 6px;
	padding: 0.5rem 0.75rem;
	font-size: 0.875rem;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	width: 100%;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
	outline: none;
	border-color: var(--ring);
	box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

.form-input:disabled,
.form-textarea:disabled,
.form-select:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.form-textarea {
	resize: vertical;
	min-height: 80px;
}

.form-input-number {
	max-width: 150px;
}

.form-input-file {
	padding: 0.375rem 0.5rem;
}

/* Checkbox and Radio */
.form-field-checkbox,
.form-field-radio {
	flex-direction: row;
	align-items: flex-start;
}

.form-checkbox-label,
.form-radio-label {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	cursor: pointer;
	font-weight: normal;
}

.form-checkbox,
.form-radio {
	width: 1.125rem;
	height: 1.125rem;
	border: 1px solid var(--border);
	cursor: pointer;
	flex-shrink: 0;
}

.form-checkbox {
	border-radius: 4px;
}

.form-radio {
	border-radius: 50%;
}

.form-checkbox:checked,
.form-radio:checked {
	background: var(--blue-main);
	border-color: var(--blue-main);
}

.form-checkbox:focus,
.form-radio:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

.form-radio-group {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

/* Form Help and Error Text */
.form-help-text {
	font-size: 0.8rem;
	color: var(--muted);
	margin-top: -0.25rem;
}

.form-error-text {
	font-size: 0.8rem;
	color: var(--err);
	margin-top: -0.25rem;
}

.form-field-error .form-input,
.form-field-error .form-textarea,
.form-field-error .form-select {
	border-color: var(--err);
}

/* === CARD DISPLAY COMPONENTS === */
/* Card Thumbnail Container */
.card-thumb-container {
	position: relative;
	display: inline-block;
}

.card-thumb {
	display: block;
	border-radius: 10px;
	border: 1px solid var(--border);
	background: #0b0d12;
	object-fit: cover;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-thumb:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

/* Card Thumbnail Sizes */
.card-thumb-small .card-thumb {
	width: 160px;
	height: auto;
}

.card-thumb-medium .card-thumb {
	width: 230px;
	height: auto;
}

.card-thumb-large .card-thumb {
	width: 360px;
	height: auto;
}

/* Card Flip Button */
.card-flip-btn {
	position: absolute;
	bottom: 8px;
	right: 8px;
	background: rgba(0, 0, 0, 0.75);
	color: #fff;
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 6px;
	padding: 0.375rem;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	backdrop-filter: blur(4px);
	transition: background 0.15s ease;
	z-index: 5;
}

.card-flip-btn:hover {
	background: rgba(0, 0, 0, 0.9);
	border-color: rgba(255, 255, 255, 0.4);
}

.card-flip-btn svg {
	width: 16px;
	height: 16px;
}

/* Card Name Label */
.card-name-label {
	font-size: 0.75rem;
	margin-top: 0.375rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	font-weight: 600;
	text-align: center;
}

/* Card Hover Popup */
.card-popup {
	position: fixed;
	inset: 0;
	z-index: 2000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.card-popup-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.7);
	backdrop-filter: blur(2px);
	z-index: -1;
}

.card-popup-content {
	position: relative;
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 10px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
	padding: 1rem;
	max-width: 400px;
	width: 100%;
}

.card-popup-image {
	position: relative;
	margin-bottom: 1rem;
}

.card-popup-image img {
	width: 100%;
	height: auto;
	border-radius: 10px;
	border: 1px solid var(--border);
}

.card-popup-info {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.card-popup-name {
	font-size: 1.125rem;
	font-weight: 600;
	margin: 0;
	color: var(--text);
}

.card-popup-role {
	font-size: 0.875rem;
	color: var(--muted);
}

.card-popup-role span {
	color: var(--text);
	font-weight: 500;
}

.card-popup-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.375rem;
}

.card-popup-tag {
	background: var(--panel);
	border: 1px solid var(--border);
	color: var(--text);
	padding: 0.25rem 0.5rem;
	border-radius: 12px;
	font-size: 0.75rem;
}

.card-popup-tag-highlight {
	background: var(--blue-main);
	color: #fff;
	border-color: var(--blue-main);
}

.card-popup-close {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
	background: rgba(0, 0, 0, 0.75);
	color: #fff;
	border: none;
	border-radius: 6px;
	width: 2rem;
	height: 2rem;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	backdrop-filter: blur(4px);
}

.card-popup-close:hover {
	background: rgba(0, 0, 0, 0.9);
}

/* Card Grid */
.card-grid {
	display: grid;
	gap: 0.75rem;
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.card-grid-cols-auto {
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.card-grid-cols-2 {
	grid-template-columns: repeat(2, 1fr);
}

.card-grid-cols-3 {
	grid-template-columns: repeat(3, 1fr);
}

.card-grid-cols-4 {
	grid-template-columns: repeat(4, 1fr);
}

.card-grid-cols-5 {
	grid-template-columns: repeat(5, 1fr);
}

.card-grid-cols-6 {
	grid-template-columns: repeat(6, 1fr);
}

@media (max-width: 768px) {
	.card-grid {
		grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	}
}

/* Card List */
.card-list-item {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.5rem;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--panel);
	transition: background 0.15s ease;
}

.card-list-item:hover {
	background: color-mix(in srgb, var(--panel) 80%, var(--text) 20%);
}

.card-list-item-info {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex: 1;
	min-width: 0;
}

.card-list-item-name {
	font-weight: 500;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.card-list-item-count {
	color: var(--muted);
	font-size: 0.875rem;
}

.card-list-item-role {
	color: var(--muted);
	font-size: 0.75rem;
	padding: 0.125rem 0.5rem;
	background: rgba(255, 255, 255, 0.05);
	border-radius: 12px;
}

/* Synthetic Card Placeholder */
.card-sample.synthetic {
	border: 1px dashed var(--border);
	border-radius: 10px;
	background: var(--panel);
	padding: 1rem;
	display: flex;
	align-items: center;
	justify-content: center;
}

.synthetic-card-placeholder {
	text-align: center;
}

.synthetic-card-icon {
	font-size: 2rem;
	opacity: 0.5;
	margin-bottom: 0.5rem;
}

.synthetic-card-name {
	font-weight: 600;
	font-size: 0.875rem;
	margin-bottom: 0.25rem;
}

.synthetic-card-reason {
	font-size: 0.75rem;
	color: var(--muted);
}

/* === PANELS === */
.panel {
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 10px;
	margin-bottom: 0.75rem;
}

/* Panel Variants */
.panel-default {
	background: var(--panel);
}

.panel-alt {
	background: color-mix(in srgb, var(--panel) 50%, var(--bg) 50%);
}

.panel-dark {
	background: #0f1115;
}

.panel-bordered {
	background: transparent;
}

/* Panel Padding */
.panel-padding-none {
	padding: 0;
}

.panel-padding-sm {
	padding: 0.5rem;
}

.panel-padding-md {
	padding: 0.75rem;
}

.panel-padding-lg {
	padding: 1.5rem;
}

/* Panel Structure */
.panel-header {
	padding: 0.75rem;
	border-bottom: 1px solid var(--border);
}

.panel-title {
	font-size: 1.125rem;
	font-weight: 600;
	margin: 0;
	color: var(--text);
}

.panel-body {
	padding: 0.75rem;
}

.panel-footer {
	padding: 0.75rem;
	border-top: 1px solid var(--border);
}

/* Info Panel */
.panel-info {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	padding: 1rem;
}

.panel-info-content {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	flex: 1;
}

.panel-info-icon {
	font-size: 1.5rem;
	flex-shrink: 0;
}

.panel-info-text {
	flex: 1;
}

.panel-info-title {
	font-size: 1rem;
	font-weight: 600;
	margin: 0 0 0.25rem;
	color: var(--text);
}

.panel-info-message {
	font-size: 0.875rem;
	color: var(--muted);
}

.panel-info-action {
	flex-shrink: 0;
}

/* Info Panel Variants */
.panel-info-info {
	border-color: var(--ring);
	background: color-mix(in srgb, var(--ring) 10%, var(--panel) 90%);
}

.panel-info-success {
	border-color: var(--ok);
	background: color-mix(in srgb, var(--ok) 10%, var(--panel) 90%);
}

.panel-info-warning {
	border-color: var(--warn);
	background: color-mix(in srgb, var(--warn) 10%, var(--panel) 90%);
}

.panel-info-error {
	border-color: var(--err);
	background: color-mix(in srgb, var(--err) 10%, var(--panel) 90%);
}

/* Stat Panel */
.panel-stat {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 1rem;
	text-align: center;
	flex-direction: column;
}

.panel-stat-icon {
	font-size: 2rem;
}

.panel-stat-content {
	display: flex;
	flex-direction: column;
	align-items: center;
}

.panel-stat-value {
	font-size: 2rem;
	font-weight: 700;
	line-height: 1;
	color: var(--text);
}

.panel-stat-label {
	font-size: 0.875rem;
	color: var(--muted);
	margin-top: 0.25rem;
}

.panel-stat-sublabel {
	font-size: 0.75rem;
	color: var(--muted);
	margin-top: 0.125rem;
}

/* Stat Panel Variants */
.panel-stat-primary {
	border-color: var(--ring);
}

.panel-stat-primary .panel-stat-value {
	color: var(--ring);
}

.panel-stat-success {
	border-color: var(--ok);
}

.panel-stat-success .panel-stat-value {
	color: var(--ok);
}

.panel-stat-warning {
	border-color: var(--warn);
}

.panel-stat-warning .panel-stat-value {
	color: var(--warn);
}

.panel-stat-error {
	border-color: var(--err);
}

.panel-stat-error .panel-stat-value {
	color: var(--err);
}

/* Collapsible Panel */
.panel-collapsible .panel-header {
	padding: 0;
	border: none;
}

.panel-toggle {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.75rem;
	background: transparent;
	border: none;
	color: var(--text);
	cursor: pointer;
	text-align: left;
	border-radius: 10px 10px 0 0;
	transition: background 0.15s ease;
}

.panel-toggle:hover {
	background: color-mix(in srgb, var(--panel) 80%, var(--text) 20%);
}

.panel-toggle-icon {
	width: 0;
	height: 0;
	border-left: 6px solid transparent;
	border-right: 6px solid transparent;
	border-top: 8px solid var(--text);
	transition: transform 0.2s ease;
}

.panel-collapsed .panel-toggle-icon {
	transform: rotate(-90deg);
}

.panel-expanded .panel-toggle-icon {
	transform: rotate(0deg);
}

.panel-collapse-content {
	overflow: hidden;
	transition: max-height 0.3s ease;
}

/* Panel Grid */
.panel-grid {
	display: grid;
	gap: 1rem;
}

.panel-grid-cols-auto {
	grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.panel-grid-cols-1 {
	grid-template-columns: 1fr;
}

.panel-grid-cols-2 {
	grid-template-columns: repeat(2, 1fr);
}

.panel-grid-cols-3 {
	grid-template-columns: repeat(3, 1fr);
}

.panel-grid-cols-4 {
	grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {
	.panel-grid {
		grid-template-columns: 1fr;
	}
}

/* Empty State Panel */
.panel-empty-state {
	text-align: center;
	padding: 3rem 1.5rem;
}

.panel-empty-icon {
	font-size: 4rem;
	opacity: 0.5;
	margin-bottom: 1rem;
}

.panel-empty-title {
	font-size: 1.25rem;
	font-weight: 600;
	margin: 0 0 0.5rem;
	color: var(--text);
}

.panel-empty-message {
	font-size: 0.95rem;
	color: var(--muted);
	margin: 0 0 1.5rem;
}

.panel-empty-action {
	display: flex;
	justify-content: center;
}

/* Loading Panel */
.panel-loading {
	text-align: center;
	padding: 2rem 1rem;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1rem;
}

.panel-loading-spinner {
	width: 3rem;
	height: 3rem;
	border: 4px solid var(--border);
	border-top-color: var(--ring);
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

.panel-loading-message {
	font-size: 0.95rem;
	color: var(--muted);
}

/* =============================================================================
   UTILITY CLASSES - Common Layout Patterns (Added 2025-10-21)
   ============================================================================= */

/* Flex Row Layouts */
.flex-row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.flex-row-sm {
	display: flex;
	align-items: center;
	gap: 0.25rem;
}

.flex-row-md {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.flex-row-lg {
	display: flex;
	align-items: center;
	gap: 1rem;
}

.flex-row-between {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
}

.flex-row-wrap {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.flex-row-start {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
}

/* Flex Column Layouts */
.flex-col {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.flex-col-sm {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.flex-col-md {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.flex-col-lg {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.flex-col-center {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
}

/* Flex Grid/Wrap Patterns */
.flex-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.flex-grid-sm {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
}

.flex-grid-md {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}

.flex-grid-lg {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
}

/* Spacing Utilities */
.section-spacing {
	margin-top: 2rem;
}

.section-spacing-sm {
	margin-top: 1rem;
}

.section-spacing-lg {
	margin-top: 3rem;
}

.content-spacing {
	margin-bottom: 1rem;
}

.content-spacing-sm {
	margin-bottom: 0.5rem;
}

.content-spacing-lg {
	margin-bottom: 2rem;
}

/* Common Size Constraints */
.max-w-content {
	max-width: 1200px;
	margin-left: auto;
	margin-right: auto;
}

.max-w-prose {
	max-width: 65ch;
	margin-left: auto;
	margin-right: auto;
}

.max-w-form {
	max-width: 600px;
}

/* Common Text Patterns */
.text-muted {
	color: var(--muted);
	opacity: 0.85;
}

.text-xs {
	font-size: 0.75rem;
	line-height: 1.25;
}

.text-sm {
	font-size: 0.875rem;
	line-height: 1.35;
}

.text-base {
	font-size: 1rem;
	line-height: 1.5;
}

/* Screen Reader Only */
.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* =============================================================================
   CARD HOVER SYSTEM (Moved from base.html 2025-10-21)
   ============================================================================= */

.card-hover {
	position: fixed;
	pointer-events: none;
	z-index: 9999;
	display: none;
}

.card-hover-inner {
	display: flex;
	gap: 12px;
	align-items: flex-start;
}

.card-hover img {
	width: 320px;
	height: auto;
	display: block;
	border-radius: 8px;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
	border: 1px solid var(--border);
	background: var(--panel);
}

.card-hover .dual {
	display: flex;
	gap: 12px;
	align-items: flex-start;
}

.card-meta {
	background: var(--panel);
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 0.5rem 0.6rem;
	max-width: 320px;
	font-size: 13px;
	line-height: 1.4;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.card-meta ul {
	margin: 0.25rem 0;
	padding-left: 1.1rem;
	list-style: disc;
}

.card-meta li {
	margin: 0.1rem 0;
}

.card-meta .themes-list {
	font-size: 18px;
	line-height: 1.35;
}

.card-meta .label {
	color: #94a3b8;
	text-transform: uppercase;
	font-size: 10px;
	letter-spacing: 0.04em;
	display: block;
	margin-bottom: 0.15rem;
}

.card-meta .themes-label {
	color: var(--text);
	font-size: 20px;
	letter-spacing: 0.05em;
}

.card-meta .line + .line {
	margin-top: 0.35rem;
}

.card-hover .themes-list li.overlap {
	color: #0ea5e9;
	font-weight: 600;
}

.card-hover .ov-chip {
	display: inline-block;
	background: #38bdf8;
	color: #102746;
	border: 1px solid #0f3a57;
	border-radius: 12px;
	padding: 2px 6px;
	font-size: 11px;
	margin-right: 4px;
	font-weight: 600;
}

/* Two-faced: keep full single-card width; allow wrapping on narrow viewport */
.card-hover .dual.two-faced img {
	width: 320px;
}

.card-hover .dual.two-faced {
	gap: 8px;
}

/* Combo (two distinct cards) keep larger but slightly reduced to fit side-by-side */
.card-hover .dual.combo img {
	width: 300px;
}

@media (max-width: 1100px) {
	.card-hover .dual.two-faced img {
		width: 280px;
	}
	.card-hover .dual.combo img {
		width: 260px;
	}
}

/* Hide hover preview on narrow screens to avoid covering content */
@media (max-width: 900px) {
	.card-hover {
		display: none !important;
	}
}

/* =============================================================================
   THEME BADGES (Moved from base.html 2025-10-21)
   ============================================================================= */

.theme-badge {
	display: inline-block;
	padding: 2px 6px;
	border-radius: 12px;
	font-size: 10px;
	background: var(--panel-alt);
	border: 1px solid var(--border);
	letter-spacing: 0.5px;
}

.theme-synergies {
	font-size: 11px;
	opacity: 0.85;
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

.badge-fallback {
	background: #7f1d1d;
	color: #fff;
}

/* Quality tier badges (editorial quality scoring) */
.badge-quality-excellent {
	background: #10b981;
	color: #fff;
}

.badge-quality-good {
	background: #3b82f6;
	color: #fff;
}

.badge-quality-fair {
	background: #f59e0b;
	color: #fff;
}

.badge-quality-poor {
	background: #ef4444;
	color: #fff;
}

/* Pool size tier badges (card availability) */
.badge-pool-vast {
	background: #8b5cf6;  /* violet */
	color: #fff;
}

.badge-pool-large {
	background: #14b8a6;  /* teal */
	color: #fff;
}

.badge-pool-moderate {
	background: #06b6d4;  /* cyan */
	color: #fff;
}

.badge-pool-small {
	background: #f97316;  /* orange */
	color: #fff;
}

.badge-pool-tiny {
	background: #6b7280;  /* gray */
	color: #fff;
}

/* Pool size badge for chip context (R21 M2) */
.badge-pool {
	font-size: 10px;
	color: #6b7280;
	background: transparent;
	font-weight: 400;
	padding: 0;
	margin-left: .15rem;
}

.chip.active .badge-pool {
	color: #93c5fd;  /* lighter blue for active chips */
}

/* Legacy lifecycle quality badges (draft/reviewed/final) */
.badge-quality-draft {
	background: #4338ca;
	color: #fff;
}

.badge-quality-reviewed {
	background: #065f46;
	color: #fff;
}

.badge-quality-final {
	background: #065f46;
	color: #fff;
	font-weight: 600;
}

/* Popularity bucket badges */
.badge-pop-vc {
	background: #065f46;
	color: #fff;
}

.badge-pop-c {
	background: #047857;
	color: #fff;
}

.badge-pop-u {
	background: #0369a1;
	color: #fff;
}

.badge-pop-n {
	background: #92400e;
	color: #fff;
}

.badge-pop-r {
	background: #7f1d1d;
	color: #fff;
}

.badge-curated {
	background: #4f46e5;
	color: #fff;
}

.badge-enforced {
	background: #334155;
	color: #fff;
}

.badge-inferred {
	background: #57534e;
	color: #fff;
}

.theme-detail-card {
	background: var(--panel);
	padding: 1rem 1.1rem;
	border: 1px solid var(--border);
	border-radius: 10px;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.theme-list-card {
	background: var(--panel);
	padding: 0.6rem 0.75rem;
	border: 1px solid var(--border);
	border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
	transition: background-color 0.15s ease;
}

.theme-list-card:hover {
	background: var(--hover);
}

.theme-detail-card h3 {
	margin-top: 0;
	margin-bottom: 0.4rem;
}

.theme-detail-card .desc {
	margin-top: 0;
	font-size: 13px;
	line-height: 1.45;
}

.theme-detail-card h4 {
	margin-bottom: 0.35rem;
	margin-top: 0.85rem;
	font-size: 13px;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	opacity: 0.85;
}

.breadcrumb {
	font-size: 12px;
	margin-bottom: 0.4rem;
}

/* =============================================================================
   HOVER CARD PANEL (Moved from base.html 2025-10-21)
   ============================================================================= */

/* Unified hover-card-panel styling parity */
#hover-card-panel.is-payoff {
	border-color: var(--accent, #38bdf8);
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.65), 0 0 0 1px var(--accent, #38bdf8) inset;
}

#hover-card-panel.is-payoff .hcp-img {
	border-color: var(--accent, #38bdf8);
}

/* Two-column hover layout */
#hover-card-panel .hcp-body {
	display: grid;
	grid-template-columns: 320px 1fr;
	gap: 18px;
	align-items: start;
}

#hover-card-panel .hcp-img-wrap {
	grid-column: 1 / 2;
}

#hover-card-panel.compact-img .hcp-body {
	grid-template-columns: 120px 1fr;
}

#hover-card-panel.hcp-simple {
	width: auto !important;
	max-width: min(360px, 90vw) !important;
	padding: 12px !important;
	height: auto !important;
	max-height: none !important;
	overflow: hidden !important;
}

#hover-card-panel.hcp-simple .hcp-body {
	display: flex;
	flex-direction: column;
	gap: 12px;
	align-items: center;
}

#hover-card-panel.hcp-simple .hcp-right {
	display: none !important;
}

#hover-card-panel.hcp-simple .hcp-img {
	max-width: 100%;
}

/* Tag list as multi-column list instead of pill chips for readability */
#hover-card-panel .hcp-taglist {
	columns: 2;
	column-gap: 18px;
	font-size: 13px;
	line-height: 1.3;
	margin: 6px 0 6px;
	padding: 0;
	list-style: none;
	max-height: 180px;
	overflow: auto;
}

#hover-card-panel .hcp-taglist li {
	break-inside: avoid;
	padding: 2px 0 2px 0;
	position: relative;
}

#hover-card-panel .hcp-taglist li.overlap {
	font-weight: 600;
	color: var(--accent, #38bdf8);
}

#hover-card-panel .hcp-taglist li.overlap::before {
	content: '•';
	color: var(--accent, #38bdf8);
	position: absolute;
	left: -10px;
}

#hover-card-panel .hcp-overlaps {
	font-size: 10px;
	line-height: 1.25;
	margin-top: 2px;
}

#hover-card-panel .hcp-ov-chip {
	display: inline-flex;
	align-items: center;
	background: var(--accent, #38bdf8);
	color: #102746;
	border: 1px solid rgba(10, 54, 82, 0.6);
	border-radius: 9999px;
	padding: 3px 10px;
	font-size: 13px;
	margin-right: 6px;
	margin-top: 4px;
	font-weight: 500;
	letter-spacing: 0.02em;
}

/* Mobile hover panel */
#hover-card-panel.mobile {
	left: 50% !important;
	top: 50% !important;
	bottom: auto !important;
	transform: translate(-50%, -50%);
	width: min(94vw, 460px) !important;
	max-height: 88vh;
	overflow-y: auto;
	padding: 20px 22px;
	pointer-events: auto !important;
}

#hover-card-panel.mobile .hcp-body {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

#hover-card-panel.mobile .hcp-img {
	width: 100%;
	max-width: min(90vw, 420px) !important;
	margin: 0 auto;
}

#hover-card-panel.mobile .hcp-right {
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: 10px;
	align-items: flex-start;
}

#hover-card-panel.mobile .hcp-header {
	flex-wrap: wrap;
	gap: 8px;
	align-items: flex-start;
}

#hover-card-panel.mobile .hcp-role {
	font-size: 12px;
	letter-spacing: 0.55px;
}

#hover-card-panel.mobile .hcp-meta {
	font-size: 13px;
	text-align: left;
}

#hover-card-panel.mobile .hcp-overlaps {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	width: 100%;
}

#hover-card-panel.mobile .hcp-overlaps .hcp-ov-chip {
	margin: 0;
}

#hover-card-panel.mobile .hcp-taglist {
	columns: 1;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 4px 0 2px;
	max-height: none;
	overflow: visible;
	padding: 0;
}

#hover-card-panel.mobile .hcp-taglist li {
	background: rgba(37, 99, 235, 0.18);
	border-radius: 9999px;
	padding: 4px 10px;
	display: inline-flex;
	align-items: center;
}

#hover-card-panel.mobile .hcp-taglist li.overlap {
	background: rgba(37, 99, 235, 0.28);
	color: #dbeafe;
}

#hover-card-panel.mobile .hcp-taglist li.overlap::before {
	display: none;
}

#hover-card-panel.mobile .hcp-reasons {
	max-height: 220px;
	width: 100%;
}

#hover-card-panel.mobile .hcp-tags {
	word-break: normal;
	white-space: normal;
	text-align: left;
	width: 100%;
	font-size: 12px;
	opacity: 0.7;
}

#hover-card-panel .hcp-close {
	appearance: none;
	border: none;
	background: transparent;
	color: #9ca3af;
	font-size: 18px;
	line-height: 1;
	padding: 2px 4px;
	cursor: pointer;
	border-radius: 6px;
	display: none;
}

#hover-card-panel .hcp-close:focus {
	outline: 2px solid rgba(59, 130, 246, 0.6);
	outline-offset: 2px;
}

#hover-card-panel.mobile .hcp-close {
	display: inline-flex;
}

/* Fade transition for hover panel image */
#hover-card-panel .hcp-img {
	transition: opacity 0.22s ease;
}

/* =============================================================================
   DOUBLE-FACED CARD TOGGLE (Moved from base.html 2025-10-21)
   ============================================================================= */

/* Hide modal-specific close button outside modal host */
#preview-close-btn {
	display: none;
}

#theme-preview-modal #preview-close-btn {
	display: inline-flex;
}

/* Overlay flip toggle for double-faced cards */
.dfc-host {
	position: relative;
}

.dfc-toggle {
	position: absolute;
	top: 6px;
	left: 6px;
	z-index: 5;
	background: rgba(15, 23, 42, 0.82);
	color: #fff;
	border: 1px solid #475569;
	border-radius: 50%;
	width: 36px;
	height: 36px;
	padding: 0;
	font-size: 16px;
	cursor: pointer;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0.92;
	backdrop-filter: blur(3px);
}

.dfc-toggle:hover,
.dfc-toggle:focus {
	opacity: 1;
	box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.35);
	outline: none;
}

.dfc-toggle:active {
	transform: translateY(1px);
}

.dfc-toggle .icon {
	font-size: 12px;
}

.dfc-toggle[data-face='back'] {
	background: rgba(76, 29, 149, 0.85);
}

.dfc-toggle[data-face='front'] {
	background: rgba(15, 23, 42, 0.82);
}

.dfc-toggle[aria-pressed='true'] {
	box-shadow: 0 0 0 2px var(--accent, #38bdf8);
}

.list-row .dfc-toggle {
	position: static;
	width: auto;
	height: auto;
	border-radius: 6px;
	padding: 2px 8px;
	font-size: 12px;
	opacity: 1;
	backdrop-filter: none;
	margin-left: 4px;
}

.list-row .dfc-toggle .icon {
	font-size: 12px;
}

.list-row .dfc-toggle[data-face='back'] {
	background: rgba(76, 29, 149, 0.3);
}

.list-row .dfc-toggle[data-face='front'] {
	background: rgba(56, 189, 248, 0.2);
}

/* Mobile visibility handled via Tailwind responsive classes in JavaScript (hidden md:flex) */

/* =============================================================================
   SITE FOOTER (Moved from base.html 2025-10-21)
   ============================================================================= */

.site-footer {
	margin: 8px 16px;
	padding: 8px 12px;
	border-top: 1px solid var(--border);
	color: #94a3b8;
	font-size: 12px;
	text-align: center;
}

.site-footer a {
	color: #cbd5e1;
	text-decoration: underline;
}

/* =============================================================================
   THEME PREVIEW FRAGMENT (themes/preview_fragment.html)
   ============================================================================= */

/* Preview header */
.preview-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
}

.preview-header h3 {
	margin: 0;
	font-size: 16px;
}

.preview-header .btn {
	font-size: 12px;
	line-height: 1;
}

/* Preview controls */
.preview-controls {
	display: flex;
	gap: 1rem;
	align-items: center;
	margin: 0.5rem 0 0.75rem;
	font-size: 11px;
}

.preview-controls label {
	display: inline-flex;
	gap: 4px;
	align-items: center;
}

.preview-controls .help-icon {
	opacity: 0.55;
	font-size: 10px;
	cursor: help;
}

.preview-controls #preview-status {
	opacity: 0.65;
}

/* Preview rationale */
.preview-rationale {
	margin: 0.25rem 0 0.85rem;
	font-size: 11px;
	background: var(--panel-alt);
	border: 1px solid var(--border);
	padding: 0.55rem 0.7rem;
	border-radius: 8px;
}

.preview-rationale summary {
	cursor: pointer;
	font-weight: 600;
	letter-spacing: 0.05em;
}

.preview-rationale-controls {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	align-items: center;
	margin-top: 0.4rem;
}

.preview-rationale-controls .btn {
	font-size: 10px;
	padding: 4px 8px;
}

.preview-rationale-controls #hover-compact-indicator {
	font-size: 10px;
	opacity: 0.7;
}

.preview-rationale ul {
	margin: 0.5rem 0 0 0.9rem;
	padding: 0;
	list-style: disc;
	line-height: 1.35;
}

.preview-rationale li .detail {
	opacity: 0.75;
}

.preview-rationale li .instances {
	opacity: 0.65;
}

/* Two column layout */
.preview-two-col {
	display: grid;
	grid-template-columns: 1fr 480px;
	gap: 1.25rem;
	align-items: start;
	position: relative;
}

.preview-col-divider {
	position: absolute;
	top: 0;
	bottom: 0;
	left: calc(100% - 480px - 0.75rem);
	width: 1px;
	background: var(--border);
	opacity: 0.55;
}

/* Section headers */
.preview-section-header {
	margin: 0.25rem 0 0.5rem;
	font-size: 13px;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	opacity: 0.8;
}

.preview-section-hr {
	border: 0;
	border-top: 1px solid var(--border);
	margin: 0.35rem 0 0.6rem;
}

/* Cards flow layout */
.cards-flow {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

/* Group separators */
.group-separator {
	flex-basis: 100%;
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	opacity: 0.65;
	margin-top: 0.25rem;
}

.group-separator.mt-larger {
	margin-top: 0.5rem;
}

/* Card sample */
.card-sample {
	width: 230px;
}

.card-sample .thumb-wrap {
	position: relative;
}

.card-sample img.card-thumb {
	filter: blur(4px);
	transition: filter 0.35s ease;
	background: linear-gradient(145deg, #0b0d12, #111b29);
}

.card-sample img.card-thumb[data-loaded] {
	filter: blur(0);
}

/* Card badges */
.dup-badge {
	position: absolute;
	bottom: 4px;
	right: 4px;
	background: #4b5563;
	color: #fff;
	font-size: 10px;
	padding: 2px 5px;
	border-radius: 10px;
}

/* Contextual help tooltips — shared fixed panel avoids overflow clipping */
.help-tip {
	position: relative;
	display: inline-flex;
	align-items: center;
	vertical-align: middle;
}
.help-tip-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 14px;
	height: 14px;
	color: var(--text-muted);
	background: none;
	border: 1px solid var(--border);
	border-radius: 50%;
	cursor: pointer;
	padding: 0;
	flex-shrink: 0;
	transition: color 0.15s, border-color 0.15s;
}
.help-tip-btn:hover {
	color: var(--primary);
	border-color: var(--primary);
}
.help-tip-btn:focus-visible {
	outline: 2px solid var(--primary);
	outline-offset: 2px;
}
.help-tip-panel {
	position: fixed;
	display: none;
	background: var(--panel);
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 8px 10px;
	font-size: 12px;
	line-height: 1.45;
	width: 200px;
	box-shadow: 0 4px 14px rgba(0,0,0,.35);
	z-index: 9999;
	white-space: normal;
	text-align: left;
	font-weight: normal;
}
.help-tip-panel a {
	color: var(--primary);
	font-size: 11px;
	text-decoration: none;
	display: block;
	margin-top: 5px;
}
.help-tip-panel a:hover {
	text-decoration: underline;
}

.pin-btn {
	position: absolute;
	top: 4px;
	right: 4px;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	border: 1px solid var(--border);
	border-radius: 6px;
	font-size: 10px;
	padding: 2px 5px;
	cursor: pointer;
}

/* Card metadata */
.card-sample .meta {
	font-size: 12px;
	margin-top: 2px;
}

.card-sample .ci-ribbon {
	display: flex;
	gap: 2px;
	margin-bottom: 2px;
	min-height: 10px;
}

.card-sample .nm {
	font-weight: 600;
	line-height: 1.25;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.card-sample .mana-line {
	min-height: 14px;
	display: flex;
	flex-wrap: wrap;
	gap: 2px;
	font-size: 10px;
}

.card-sample .rarity-badge {
	font-size: 9px;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	opacity: 0.7;
}

.card-sample .role {
	opacity: 0.75;
	font-size: 11px;
	display: flex;
	flex-wrap: wrap;
	gap: 3px;
}

.card-sample .reasons {
	font-size: 9px;
	opacity: 0.55;
	line-height: 1.15;
}

/* Synthetic card */
.card-sample.synthetic {
	border: 1px dashed var(--border);
	padding: 8px;
	border-radius: 10px;
	background: var(--panel-alt);
}

.card-sample.synthetic .name {
	font-size: 12px;
	font-weight: 600;
	line-height: 1.2;
}

.card-sample.synthetic .roles {
	font-size: 11px;
	opacity: 0.8;
}

.card-sample.synthetic .reasons-text {
	font-size: 10px;
	margin-top: 2px;
	opacity: 0.6;
	line-height: 1.15;
}

/* Spacer */
.full-width-spacer {
	flex-basis: 100%;
	height: 0;
}

/* Commander grid */
.commander-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
	gap: 1rem;
}

.commander-cell {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	align-items: center;
}

.commander-name {
	font-size: 13px;
	text-align: center;
	line-height: 1.35;
	font-weight: 600;
	max-width: 230px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.commander-cell.synergy .commander-name {
	font-size: 12px;
	line-height: 1.3;
	font-weight: 500;
	opacity: 0.92;
}

/* Synergy commanders section */
.synergy-commanders-section {
	margin-top: 1rem;
}

.synergy-commanders-header {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	margin-bottom: 0.4rem;
}

.synergy-commanders-header h5 {
	margin: 0;
	font-size: 11px;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	opacity: 0.75;
}

.derived-badge {
	background: var(--panel-alt);
	border: 1px solid var(--border);
	border-radius: 10px;
	padding: 2px 6px;
	font-size: 10px;
	line-height: 1;
}

/* No commanders message */
.no-commanders-message {
	font-size: 11px;
	opacity: 0.7;
}

/* Footer help text */
.preview-help-text {
	margin-top: 1rem;
	font-size: 10px;
	opacity: 0.65;
	line-height: 1.4;
}

/* Skeleton loader */
.preview-skeleton .sk-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.preview-skeleton .sk-bar {
	height: 16px;
	background: var(--hover);
	border-radius: 4px;
}

.preview-skeleton .sk-bar.title {
	width: 200px;
}

.preview-skeleton .sk-bar.close {
	width: 60px;
}

.preview-skeleton .sk-cards {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 1rem;
}

.preview-skeleton .sk-card {
	width: 230px;
	height: 327px;
	background: var(--hover);
	border-radius: 10px;
}

/* Responsive */
@media (max-width: 950px) {
	.preview-two-col {
		grid-template-columns: 1fr;
	}
	
	.preview-two-col .col-right {
		order: -1;
	}
}

footer.site-footer {
	flex-shrink: 0;
}

/* ============================================================
   Budget Mode — Badge, Tier Labels, Price Tooltip
   ============================================================ */

.budget-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .75rem;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 600;
  border: 1.5px solid currentColor;
}

.budget-badge--under {
  color: var(--ok, #16a34a);
  background: color-mix(in srgb, var(--ok, #16a34a) 12%, var(--panel, #1a1b1e) 88%);
}

.budget-badge--soft_exceeded {
  color: var(--warn, #f59e0b);
  background: color-mix(in srgb, var(--warn, #f59e0b) 12%, var(--panel, #1a1b1e) 88%);
}

.budget-badge--hard_exceeded {
  color: var(--err, #ef4444);
  background: color-mix(in srgb, var(--err, #ef4444) 12%, var(--panel, #1a1b1e) 88%);
}

/* Tier badges on the pickups table */
.tier-badge {
  display: inline-block;
  padding: .1rem .5rem;
  border-radius: 4px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  background: var(--panel, #1a1b1e);
  border: 1px solid var(--border, #333);
}

.tier-badge--s {
  color: var(--ok, #16a34a);
  border-color: var(--ok, #16a34a);
}

.tier-badge--m {
  color: var(--warn, #f59e0b);
  border-color: var(--warn, #f59e0b);
}

.tier-badge--l {
  color: var(--muted, #b6b8bd);
}

.owned-badge {
  display: inline-block;
  padding: .1rem .45rem;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--ok, #16a34a);
  border: 1px solid var(--ok, #16a34a);
  background: transparent;
}

/* Dual-price source labels (TCG / CK) */
.price-src-label {
  font-size: .65rem;
  font-weight: 600;
  opacity: .65;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.price-sep {
  opacity: .4;
}

.alt-prices {
  font-size: 11px;
  opacity: .7;
  font-weight: normal;
}

/* Price source legend (TCG = TCGPlayer · CK = Card Kingdom) */
.price-legend {
  font-size: .7rem;
  opacity: .55;
  letter-spacing: .02em;
}

/* Inline price tooltip on card names */
.card-name-price-hover {
  cursor: default;
  position: relative;
}

.card-price-tip {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface, #0f1115);
  border: 1px solid var(--border, #333);
  border-radius: 6px;
  padding: .25rem .6rem;
  font-size: .78rem;
  white-space: nowrap;
  z-index: 9000;
  pointer-events: none;
  color: var(--text, #e5e7eb);
  box-shadow: 0 4px 12px rgba(0,0,0,.4);
}

/* Price overlay on card thumbnails (step5 tiles + deck summary thumbs) */
.card-price-overlay {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, .72);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  pointer-events: none;
  z-index: 3;
  white-space: nowrap;
  line-height: 16px;
}
.card-price-overlay:empty { display: none; }

/* Inline price in deck summary list rows */
.card-price-inline {
  font-size: 11px;
  color: var(--muted, #94a3b8);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding: 0 2px;
}
.card-price-inline:empty { color: transparent; }

/* Over-budget highlight — gold/amber, matching the locked card style */
.card-tile.over-budget {
  border-color: #f5c518 !important;
  box-shadow: inset 0 0 8px rgba(245, 197, 24, .25), 0 0 5px #f5c518 !important;
}
.stack-card.over-budget {
  border-color: #f5c518 !important;
  box-shadow: 0 6px 18px rgba(0,0,0,.55), 0 0 7px #f5c518 !important;
}
.list-row.over-budget .name {
  background: rgba(245, 197, 24, .12);
  box-shadow: 0 0 0 1px #f5c518;
  border-radius: 4px;
}

/* Budget price summary bar in deck summary */
.budget-price-bar {
  font-size: 13px;
  padding: .3rem .5rem;
  border-radius: 6px;
  margin: .4rem 0 .6rem 0;
  border: 1px solid var(--border, #333);
  background: var(--panel, #1a1f2e);
}
.budget-price-bar.under { border-color: #34d399; color: #a7f3d0; }
.budget-price-bar.over  { border-color: #f5c518; color: #fde68a; }

/* Budget review panel */
.budget-review-panel {
  border: 1px solid var(--border, #444);
  border-left: 4px solid #f5c518;
  border-radius: 6px;
  background: var(--panel, #1a1f2e);
  padding: .75rem 1rem;
}
.budget-review-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin-bottom: .5rem;
}
.budget-review-summary { flex: 1 1 auto; }
.budget-review-cards { display: flex; flex-direction: column; gap: .5rem; margin-top: .5rem; }
.budget-review-card-row {
  border: 1px solid var(--border, #333);
  border-radius: 4px;
  padding: .4rem .6rem;
  background: var(--bg, #141824);
}
.budget-review-card-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  margin-bottom: .25rem;
}
.budget-review-card-name { font-weight: 600; }
.budget-review-card-price { color: #f5c518; }
.budget-review-alts { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.btn-alt-swap {
  font-size: .8rem;
  padding: .2rem .5rem;
  border: 1px solid var(--border, #555);
  border-radius: 4px;
  background: var(--panel, #1a1f2e);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}
.btn-alt-swap:hover { background: var(--hover, #252d3d); }
.alt-price { color: #34d399; font-size: .75rem; }
.budget-review-no-alts { font-size: .8rem; }
.budget-review-subtitle { font-size: .85rem; margin-bottom: .5rem; }
.budget-review-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip-red { background: rgba(239,68,68,.15); color: #fca5a5; border-color: #ef4444; }
.chip-green { background: rgba(34,197,94,.15); color: #86efac; border-color: #22c55e; }
.chip-subtle { background: rgba(148,163,184,.08); color: var(--muted, #94a3b8); border-color: rgba(148,163,184,.2); font-size: .7rem; padding: 1px 6px; }

/* Price category stacked bar */
.price-cat-section { margin: .6rem 0 .2rem 0; }
.price-cat-heading { font-size: 12px; color: var(--muted, #94a3b8); margin-bottom: .3rem; font-weight: 600; }
.price-cat-bar {
  display: flex;
  height: 18px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border, #333);
  background: var(--panel, #1a1f2e);
}
.price-cat-seg {
  height: 100%;
  transition: opacity .15s;
  position: relative;
}
.price-cat-seg:hover { opacity: .75; cursor: default; }
.price-cat-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .15rem .6rem;
  margin-top: .3rem;
  font-size: 11px;
  color: var(--muted, #94a3b8);
}
.price-cat-legend-item { display: flex; align-items: center; gap: .3rem; }
.price-cat-swatch { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }

/* Price histogram bars */
.price-hist-section { margin: .75rem 0 .2rem 0; }
.price-hist-heading { font-size: 12px; color: var(--muted, #94a3b8); margin-bottom: .3rem; font-weight: 600; }
.price-hist-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 80px;
  margin-bottom: 0;
}
.price-hist-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  cursor: pointer;
  transition: opacity .15s;
}
.price-hist-column:hover { opacity: .8; }
.price-hist-bar {
  width: 100%;
  border-radius: 3px 3px 0 0;
  min-height: 2px;
}
.price-hist-xlabels {
  display: flex;
  gap: 3px;
  margin-top: 2px;
  margin-bottom: .25rem;
}
.price-hist-xlabel {
  flex: 1;
  font-size: 10px;
  color: var(--muted, #94a3b8);
  text-align: center;
  overflow-wrap: anywhere;
  word-break: break-all;
  line-height: 1.2;
}
.price-hist-count { font-size: 11px; color: var(--muted, #94a3b8); margin-top: .1rem; }

/* Stale price indicators */
.stale-price-indicator { position: absolute; top: 4px; right: 4px; font-size: 10px; color: #f59e0b; cursor: default; pointer-events: auto; z-index: 2; }
.stale-price-badge { font-size: 10px; color: #f59e0b; margin-left: 2px; vertical-align: middle; cursor: default; }
.stale-banner { background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.35); border-radius: 6px; padding: .4rem .75rem; font-size: 12px; color: #f59e0b; margin-bottom: .6rem; }

/* Running budget chip */
.running-budget-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 600;
  border: 1px solid var(--border, #444);
  background: var(--panel, #1a1f2e);
  color: var(--text, #e5e7eb);
  white-space: nowrap;
}

/* Pickups table */
.pickups-table th,
.pickups-table td {
  font-size: .92rem;
}

/* Shopping cart toolbar — pickups page */
.cart-toolbar {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
  padding: .45rem .6rem;
  background: var(--panel, #1a1f2e);
  border: 1px solid var(--border, #333);
  border-radius: 6px;
}
.cart-toolbar .cart-label {
  font-size: .82rem;
  color: var(--muted, #94a3b8);
  white-space: nowrap;
}
.cart-copy-feedback {
  font-size: .8rem;
  font-weight: 600;
  color: #34d399;
  margin-left: .25rem;
}
.cart-copy-feedback.error { color: #f87171; }
.cart-fallback-wrap {
  margin-top: .6rem;
  padding: .5rem .6rem;
  background: var(--panel, #1a1f2e);
  border: 1px solid var(--border, #333);
  border-radius: 6px;
}
.cart-fallback-wrap p {
  font-size: .8rem;
  color: var(--muted, #94a3b8);
  margin: 0 0 .4rem 0;
}
.cart-fallback-textarea {
  width: 100%;
  min-height: 110px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: .8rem;
  padding: .4rem .5rem;
  background: var(--bg, #0f172a);
  color: var(--text, #e5e7eb);
  border: 1px solid var(--border, #333);
  border-radius: 4px;
  resize: vertical;
  box-sizing: border-box;
}
.cart-cb-th {
  width: 2.2rem;
  text-align: center;
  padding: .4rem .25rem;
  border-bottom: 1px solid var(--border, #333);
}
.cart-cb-td {
  text-align: center;
  padding: .35rem .25rem;
  border-bottom: 1px solid var(--border-subtle, #222);
}

/* Top-center toast for buy/cart copy confirmation */
.cart-toast-top {
  position: fixed;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel, #1a1f2e);
  color: var(--text, #e5e7eb);
  border: 1px solid #34d399;
  border-radius: 10px;
  padding: .6rem 1.4rem;
  font-size: 1rem;
  font-weight: 600;
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
  z-index: 10000;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.cart-toast-top.hide { opacity: 0; transform: translateX(-50%) translateY(-6px); }


