/* DESSANGE Admin – corporate light theme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
	--bg-page: #f4f6f9;
	--bg-white: #ffffff;
	--bg-muted: #f8fafc;
	--border: #cbd5e1;
	--border-light: #e2e8f0;
	--text: #1e293b;
	--text-muted: #64748b;
	--text-light: #94a3b8;
	--primary: #1e293b;
	--primary-hover: #0f172a;
	--accent: #b8956b;
	--accent-soft: #f5f0e8;
	--info-bg: #eff6ff;
	--info-border: #bfdbfe;
	--shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
	--shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
	--radius: 8px;
	--font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

body {
	margin: 0;
	font-family: var(--font);
	font-size: 14px;
	background: var(--bg-page);
	color: var(--text);
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	-webkit-text-size-adjust: 100%;
}

body.nav-open { overflow: hidden; }

a {
	color: var(--primary);
	text-decoration: none;
	transition: color 0.15s;
}
a:hover { color: var(--accent); }

/* ─── Login ─── */
.login-page {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--bg-page);
	padding: 1.5rem;
}

.login-card {
	background: var(--bg-white);
	width: 100%;
	max-width: 400px;
	padding: 2.5rem 2rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-md);
}

.brand-mark {
	text-align: center;
	margin-bottom: 1.75rem;
	padding-bottom: 1.5rem;
	border-bottom: 1px solid var(--border-light);
}

.brand-mark .logo {
	font-size: 1.35rem;
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--primary);
	margin: 0;
	line-height: 1.2;
}

.brand-mark .tagline {
	font-size: 0.72rem;
	color: var(--text-muted);
	margin-top: 0.35rem;
	font-weight: 500;
	letter-spacing: 0.06em;
}

.login-card .subtitle {
	text-align: center;
	color: var(--text-muted);
	font-size: 0.875rem;
	margin: 0 0 1.5rem;
}

.muted { color: var(--text-muted); font-size: 0.875rem; }

/* ─── Shell ─── */
.admin-shell {
	display: flex;
	min-height: 100vh;
	background: var(--bg-page);
}

.sidebar {
	width: 240px;
	background: var(--bg-white);
	border-right: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	padding: 0;
	flex-shrink: 0;
}

.sidebar .brand-mark {
	text-align: left;
	margin: 0;
	padding: 1.5rem 1.25rem;
	border-bottom: 1px solid var(--border-light);
}

.sidebar .brand-mark .logo {
	font-size: 1.1rem;
	letter-spacing: 0.14em;
}

.sidebar .brand-mark .tagline {
	font-size: 0.68rem;
	color: var(--accent);
}

.sidebar nav {
	flex: 1;
	padding: 0.75rem 0.75rem;
}

.sidebar nav a {
	display: block;
	color: var(--text-muted);
	padding: 0.65rem 0.85rem;
	font-size: 0.875rem;
	font-weight: 500;
	border-radius: 6px;
	margin-bottom: 2px;
	transition: background 0.15s, color 0.15s;
}
.sidebar nav a:hover {
	background: var(--bg-muted);
	color: var(--text);
	text-decoration: none;
}
.sidebar nav a.active {
	background: var(--accent-soft);
	color: var(--primary);
	font-weight: 600;
}

.sidebar-foot {
	margin-top: auto;
	padding: 1rem 1.25rem;
	border-top: 1px solid var(--border-light);
	background: var(--bg-muted);
}

.sidebar-foot .user {
	color: var(--text);
	font-weight: 600;
	font-size: 0.8125rem;
	margin-bottom: 0.25rem;
}

.sidebar-foot a {
	color: var(--text-muted);
	font-size: 0.8125rem;
	font-weight: 500;
}
.sidebar-foot a:hover { color: var(--primary); }

.content {
	flex: 1;
	padding: 1.75rem 2rem;
	min-width: 0;
	background: var(--bg-page);
}

.content-header {
	margin-bottom: 1.5rem;
}

.content h1,
.page-title {
	font-size: 1.5rem;
	font-weight: 600;
	margin: 0;
	color: var(--primary);
	letter-spacing: -0.01em;
}

