/* ===== Dashboard + "create a store" ===== */
.dash-section {
	min-height: calc(100vh - var(--nav-h, 68px));
	padding: 40px 0 80px;
	background:
		radial-gradient(50rem 30rem at 100% -10%, rgba(168, 85, 247, .08), transparent 60%),
		var(--surface);
}

.dash-avatar {
	width: 54px; height: 54px;
	border-radius: 50%;
	background: var(--gradient);
	color: #fff;
	display: flex; align-items: center; justify-content: center;
	font-size: 1.4rem;
	flex-shrink: 0;
}

/* --- store cards --- */
.site-card {
	height: 100%;
	background: var(--card);
	border: 1px solid var(--surface-border);
	border-radius: var(--radius, 18px);
	overflow: hidden;
	transition: transform .2s ease, box-shadow .2s ease;
}
.site-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.site-card.is-loading { min-height: 236px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border: 0; }
@keyframes shimmer { to { background-position: -200% 0; } }

.site-cover {
	position: relative;
	height: 110px;
	display: flex; align-items: center; justify-content: center;
	background: var(--gradient);
	color: #fff;
	overflow: hidden;
}
.site-cover::before {
	content: "";
	position: absolute;
	width: 180px; height: 180px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .14);
	top: -90px; inset-inline-start: -40px;
}
.site-cover > i { font-size: 2.6rem; position: relative; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .18)); }
.site-cat {
	position: absolute;
	bottom: 10px; inset-inline-end: 10px;
	background: rgba(255, 255, 255, .22);
	backdrop-filter: blur(6px);
	padding: 2px 10px;
	border-radius: 999px;
	font-size: .75rem;
	font-weight: 700;
}
.site-body { padding: 18px 20px 20px; }
.site-host {
	display: inline-flex; align-items: center; gap: 6px;
	max-width: 100%;
	color: var(--primary-ink);
	background: var(--primary-soft);
	border-radius: 999px;
	padding: 4px 12px;
	font-size: .84rem;
	font-weight: 600;
	text-decoration: none;
	word-break: break-all;
}
.site-host:hover { background: var(--primary-soft); color: var(--primary-ink); }
.site-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }

.empty-state {
	background: var(--card);
	border: 1px dashed var(--surface-border);
	border-radius: var(--radius, 18px);
}
.empty-icon {
	width: 88px; height: 88px;
	margin: 0 auto;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--primary-soft), var(--primary-soft));
	color: var(--primary);
	display: flex; align-items: center; justify-content: center;
	font-size: 2.4rem;
}

/* --- create a store --- */
.back-link { display: inline-flex; align-items: center; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .92rem; margin-bottom: 18px; }
.back-link:hover { color: var(--primary-ink); }
.new-head { margin-bottom: 28px; }
.new-head h1 { font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2.2rem); margin-bottom: 6px; }

.new-card {
	background: var(--card);
	border: 1px solid var(--surface-border);
	border-radius: 22px;
	padding: 24px;
}
.new-label { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.05rem; margin-bottom: 12px; }
.new-step {
	width: 28px; height: 28px;
	border-radius: 50%;
	display: inline-flex; align-items: center; justify-content: center;
	background: var(--gradient);
	color: #fff;
	font-size: .85rem;
}
.new-card .form-control-lg { border-radius: 14px; font-weight: 600; }
.new-card .form-control:focus { border-color: var(--primary-light); box-shadow: 0 0 0 4px rgba(108, 71, 255, .12); }

/* Category tiles: an illustrated cover (gradient + icon) and a caption. */
.cat-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
	gap: 14px;
}
.cat-tile {
	--from: #a78bfa;
	--to: #6c47ff;
	position: relative;
	display: flex;
	flex-direction: column;
	background: var(--card);
	border: 2px solid var(--surface-border);
	border-radius: 18px;
	overflow: hidden;
	cursor: pointer;
	transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.cat-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.cat-tile.is-selected { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(108, 71, 255, .15), var(--shadow); }
.cat-tile:focus-within { outline: 3px solid rgba(108, 71, 255, .35); outline-offset: 2px; }
.cat-tile.is-loading { min-height: 168px; cursor: default; border: 0; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }

.cat-art {
	position: relative;
	height: 96px;
	display: flex; align-items: center; justify-content: center;
	background: linear-gradient(135deg, var(--from), var(--to));
	color: #fff;
	overflow: hidden;
}
.cat-art::before,
.cat-art::after {
	content: "";
	position: absolute;
	border-radius: 50%;
	background: rgba(255, 255, 255, .16);
}
.cat-art::before { width: 120px; height: 120px; top: -60px; inset-inline-start: -30px; }
.cat-art::after { width: 70px; height: 70px; bottom: -34px; inset-inline-end: -14px; background: rgba(255, 255, 255, .12); }
.cat-art i {
	position: relative;
	z-index: 1;
	font-size: 2.4rem;
	filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .2));
	transition: transform .25s ease;
}
.cat-tile:hover .cat-art i,
.cat-tile.is-selected .cat-art i { transform: scale(1.12) rotate(-6deg); }

