/* License Server — shared modern UI (admin + client portal) */

:root {
	--bg: #f4f5fb;
	--surface: #ffffff;
	--text: #1a1d29;
	--text-muted: #6b7089;
	--border: #e4e6f0;
	--primary: #4f46e5;
	--primary-dark: #4338ca;
	--primary-soft: #eef2ff;
	--success: #059669;
	--success-soft: #ecfdf5;
	--danger: #dc2626;
	--danger-soft: #fef2f2;
	--warning: #d97706;
	--warning-soft: #fffbeb;
	--radius: 12px;
	--shadow: 0 1px 3px rgba(23, 25, 45, .06), 0 8px 24px rgba(23, 25, 45, .07);
}

* { box-sizing: border-box; }

body {
	margin: 0;
	font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
	background: var(--bg);
	color: var(--text);
	font-size: 15px;
	line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
	font-family: 'Cascadia Code', Consolas, monospace;
	font-size: .85em;
	background: var(--primary-soft);
	color: var(--primary-dark);
	padding: 2px 7px;
	border-radius: 6px;
	word-break: break-all;
}

/* ---------- top bar ---------- */

.topbar {
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	padding: 0 28px;
	display: flex;
	align-items: center;
	gap: 24px;
	height: 62px;
	position: sticky;
	top: 0;
	z-index: 10;
}

.brand {
	display: flex;
	align-items: center;
	gap: 10px;
	font-weight: 700;
	font-size: 17px;
	color: var(--text);
}

.brand .logo {
	width: 32px;
	height: 32px;
	border-radius: 9px;
	background: linear-gradient(135deg, #6366f1, #8b5cf6);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
}

.topbar .spacer { flex: 1; }
.topbar .user { color: var(--text-muted); font-size: 14px; }

/* ---------- tabs ---------- */

.tabs {
	display: flex;
	gap: 4px;
}

.tabs a {
	padding: 8px 16px;
	border-radius: 9px;
	color: var(--text-muted);
	font-weight: 500;
	font-size: 14px;
}

.tabs a:hover { background: var(--bg); text-decoration: none; }
.tabs a.active { background: var(--primary-soft); color: var(--primary-dark); }

/* ---------- layout ---------- */

.container {
	max-width: 1240px;
	margin: 0 auto;
	padding: 28px 24px 64px;
}

.container.narrow { max-width: 760px; }

.page-title { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.page-sub { color: var(--text-muted); margin: 0 0 24px; font-size: 14px; }

/* ---------- cards ---------- */

.card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	margin-bottom: 24px;
	overflow: hidden;
}

.card-body { padding: 22px 24px; }

.card h2, .card h5 {
	margin: 0 0 14px;
	font-size: 16px;
	font-weight: 600;
}

.hint { color: var(--text-muted); font-size: 13px; margin-top: 10px; }

/* ---------- forms ---------- */

label { font-size: 13px; font-weight: 600; color: var(--text-muted); display: block; margin-bottom: 6px; }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], select, textarea {
	width: 100%;
	padding: 10px 13px;
	border: 1px solid var(--border);
	border-radius: 9px;
	font: inherit;
	font-size: 14px;
	background: var(--surface);
	color: var(--text);
	transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(79, 70, 229, .13);
}

.form-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.form-row > div { flex: 1; min-width: 160px; }
.form-row > .fit { flex: 0 0 auto; }
.field { margin-bottom: 16px; }

/* ---------- buttons ---------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 18px;
	border: none;
	border-radius: 9px;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: transform .1s, box-shadow .15s, background .15s;
	text-decoration: none !important;
}

.btn-primary {
	background: linear-gradient(135deg, var(--primary), #7c3aed);
	color: #fff;
	box-shadow: 0 4px 12px rgba(79, 70, 229, .28);
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(79, 70, 229, .35); }

.btn-danger {
	background: linear-gradient(135deg, #ef4444, #dc2626);
	color: #fff;
	box-shadow: 0 4px 12px rgba(220, 38, 38, .28);
}

.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(220, 38, 38, .35); }

.btn-block { width: 100%; }

.btn-sm { padding: 6px 12px; font-size: 13px; font-weight: 500; border-radius: 7px; }

.btn-outline { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--text-muted); }
.btn-outline-danger { background: var(--surface); border: 1px solid #fca5a5; color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger-soft); }
.btn-outline-success { background: var(--surface); border: 1px solid #86efac; color: var(--success); }
.btn-outline-success:hover { background: var(--success-soft); }

/* ---------- tables ---------- */

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