.page-subtitle {
	margin: 0.25rem 0 0;
	font-size: 0.8125rem;
	color: var(--text-muted);
	font-weight: 400;
}

/* ─── Forms ─── */
label {
	display: block;
	margin: 0 0 0.35rem;
	font-size: 0.8125rem;
	font-weight: 500;
	color: var(--text);
}

input, select, button { font-family: var(--font); font-size: 0.875rem; }

input[type=text], input[type=password], input[type=date], input[type=number], input[type=search], select {
	width: 100%;
	padding: 0.55rem 0.75rem;
	border: 1px solid var(--border);
	border-radius: 6px;
	background: var(--bg-white);
	color: var(--text);
	transition: border-color 0.15s, box-shadow 0.15s;
	font-size: 16px;
	box-sizing: border-box;
	height: 38px;
}
input:focus, select:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(30, 41, 59, 0.1);
}

.login-card form label { margin-top: 1rem; }
.login-card form label:first-of-type { margin-top: 0; }

button, .btn {
	display: inline-block;
	background: var(--primary);
	color: #fff;
	border: 1px solid var(--primary);
	border-radius: 6px;
	padding: 0.55rem 1.125rem;
	cursor: pointer;
	font-weight: 500;
	font-size: 0.875rem;
	transition: background 0.15s, border-color 0.15s;
	min-height: 44px;
	line-height: 1.2;
	-webkit-tap-highlight-color: transparent;
}
button:hover, .btn:hover {
	background: var(--primary-hover);
	border-color: var(--primary-hover);
	color: #fff;
	text-decoration: none;
}

button:disabled, .btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.btn-secondary {
	background: var(--bg-white);
	color: var(--text);
	border-color: var(--border);
}
.btn-secondary:hover {
	background: var(--bg-muted);
	border-color: var(--text-light);
	color: var(--text);
}

.login-card button {
	width: 100%;
	margin-top: 1.5rem;
	padding: 0.65rem;
}

.actions { margin-top: 1.25rem; display: flex; gap: 0.75rem; flex-wrap: wrap; }
.actions-top { margin-top: 0; margin-bottom: 1rem; }

/* ─── Cards & stats ─── */
.card {
	background: var(--bg-white);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1.25rem 1.5rem;
	margin-bottom: 1rem;
	box-shadow: var(--shadow-sm);
}

.detail-grid .card,
.card.detail-panel {
	border: 1px solid var(--border);
}

.card h2 {
	font-size: 1rem;
	font-weight: 600;
	margin: 0 0 0.75rem;
	color: var(--primary);
}

.card > h2:first-child {
	margin-top: 0;
}

.form-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 1rem;
}

.checkbox-label {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.8125rem;
	font-weight: 500;
	text-transform: none;
	letter-spacing: 0;
	margin-top: 1.65rem;
}

.checkbox-label input { width: auto; }

.row-actions {
	display: inline-flex;
	flex-direction: row;
	flex-wrap: nowrap;
	gap: 0.375rem;
	align-items: center;
	justify-content: flex-start;
}

.row-actions .btn,
.row-actions .inline-form {
	flex: 0 0 auto;
	width: auto;
}

.row-actions .inline-form button {
	width: auto;
	min-width: 4.5rem;
}

.inline-form {
	display: inline-flex;
	margin: 0;
	align-items: center;
	vertical-align: middle;
	flex: 0 0 auto;
}

.btn-sm {
	min-height: 2rem;
	padding: 0.375rem 0.75rem;
	font-size: 0.75rem;
	line-height: 1.2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	white-space: nowrap;
}

button.btn-sm,
a.btn-sm {
	min-height: 2rem;
}

th.actions-col,
td.actions-col {
	width: 1%;
	white-space: nowrap;
	vertical-align: middle;
	text-align: right;
}

td.actions-col .row-actions {
	justify-content: flex-end;
}

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

.actions-top .inline-form {
	display: inline-flex;
	flex: 0 0 auto;
}

.actions-top .btn,
.actions-top .inline-form button {
	flex: 0 0 auto;
	width: auto;
}

.btn-danger {
	background: #b42318;
	border-color: #b42318;
	color: #fff;
}