.cat-text { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; }
.cat-text strong { font-size: .92rem; line-height: 1.5; }
.cat-text small { color: var(--muted); font-size: .76rem; line-height: 1.6; }

.cat-check {
	position: absolute;
	top: 8px; inset-inline-end: 8px;
	z-index: 2;
	width: 26px; height: 26px;
	border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	background: var(--card);
	color: var(--primary);
	font-size: .95rem;
	box-shadow: 0 4px 10px rgba(0, 0, 0, .15);
	opacity: 0;
	transform: scale(.6);
	transition: opacity .18s ease, transform .18s ease;
}
.cat-tile.is-selected .cat-check { opacity: 1; transform: none; }
.cat-error { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--danger); }

/* Live preview */
.new-side { position: sticky; top: calc(var(--nav-h, 68px) + 20px); }
.preview-card {
	background: var(--card);
	border: 1px solid var(--surface-border);
	border-radius: 22px;
	overflow: hidden;
	box-shadow: var(--shadow);
}
.preview-cover {
	height: 120px;
	display: flex; align-items: center; justify-content: center;
	background: linear-gradient(135deg, var(--surface-2), var(--surface-2));
	color: #fff;
	transition: background .3s ease;
}
.preview-cover i { font-size: 2.8rem; color: inherit; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .15)); }
.preview-cover:not([style*="gradient"]) i { color: var(--muted-2); filter: none; }
.preview-body { padding: 16px 18px 20px; }
.preview-bar { display: flex; gap: 6px; margin-bottom: 14px; }
.preview-bar span { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-border); }
.preview-title { font-weight: 900; font-size: 1.2rem; word-break: break-word; }
.preview-title.is-empty { color: var(--muted-2); }
.preview-cat { color: var(--muted); font-size: .85rem; margin-top: 2px; }
/* Mock product cards: picture, name line, price line */
.preview-label { font-size: .75rem; color: var(--muted); margin-top: 16px; margin-bottom: 6px; }
.preview-products { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.preview-products .pp { display: flex; flex-direction: column; gap: 5px; padding: 6px; border-radius: 10px; background: var(--surface); border: 1px solid var(--surface-border); }
.preview-products .pp i { display: flex; align-items: center; justify-content: center; height: 40px; border-radius: 7px; background: var(--surface-2); color: var(--muted-2); font-size: 1rem; }
.preview-products .pp b { display: block; height: 6px; width: 85%; border-radius: 3px; background: var(--surface-border); }
.preview-products .pp s { display: block; height: 6px; width: 45%; border-radius: 3px; background: var(--primary-light); opacity: .55; }
@media (max-width: 991.98px) { .new-side { position: static; } }
@media (max-width: 575.98px) {
	.cat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
	.new-card { padding: 18px; }
}

/* --- profile card (name + email) --- */
.profile-card {
	background: var(--card);
	border: 1px solid var(--surface-border);
	border-radius: 20px;
	padding: 22px 24px;
	margin-bottom: 28px;
	box-shadow: var(--shadow-sm);
	border-inline-start: 4px solid var(--primary);
}
.profile-card-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.profile-card-icon {
	width: 44px; height: 44px;
	flex-shrink: 0;
	border-radius: 13px;
	display: flex; align-items: center; justify-content: center;
	background: var(--primary-soft);
	color: var(--primary-ink);
	font-size: 1.25rem;
}
.profile-card .form-control:focus { border-color: var(--primary-light); box-shadow: 0 0 0 4px rgba(108, 71, 255, .12); }
/* Real example products once a category is chosen */
.preview-products .pp.has-photo { gap: 3px; padding: 5px; }
.preview-products .pp img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 7px; display: block; background: var(--surface-2); }
.preview-products .pp-name { font-size: .68rem; font-weight: 700; line-height: 1.5; color: var(--body-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-products .pp-price { font-size: .66rem; font-weight: 800; color: var(--primary-ink); white-space: nowrap; }

/* --- store address: https:// [slug] . [domain] --- */
.address-input {
	display: flex;
	align-items: stretch;
	border: 1px solid var(--surface-border);
	border-radius: 14px;
	background: var(--card);
	overflow: hidden;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.address-input:focus-within { border-color: var(--primary-light); box-shadow: 0 0 0 4px rgba(108, 71, 255, .12); }
.address-input.is-ok { border-color: var(--success); }
.address-input.is-bad { border-color: var(--danger); }
.address-scheme, .address-dot { display: flex; align-items: center; padding: 0 2px 0 12px; color: var(--muted); font-weight: 600; font-size: .95rem; }
.address-dot { padding: 0 4px; font-size: 1.2rem; }
.address-input .form-control { border: 0; border-radius: 0; box-shadow: none !important; background: transparent; font-weight: 700; font-size: 1.05rem; min-width: 0; flex: 1 1 auto; padding-left: 2px; }
.address-input .form-select { border: 0; border-left: 1px solid var(--surface-border); border-radius: 0; box-shadow: none !important; background-color: var(--surface); font-weight: 600; flex: 0 0 auto; width: auto; max-width: 52%; }
.address-status { min-height: 1.6em; margin-top: 8px; font-size: .88rem; font-weight: 600; }
.address-status.is-ok { color: var(--success-ink); }
.address-status.is-bad { color: var(--danger); }
.address-status.is-wait { color: var(--muted); }
.preview-url { font-size: .74rem; color: var(--primary-ink); margin-top: 6px; overflow-wrap: anywhere; }
@media (max-width: 575.98px) {
	.address-input { flex-wrap: wrap; }
	.address-scheme { display: none; }
	.address-input .form-control { flex-basis: 60%; padding-left: 12px; }
	.address-input .form-select { max-width: none; flex: 1 0 100%; border-left: 0; border-top: 1px solid var(--surface-border); }
	.address-dot { display: none; }
}

/* --- managing one store (/profile/site) --- */
.manage-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.manage-cover {
	width: 64px; height: 64px; flex-shrink: 0;
	border-radius: 18px;
	background: var(--gradient);
	color: #fff;
	display: flex; align-items: center; justify-content: center;
	font-size: 1.7rem;
}
.min-w-0 { min-width: 0; }
.manage-card {
	background: var(--card);
	border: 1px solid var(--surface-border);
	border-radius: var(--radius, 18px);
	padding: 22px 24px;
}
.manage-title { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; font-weight: 800; margin-bottom: 16px; }
.manage-title i { color: var(--primary); font-size: 1.2rem; }
.manage-dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; margin-bottom: 14px; }
.manage-dl dt { color: var(--muted); font-weight: 600; font-size: .92rem; }
.manage-dl dd { margin: 0; font-weight: 700; }
.state-badge { display: inline-block; padding: 2px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--surface-2); color: var(--text-2); }
.state-badge.is-active, .state-badge.is-ok { background: var(--success-soft, #e6f7f0); color: var(--success-ink, #0f7a54); }
.state-badge.is-wait { background: var(--surface-2); color: var(--muted); }
.state-badge.is-expired, .state-badge.is-cancelled, .state-badge.is-bad { background: rgba(214, 51, 108, .1); color: var(--danger, #d6336c); }
.dns-box { display: grid; gap: 6px; background: var(--surface); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-size: .92rem; }
.dns-box > div { display: grid; grid-template-columns: 60px 1fr; align-items: center; }
.dns-box code { color: var(--primary-ink); font-weight: 700; background: none; }
.domain-list:empty { display: none; }
.domain-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--surface-border); }
.domain-row:last-child { border-bottom: 0; }
.domain-host { font-weight: 700; }
.domain-acts { display: flex; gap: 6px; margin-inline-start: auto; }
.domain-note { flex-basis: 100%; color: var(--muted); font-size: .84rem; }
#manage[data-loading] .manage-card { opacity: .6; }
@media (max-width: 575.98px) {
	.manage-card { padding: 18px 16px; }
	.manage-head .btn { flex: 1 1 auto; }
}

/* ===== AI credit (doc/ai-credit.md) ===== */
.credit-card { margin-top: 32px; padding: 22px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--surface-border); }
.credit-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.credit-head h2 i { color: var(--primary); }
.credit-total { text-align: center; padding: 10px 18px; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--primary-ink); }
.credit-total strong { display: block; font-size: 1.4rem; font-weight: 900; line-height: 1.3; }
.credit-total span { font-size: .8rem; }
.credit-active { margin-top: 16px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--surface-border); }
.credit-active .bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.credit-active .bar > span { display: block; height: 100%; background: var(--gradient); }
.credit-card .table-wrap { margin-top: 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.credit-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.credit-table th, .credit-table td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--surface-border); white-space: nowrap; }
.credit-table thead th { font-size: .82rem; color: var(--muted); font-weight: 700; }
.credit-table tbody tr:last-child td { border-bottom: 0; }
.credit-table tr.is-past td { color: var(--muted); }
.credit-badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 700; background: var(--surface-2); color: var(--text-2); }
.credit-badge.is-active { background: var(--primary-soft); color: var(--primary-ink); }
.credit-badge.is-queued { background: var(--note-bg); color: var(--note-text); }
.credit-buy { margin-top: 22px; padding-top: 20px; border-top: 1px dashed var(--surface-border); }
.buy-plan { height: 100%; display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: var(--radius-sm); border: 1px solid var(--surface-border); background: var(--surface); }
.buy-plan .bp-name { font-weight: 800; }
.buy-plan .bp-tokens { color: var(--primary-ink); font-weight: 800; font-size: 1.1rem; }
.buy-plan .bp-price { font-weight: 700; }
.buy-plan .bp-meta { color: var(--muted); font-size: .85rem; }
.buy-plan .btn { margin-top: auto; }
