/*
 * Tab "License của tôi" + dashboard stats — My Account.
 * Tokens SMT: accent #0f4c81, ink #0f172a, surface #f8fafc.
 * Mobile-first; desktop từ 600px / 768px.
 */

.smt-license-my-account,
.smt-license-dashboard {
	--smt-acc-accent: #0f4c81;
	--smt-acc-ink: #0f172a;
	--smt-acc-muted: #64748b;
	--smt-acc-bg: #f8fafc;
	--smt-acc-card: #ffffff;
	--smt-acc-border: #e2e8f0;
	--smt-acc-focus: #0369a1;
	--smt-acc-domain: #15803d;
	--smt-acc-domain-empty: #c2410c;
	--smt-acc-term-lifetime: #7e22ce;
	--smt-acc-term-2y: #1d4ed8;
	--smt-acc-term-1y: #15803d;
	--smt-acc-term-6m: #0f766e;
	color: var(--smt-acc-ink);
	font-size: 1rem;
	line-height: 1.45;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.smt-license-my-account *,
.smt-license-dashboard *,
.smt-license-my-account *::before,
.smt-license-my-account *::after,
.smt-license-dashboard *::before,
.smt-license-dashboard *::after {
	box-sizing: border-box;
}

/* —— Callout / empty —— */
.smt-license-callout {
	background: #e8f0f8;
	border: 1px solid #c5d8eb;
	border-left: 4px solid var(--smt-acc-accent);
	border-radius: 6px;
	padding: 10px 12px;
	margin: 0 0 12px;
}

.smt-license-callout p {
	margin: 0;
	font-size: 1rem;
	line-height: 1.45;
	color: var(--smt-acc-ink);
}

.smt-license-empty {
	background: var(--smt-acc-bg);
	border: 1px solid var(--smt-acc-border);
	border-radius: 8px;
	padding: 24px 20px;
}

.smt-license-empty__title {
	margin: 0 0 8px;
	font-weight: 600;
	font-size: 1.05rem;
}

.smt-license-empty__hint {
	margin: 0 0 16px;
	color: var(--smt-acc-muted);
	line-height: 1.5;
}

.smt-license-empty__actions {
	margin: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

/* —— Cards (dense, mobile-first) —— */
.smt-license-cards {
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: 100%;
}

.smt-license-card {
	background: var(--smt-acc-card);
	border: 1px solid var(--smt-acc-border);
	border-radius: 6px;
	padding: 0;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
	width: 100%;
	overflow: hidden;
}

.smt-license-card--pending {
	border-color: #d4a017;
	border-left: 3px solid #d4a017;
	box-shadow: 0 0 0 1px rgba(212, 160, 23, 0.12);
}

.smt-license-card--idle {
	border-color: var(--smt-acc-border);
}

/* 1.9.0: danh sách domain + nút tự tháo. */
.smt-license-domains {
	list-style: none;
	margin: 0;
	padding: 0;
}

.smt-license-domains__item {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 10px;
	padding: 4px 0;
}

.smt-license-domains__name {
	font-weight: 600;
	overflow-wrap: anywhere;
}

.smt-license-domains__meta {
	font-size: 0.85em;
	opacity: 0.75;
}

.smt-license-domains__detach {
	margin: 0 0 0 auto;
}

.smt-license-domains__detach .smt-license-btn {
	padding: 2px 10px;
	font-size: 0.85em;
}

/* 1.8.0: license cùng email nhưng chưa gắn tài khoản — chờ xác nhận qua email. */
.smt-license-card--claimable {
	border-color: var(--smt-acc-border);
	border-left: 3px dashed #d4a017;
}

.smt-license-card--revoked {
	border-color: #dc3545;
	opacity: 0.92;
}

.smt-license-card--expired {
	border-color: #dc3545;
}

.smt-license-card--expiring {
	border-color: #d4a017;
}

.smt-license-card--ok {
	border-left: 3px solid #0f4c81;
}

.smt-license-card__alert {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 10px;
	padding: 6px 12px;
	background: #fff8e6;
	border-bottom: 1px solid #f0d78c;
	font-size: 0.9375rem;
	line-height: 1.4;
	color: #7a4d00;
}

.smt-license-card__alert strong {
	font-size: inherit;
	color: #5c3d00;
}

.smt-license-card__head,
.smt-license-card__meta,
.smt-license-card__key,
.smt-license-card__actions {
	padding-left: 12px;
	padding-right: 12px;
}

.smt-license-card__head {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 6px 10px;
	padding-top: 10px;
	margin-bottom: 6px;
}

.smt-license-card__title {
	margin: 0;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.35;
	color: var(--smt-acc-ink);
	word-break: break-word;
	flex: 1 1 10rem;
	min-width: 0;
}

.smt-license-card__badges {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	max-width: 100%;
}

.smt-license-card__badges .smt-license-badge {
	font-size: 0.75rem;
	padding: 2px 8px;
	line-height: 1.35;
}

.smt-license-card__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 16px;
	margin: 0 0 8px;
	padding-bottom: 0;
}

.smt-license-card__meta-row {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 6px;
	margin: 0;
	min-width: 0;
}

.smt-license-card__meta-row dt {
	margin: 0;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--smt-acc-muted);
	white-space: nowrap;
}