.btn-danger:hover {
	background: #912018;
	border-color: #912018;
	color: #fff;
}

.badge {
	display: inline-block;
	padding: 0.2rem 0.5rem;
	border-radius: 999px;
	font-size: 0.6875rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.badge-deleted {
	background: #fee2e2;
	color: #991b1b;
}

.badge-redemption {
	background: #fef3c7;
	color: #92400e;
}

.row-redemption td {
	background: #fffbeb;
}

.panel-note {
	margin: 0 0 0.75rem;
	font-size: 0.8125rem;
}

.panel-total {
	margin: 0.75rem 0 0;
	font-size: 0.875rem;
}

.filter-bar .btn,
.filter-bar button[type=submit] {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 38px;
	min-height: 38px;
	padding: 0 1rem;
	margin: 0;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	box-sizing: border-box;
}

.row-deleted td {
	opacity: 0.65;
	background: #fafafa;
}

.grid.stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 1rem;
	margin: 1.25rem 0;
}

.stats-filter-note {
	grid-column: 1 / -1;
	margin: 0 0 -0.25rem;
	font-size: 0.8125rem;
	color: var(--text-muted);
}

.stat .label {
	color: var(--text-muted);
	font-size: 0.75rem;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.stat .value {
	font-size: 1.75rem;
	font-weight: 700;
	margin: 0.35rem 0 0.15rem;
	color: var(--primary);
	line-height: 1.2;
	letter-spacing: -0.02em;
}

.stat .value.small {
	font-size: 0.9375rem;
	font-weight: 600;
}

.stat .sub {
	color: var(--text-muted);
	font-size: 0.8125rem;
}

/* ─── Notices & alerts ─── */
.notice, .alert {
	padding: 0.875rem 1rem;
	margin-bottom: 1rem;
	font-size: 0.875rem;
	border-radius: 6px;
	border: 1px solid;
}

.notice-info {
	background: var(--info-bg);
	border-color: var(--info-border);
	color: var(--text);
}

.alert-error {
	background: #fef2f2;
	border-color: #fecaca;
	color: #991b1b;
}

.alert-success {
	background: #f0fdf4;
	border-color: #bbf7d0;
	color: #166534;
}

/* ─── Table ─── */
.filter-bar {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 0.875rem;
	align-items: end;
}

.filter-bar label {
	margin-bottom: 0;
}

.filter-bar-search {
	grid-column: span 2;
	min-width: 0;
}

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

.filter-bar button { height: 38px; min-height: 38px; }

.table-wrap {
	overflow-x: auto;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg-white);
	box-shadow: var(--shadow-sm);
	-webkit-overflow-scrolling: touch;
}

/* ─── Mobile top bar & nav ─── */
.mobile-topbar {
	display: none;
}

.nav-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.45);
	z-index: 150;
}

.nav-backdrop[hidden] {
	display: none;
}

.nav-toggle {
	display: inline-flex;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 44px;
	height: 44px;
	padding: 0;
	background: transparent;
	border: 1px solid var(--border);
	color: var(--primary);
	flex-shrink: 0;
}

.nav-toggle-bar {
	display: block;
	width: 18px;
	height: 2px;
	background: currentColor;
	margin: 0 auto;
	border-radius: 1px;
}

.mobile-brand {
	display: flex;
	flex-direction: column;
	min-width: 0;
	line-height: 1.2;
}

.mobile-brand strong {
	font-size: 0.8125rem;
	letter-spacing: 0.12em;
}

.mobile-brand span {
	font-size: 0.75rem;
	color: var(--text-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }

th {
	text-align: left;
	padding: 0.75rem 1rem;
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--text-muted);
	background: var(--bg-muted);
	border-bottom: 1px solid var(--border);
}

td {
	padding: 0.75rem 1rem;
	border-bottom: 1px solid var(--border-light);
	color: var(--text);
}

tbody tr:hover td { background: #fafbfc; }
tbody tr:last-child td { border-bottom: none; }

/* ─── Pagination & grids ─── */
.pagination-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
	margin-top: 1rem;
	padding: 0.875rem 1rem;
}

.pagination-summary {
	font-size: 0.8125rem;
	color: var(--text-muted);
}