table { width: 100%; border-collapse: collapse; font-size: 14px; }

th {
	text-align: left;
	padding: 10px 14px;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--text-muted);
	border-bottom: 1px solid var(--border);
	white-space: nowrap;
}

td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbff; }

.empty { text-align: center; color: var(--text-muted); padding: 32px !important; }

/* ---------- badges ---------- */

.badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
}

.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-muted { background: var(--bg); color: var(--text-muted); }
.badge-primary { background: var(--primary-soft); color: var(--primary-dark); }

/* ---------- alerts ---------- */

.alert { padding: 12px 16px; border-radius: 9px; font-size: 14px; margin-bottom: 16px; }
.alert-danger { background: var(--danger-soft); color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: var(--success-soft); color: var(--success); border: 1px solid #a7f3d0; }
.alert-info { background: var(--primary-soft); color: var(--primary-dark); border: 1px solid #c7d2fe; }

/* ---------- auth pages ---------- */

.auth-wrap {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background:
		radial-gradient(1000px 500px at 10% -10%, rgba(99, 102, 241, .18), transparent),
		radial-gradient(800px 400px at 100% 110%, rgba(139, 92, 246, .15), transparent),
		var(--bg);
}

.auth-card {
	width: 100%;
	max-width: 400px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 16px;
	box-shadow: var(--shadow);
	padding: 36px 32px;
}

.auth-card .logo {
	width: 46px;
	height: 46px;
	border-radius: 13px;
	background: linear-gradient(135deg, #6366f1, #8b5cf6);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 22px;
	margin: 0 auto 16px;
}

.auth-card h1 { font-size: 20px; text-align: center; margin: 0 0 4px; }
.auth-card .sub { text-align: center; color: var(--text-muted); font-size: 14px; margin: 0 0 24px; }
.auth-card .alt { text-align: center; font-size: 13px; color: var(--text-muted); margin-top: 20px; }

/* ---------- app catalog / plans ---------- */

.app-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 20px;
}

.app-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 22px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.app-card h3 { margin: 0; font-size: 17px; }
.app-card .desc { color: var(--text-muted); font-size: 14px; flex: 1; }

.price-row { display: flex; gap: 10px; }

.price {
	flex: 1;
	border: 1px solid var(--border);
	border-radius: 10px;
	padding: 10px 12px;
	text-align: center;
}

.price .amount { font-size: 18px; font-weight: 700; }
.price .period { font-size: 12px; color: var(--text-muted); }

.key-reveal {
	background: #0f1222;
	color: #a5b4fc;
	font-family: Consolas, monospace;
	font-size: 16px;
	letter-spacing: .5px;
	text-align: center;
	border-radius: 10px;
	padding: 18px;
	margin: 14px 0;
	user-select: all;
}

/* ---------- profile / settings ---------- */

.profile-head {
	display: flex;
	align-items: center;
	gap: 18px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 24px;
	margin-bottom: 28px;
}

.avatar {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: linear-gradient(135deg, #6366f1, #8b5cf6);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 24px;
	font-weight: 700;
	letter-spacing: .02em;
	flex-shrink: 0;
}

.profile-head .who { flex: 1; min-width: 0; }
.profile-head .who .name { font-size: 19px; font-weight: 700; }
.profile-head .who .mail { color: var(--text-muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; }

.profile-stats { display: flex; gap: 26px; text-align: center; }
.profile-stats .stat .num { font-size: 18px; font-weight: 700; }
.profile-stats .stat .lbl { font-size: 12px; color: var(--text-muted); }

.settings-row {
	display: grid;
	grid-template-columns: 260px 1fr;
	gap: 28px;
	padding: 28px 0;
	border-top: 1px solid var(--border);
}

.settings-row:first-of-type { border-top: none; padding-top: 8px; }
.settings-row .about h3 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.settings-row .about p { margin: 0; color: var(--text-muted); font-size: 13px; line-height: 1.55; }

.field-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

.card-actions {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	padding-top: 6px;
}

.input-group { position: relative; }

.input-group .toggle-pw {
	position: absolute;
	right: 6px;
	top: 50%;
	transform: translateY(-50%);
	border: none;
	background: none;
	cursor: pointer;
	color: var(--text-muted);
	font-size: 12px;
	font-weight: 600;
	padding: 6px 8px;
	border-radius: 6px;
}

.input-group .toggle-pw:hover { background: var(--bg); color: var(--text); }
.input-group input { padding-right: 62px; }

.strength { height: 5px; border-radius: 999px; background: var(--border); margin-top: 8px; overflow: hidden; }
.strength .bar { height: 100%; width: 0; border-radius: 999px; transition: width .25s, background .25s; }
.strength-label { font-size: 12px; color: var(--text-muted); margin-top: 5px; min-height: 16px; }

@media (max-width: 860px) {
	.settings-row { grid-template-columns: 1fr; gap: 12px; }
	.profile-head { flex-wrap: wrap; }
}

/* ---------- table toolbar / copy-to-clipboard ---------- */

.table-toolbar {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 14px;
	flex-wrap: wrap;
}

.table-toolbar input[type=search] { max-width: 320px; }

.table-toolbar .count { font-size: 13px; color: var(--text-muted); white-space: nowrap; }

.copy-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	flex-shrink: 0;
	padding: 0;
	border: 1px solid var(--border);
	background: var(--surface);
	border-radius: 6px;
	cursor: pointer;
	font-size: 13px;
	line-height: 1;
	color: var(--text-muted);
	transition: background .15s, color .15s, border-color .15s;
}

.copy-btn:hover { background: var(--primary-soft); color: var(--primary-dark); border-color: #c7d2fe; }
.copy-btn.copied { background: var(--success-soft); color: var(--success); border-color: #a7f3d0; }

.customer-link {
	cursor: pointer;
	font-weight: 600;
	color: var(--primary-dark);
	border-bottom: 1px dashed #c7d2fe;
}

.customer-link:hover { color: var(--primary); }

/* ---------- modal ---------- */

.modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(15, 18, 34, .5);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	z-index: 100;
}

.modal {
	background: var(--surface);
	border-radius: 14px;
	box-shadow: 0 20px 50px rgba(15, 18, 34, .3);
	width: 100%;
	max-width: 460px;
	max-height: 85vh;
	overflow-y: auto;
}

.modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 22px;
	border-bottom: 1px solid var(--border);
}

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

.modal-close {
	border: none;
	background: none;
	font-size: 22px;
	line-height: 1;
	color: var(--text-muted);
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 6px;
}

.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-body { padding: 8px 22px 20px; }

.detail-list div {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	padding: 11px 0;
	border-bottom: 1px solid var(--border);
}

.detail-list div:last-child { border-bottom: none; }

.detail-list dt {
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--text-muted);
	flex-shrink: 0;
}

.detail-list dd {
	margin: 0;
	font-size: 14px;
	text-align: right;
	word-break: break-all;
	display: flex;
	align-items: center;
	gap: 6px;
}

.modal-actions {
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid var(--border);
}

.modal-actions-title {
	margin: 0 0 14px;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--text-muted);
}

.modal-action-group { margin-bottom: 16px; }
.modal-action-group:last-child { margin-bottom: 0; }

.inline-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.select-sm {
	width: auto;
	padding: 8px 10px;
	font-size: 13px;
}

.confirm-message {
	margin: 0 0 20px;
	font-size: 14px;
	line-height: 1.55;
	color: var(--text);
}

.confirm-actions {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
}

@media (max-width: 720px) {
	.topbar { padding: 0 16px; gap: 12px; overflow-x: auto; }
	.container { padding: 20px 14px 48px; }
}