.smt-license-card__meta-row dd {
	margin: 0;
	font-size: 1rem;
	line-height: 1.4;
	word-break: break-word;
}

.smt-license-card__domain {
	font-weight: 700;
	color: var(--smt-acc-domain);
}

.smt-license-card__domain-empty {
	font-weight: 700;
	color: var(--smt-acc-domain-empty);
}

.smt-license-card__term {
	font-weight: 700;
}

.smt-license-card__term--lifetime {
	color: var(--smt-acc-term-lifetime);
}

.smt-license-card__term--2y {
	color: var(--smt-acc-term-2y);
}

.smt-license-card__term--1y {
	color: var(--smt-acc-term-1y);
}

.smt-license-card__term--6m {
	color: var(--smt-acc-term-6m);
}

.smt-license-card__term--idle {
	font-weight: 400;
	color: var(--smt-acc-muted);
}

.smt-license-card__muted {
	color: var(--smt-acc-muted);
	font-weight: 400;
}

.smt-license-card__label {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.smt-license-card__key {
	margin-bottom: 0;
	padding-top: 8px;
	padding-bottom: 8px;
	border-top: 1px solid var(--smt-acc-border);
	background: var(--smt-acc-bg);
}

.smt-license-card__key-row {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	width: 100%;
}

.smt-license-card__key-mask {
	display: block;
	flex: 1 1 10rem;
	min-width: 0;
	font-size: 1rem;
	line-height: 1.35;
	background: #fff;
	padding: 8px 10px;
	border-radius: 4px;
	border: 1px solid var(--smt-acc-border);
	word-break: break-all;
	overflow-wrap: anywhere;
}

.smt-license-card__key-row .smt-license-btn {
	flex: 0 0 auto;
	min-height: 40px;
	padding: 6px 12px;
	font-size: 0.9375rem;
}

.smt-license-copy-status {
	display: block;
	min-height: 0;
	margin-top: 0;
	font-size: 0.75rem;
	line-height: 1.3;
	color: #14532d;
}

.smt-license-copy-status:not(:empty) {
	margin-top: 4px;
}

.smt-license-card__actions {
	padding-top: 8px;
	padding-bottom: 10px;
	width: 100%;
}

.smt-license-card__actions:empty {
	display: none;
}

.smt-license-card__footer-hint {
	margin: 0;
	font-size: 0.9375rem;
	line-height: 1.4;
	color: var(--smt-acc-muted);
}

.smt-license-renew {
	display: grid;
	grid-template-columns: 1fr;
	gap: 6px;
	align-items: stretch;
	width: 100%;
}

.smt-license-renew__label {
	font-weight: 600;
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	color: var(--smt-acc-muted);
}

.smt-license-renew__select {
	min-height: 40px;
	padding: 6px 10px;
	border: 1px solid var(--smt-acc-border);
	border-radius: 4px;
	font-size: 1rem;
	background: #fff;
	width: 100%;
	max-width: 100%;
}

.smt-license-renew__select:focus {
	outline: 2px solid var(--smt-acc-focus);
	outline-offset: 2px;
}

.smt-license-renew__hint {
	display: none;
}

.smt-license-renew .smt-license-btn {
	min-height: 40px;
	padding: 6px 14px;
	font-size: 1rem;
}

.smt-license-pending {
	width: 100%;
}

.smt-license-pending p {
	margin: 8px 0 0;
	font-size: 0.9rem;
	color: var(--smt-acc-muted);
}

.smt-license-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	padding: 8px 14px;
	border-radius: 4px;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	border: 1px solid transparent;
	transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
	-webkit-tap-highlight-color: transparent;
}

.smt-license-btn--primary {
	background: var(--smt-acc-accent);
	color: #fff;
	border-color: var(--smt-acc-accent);
}

.smt-license-btn--primary:hover,
.smt-license-btn--primary:focus {
	background: #0c3d68;
	color: #fff;
}

.smt-license-btn--secondary {
	background: #fff;
	color: var(--smt-acc-accent);
	border-color: var(--smt-acc-border);
}