.pagination-summary strong {
	color: var(--text);
	font-weight: 600;
}

.pagination-divider {
	margin: 0 0.35rem;
	color: var(--text-light);
}

.pagination {
	display: flex;
	gap: 0.25rem;
	flex-wrap: wrap;
	align-items: center;
	margin: 0;
}

.pagination-nav,
.pagination-page,
.pagination-ellipsis {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2rem;
	height: 2rem;
	padding: 0 0.5rem;
	border: 1px solid var(--border);
	border-radius: 6px;
	font-size: 0.8125rem;
	background: var(--bg-white);
	color: var(--text);
}

.pagination-nav {
	padding: 0 0.75rem;
	font-weight: 500;
}

.pagination-nav.is-disabled {
	opacity: 0.45;
	cursor: not-allowed;
	background: var(--bg-muted);
	color: var(--text-muted);
}

.pagination-page.is-active,
.pagination strong.pagination-page {
	background: var(--primary);
	color: #fff;
	border-color: var(--primary);
	font-weight: 600;
}

.pagination-page:hover,
.pagination-nav:not(.is-disabled):hover {
	background: var(--bg-muted);
	border-color: var(--text-light);
	text-decoration: none;
}

.pagination-ellipsis {
	border: none;
	background: transparent;
	color: var(--text-light);
	min-width: 1.5rem;
	padding: 0;
}

.actions-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 1rem;
}

.actions-grid .card p { margin-bottom: 1rem; color: var(--text-muted); font-size: 0.875rem; }

.input-narrow { max-width: 90px; }

/* ─── Sync progress overlay ─── */
.sync-overlay {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.45);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
	padding: 1.5rem;
}

.sync-overlay[hidden] { display: none; }

.sync-modal {
	width: 100%;
	max-width: 480px;
	margin: 0;
}

.sync-modal h2 {
	margin-top: 0;
	margin-bottom: 0.75rem;
}

.sync-status-text {
	margin: 0 0 1rem;
	color: var(--text-muted);
	font-size: 0.875rem;
	min-height: 1.25rem;
}

.sync-progress-wrap {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin-bottom: 1rem;
}

.sync-progress-track {
	flex: 1;
	height: 10px;
	background: var(--border-light);
	border-radius: 999px;
	overflow: hidden;
}

.sync-progress-bar {
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, var(--primary), var(--accent));
	border-radius: 999px;
	transition: width 0.35s ease;
}

.sync-progress-pct {
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--primary);
	min-width: 2.5rem;
	text-align: right;
}

.sync-meta {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
	font-size: 0.8125rem;
	color: var(--text-muted);
	margin-bottom: 1rem;
}

.detail-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
	gap: 1rem;
	margin-bottom: 1rem;
}

.detail-dl {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 0.75rem;
	margin: 0;
	padding: 0.75rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg-muted);
}

.detail-dl div {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.65rem 0.85rem;
	border: 1px solid var(--border-light);
	border-radius: 6px;
	background: var(--bg-white);
}

.detail-dl dt {
	margin: 0;
	font-size: 0.8125rem;
	color: var(--text-muted);
	font-weight: 500;
}