.smt-license-btn--secondary:hover,
.smt-license-btn--secondary:focus {
	border-color: var(--smt-acc-accent);
	color: var(--smt-acc-accent);
}

.smt-license-btn--ghost {
	background: transparent;
	color: var(--smt-acc-muted);
	border-color: transparent;
	text-decoration: underline;
}

.smt-license-btn:focus-visible {
	outline: 2px solid var(--smt-acc-focus);
	outline-offset: 2px;
}

/* —— Dashboard stats —— */
.smt-license-dashboard {
	margin: 28px 0 8px;
	padding: 20px 16px;
	background: var(--smt-acc-bg);
	border: 1px solid var(--smt-acc-border);
	border-radius: 8px;
}

.smt-license-dashboard__head {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 12px;
	margin-bottom: 16px;
}

.smt-license-dashboard__title {
	margin: 0;
	font-size: 1.15rem;
	font-weight: 600;
	color: var(--smt-acc-ink);
}

.smt-license-dashboard__manage {
	width: 100%;
}

.smt-license-dashboard__empty {
	margin: 0;
	color: var(--smt-acc-muted);
	line-height: 1.5;
}

.smt-license-dashboard__table-wrap {
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.smt-license-dashboard__table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.95rem;
}

.smt-license-dashboard__table th,
.smt-license-dashboard__table td {
	padding: 10px 12px;
	text-align: left;
	border-bottom: 1px solid var(--smt-acc-border);
	vertical-align: middle;
}

.smt-license-dashboard__table th {
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	color: var(--smt-acc-muted);
	font-weight: 600;
	white-space: nowrap;
}

.smt-license-dashboard__table tbody tr:last-child td {
	border-bottom: none;
}

/* Mobile: stack table rows as cards */
@media (max-width: 599px) {
	.smt-license-dashboard__table thead {
		display: none;
	}

	.smt-license-dashboard__table,
	.smt-license-dashboard__table tbody,
	.smt-license-dashboard__table tr,
	.smt-license-dashboard__table td {
		display: block;
		width: 100%;
	}

	.smt-license-dashboard__table tr {
		background: var(--smt-acc-card);
		border: 1px solid var(--smt-acc-border);
		border-radius: 6px;
		padding: 12px;
		margin-bottom: 12px;
	}

	.smt-license-dashboard__table td {
		border: none;
		padding: 6px 0;
		display: flex;
		flex-wrap: wrap;
		gap: 6px 10px;
		align-items: center;
	}

	.smt-license-dashboard__table td::before {
		content: attr(data-title);
		font-size: 0.7rem;
		font-weight: 600;
		text-transform: uppercase;
		letter-spacing: 0.02em;
		color: var(--smt-acc-muted);
		min-width: 5.5rem;
	}
}

/* —— Tablet+ : denser renew row —— */
@media (min-width: 600px) {
	.smt-license-my-account {
		max-width: 720px;
	}

	.smt-license-cards {
		gap: 8px;
	}

	.smt-license-card__alert {
		padding: 5px 14px;
	}

	.smt-license-card__head,
	.smt-license-card__meta,
	.smt-license-card__key,
	.smt-license-card__actions {
		padding-left: 14px;
		padding-right: 14px;
	}

	.smt-license-card__head {
		padding-top: 10px;
		margin-bottom: 4px;
	}

	.smt-license-card__title {
		font-size: 1.0625rem;
	}

	.smt-license-card__meta {
		margin-bottom: 6px;
	}

	.smt-license-card__key {
		padding-top: 6px;
		padding-bottom: 6px;
	}

	.smt-license-card__actions {
		padding-top: 6px;
		padding-bottom: 8px;
	}

	.smt-license-renew {
		grid-template-columns: minmax(0, 1fr) auto;
		grid-template-areas:
			"label label"
			"select submit";
		align-items: center;
		max-width: 100%;
		gap: 4px 8px;
	}

	.smt-license-renew__label {
		grid-area: label;
	}

	.smt-license-renew__select {
		grid-area: select;
		min-height: 36px;
		padding: 4px 8px;
	}

	.smt-license-renew .smt-license-btn {
		grid-area: submit;
		min-height: 36px;
		white-space: nowrap;
	}

	.smt-license-card__key-row .smt-license-btn {
		min-height: 36px;
	}

	.smt-license-dashboard__head {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}

	.smt-license-dashboard__manage {
		width: auto;
	}
}

@media (min-width: 768px) {
	.smt-license-dashboard {
		padding: 22px 20px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.smt-license-btn {
		transition: none;
	}
}