.detail-dl dd {
	margin: 0;
	font-size: 0.875rem;
	text-align: right;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
	.admin-shell {
		flex-direction: column;
	}

	.mobile-topbar {
		display: flex;
		align-items: center;
		gap: 0.75rem;
		position: sticky;
		top: 0;
		z-index: 120;
		padding: 0.65rem 1rem;
		background: var(--bg-white);
		border-bottom: 1px solid var(--border);
		box-shadow: var(--shadow-sm);
	}

	.sidebar {
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		width: min(280px, 86vw);
		z-index: 200;
		transform: translateX(-105%);
		transition: transform 0.25s ease;
		box-shadow: var(--shadow-md);
		border-right: 1px solid var(--border);
	}

	.sidebar.is-open {
		transform: translateX(0);
	}

	.content {
		padding: 1rem;
		width: 100%;
	}

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

	.page-title {
		font-size: 1.25rem;
	}

	.page-subtitle {
		font-size: 0.75rem;
	}

	.grid.stats {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 0.75rem;
	}

	.stat .value {
		font-size: 1.35rem;
	}

	.card {
		padding: 1rem;
	}

	.filter-bar {
		grid-template-columns: 1fr;
	}

	.filter-bar-search {
		grid-column: span 1;
	}

	.filter-bar-actions {
		width: 100%;
	}

	.filter-bar-actions .btn,
	.filter-bar-actions button {
		flex: 1 1 calc(50% - 0.25rem);
	}

	.input-narrow {
		max-width: none;
	}

	.actions,
	.actions-top {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		gap: 0.5rem;
	}

	.actions .btn,
	.actions button,
	.actions-top .btn,
	.actions-top .inline-form button {
		width: auto;
		flex: 0 0 auto;
	}

	.row-actions {
		display: flex;
		flex-direction: row;
		flex-wrap: nowrap;
		align-items: center;
		justify-content: flex-start;
		gap: 0.375rem;
		width: auto;
		max-width: 100%;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	.row-actions .btn,
	.row-actions .inline-form,
	.row-actions .inline-form button {
		flex: 0 0 auto;
		width: auto;
		min-width: 4.25rem;
	}

	/* Actions cell: label on top, buttons side by side below */
	.table-cards tbody td[data-label="Actions"],
	td.actions-col {
		display: block;
		text-align: left;
	}

	.table-cards tbody td[data-label="Actions"]::before,
	td.actions-col::before {
		display: block;
		margin-bottom: 0.5rem;
	}

	.table-cards tbody td[data-label="Actions"] .row-actions,
	td.actions-col .row-actions {
		justify-content: flex-start;
		width: 100%;
	}

	.pagination-bar {
		flex-direction: column;
		align-items: stretch;
		padding: 1rem;
	}

	.pagination-summary {
		text-align: center;
	}

	.pagination {
		justify-content: center;
	}

	.pagination-nav,
	.pagination-page {
		min-width: 2.5rem;
		height: 2.5rem;
	}

	.sync-overlay {
		padding: 1rem;
		align-items: flex-end;
	}

	.sync-modal {
		border-bottom-left-radius: 0;
		border-bottom-right-radius: 0;
	}

	.login-page {
		padding: 1rem;
		align-items: flex-start;
		padding-top: 2rem;
	}

	.login-card {
		padding: 1.75rem 1.25rem;
	}

	/* Card-style tables on mobile */
	.table-cards.table-wrap {
		overflow: visible;
		border: none;
		box-shadow: none;
		background: transparent;
		padding: 0;
	}

	.table-cards.table-wrap > h2 {
		padding: 0 0.25rem;
	}

	.table-cards table {
		min-width: 0;
	}

	.table-cards thead {
		display: none;
	}

	.table-cards tbody tr {
		display: block;
		border: 1px solid var(--border);
		border-radius: var(--radius);
		margin-bottom: 0.75rem;
		background: var(--bg-white);
		box-shadow: var(--shadow-sm);
		overflow: hidden;
	}

	.table-cards tbody tr:hover td {
		background: transparent;
	}

	.table-cards tbody td {
		display: flex;
		justify-content: space-between;
		align-items: flex-start;
		gap: 1rem;
		padding: 0.7rem 1rem;
		border-bottom: 1px solid var(--border-light);
		text-align: right;
		word-break: break-word;
	}

	.table-cards tbody td::before {
		content: attr(data-label);
		font-weight: 600;
		font-size: 0.6875rem;
		text-transform: uppercase;
		letter-spacing: 0.04em;
		color: var(--text-muted);
		text-align: left;
		flex: 0 0 38%;
		padding-top: 0.1rem;
	}

	.table-cards tbody td:last-child {
		border-bottom: none;
	}

	.table-cards tbody td[colspan] {
		display: block;
		text-align: center;
	}

	.table-cards tbody td[colspan]::before {
		display: none;
	}

	/* Detail inner card tables */
	.detail-panel .table-wrap.table-cards {
		margin: 0;
	}
}

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

	.brand-mark .logo {
		letter-spacing: 0.1em;
	}

	.form-grid {
		grid-template-columns: 1fr;
	}
}
