/* SPG Shop admin (/shop-admin/) */

:root {
	--sa-bg: #f3f5f9;
	--sa-card: #fff;
	--sa-text: #172033;
	--sa-muted: #5d6a80;
	--sa-line: #dde3ec;
	--sa-blue: #1a6fd4;
	--sa-blue-dark: #0d4fa0;
	--sa-green: #15803d;
	--sa-red: #b42318;
	--sa-amber: #9a6700;
	--sa-radius: 10px;
	color-scheme: light;
}

* { box-sizing: border-box; }

body.sa {
	margin: 0;
	background: var(--sa-bg);
	color: var(--sa-text);
	font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--sa-blue); }
code { font-size: 13px; }

.sa-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Top bar */
.sa-top {
	position: sticky;
	top: 0;
	z-index: 10;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 24px;
	padding: 12px 24px;
	background: #0b1222;
	color: #fff;
}

.sa-brand {
	color: #fff;
	font-size: 18px;
	font-weight: 800;
	letter-spacing: 0.04em;
	text-decoration: none;
}

.sa-brand span { color: #6cc4ff; font-weight: 600; letter-spacing: 0; }
.sa-login .sa-brand { color: var(--sa-text); }
.sa-login .sa-brand span { color: var(--sa-blue); }

.sa-nav { display: flex; flex-wrap: wrap; gap: 4px; }

.sa-nav a {
	padding: 8px 12px;
	border-radius: 6px;
	color: #c9d4e6;
	font-weight: 600;
	text-decoration: none;
}

.sa-nav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.sa-nav a[aria-current="page"] { background: var(--sa-blue); color: #fff; }

.sa-top__end {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-left: auto;
}

.sa-top__end a,
.sa-top .sa-link { color: #c9d4e6; }
.sa-top__end form { margin: 0; }

.sa-main {
	max-width: 1280px;
	margin: 0 auto;
	padding: 28px 24px 64px;
}

/* Headings */
.sa-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 20px;
}

.sa-head__end { display: flex; gap: 16px; }

.sa-h1 {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin: 0 0 20px;
	font-size: 26px;
	line-height: 1.2;
}

.sa-head .sa-h1 { margin: 0; }
.sa-h2 { margin: 0 0 14px; font-size: 18px; }
.sa-h3 { margin: 18px 0 6px; font-size: 15px; }

.sa-count {
	padding: 2px 10px;
	border-radius: 999px;
	background: #e3e9f3;
	color: var(--sa-muted);
	font-size: 14px;
}

.sa-muted { color: var(--sa-muted); font-size: 14px; }
.sa-strong { font-weight: 700; text-decoration: none; }

/* Cards / layout */
.sa-card {
	margin-bottom: 20px;
	padding: 22px;
	border: 1px solid var(--sa-line);
	border-radius: var(--sa-radius);
	background: var(--sa-card);
}

.sa-card--flush { padding: 0; overflow-x: auto; }
.sa-card > :last-child { margin-bottom: 0; }

.sa-card__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}

.sa-card__head h2 { margin: 0; font-size: 18px; }

.sa-grid-2 {
	display: grid;
	grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
	gap: 20px;
	align-items: start;
}

.sa-stack > .sa-card:last-child { margin-bottom: 0; }

.sa-row-2 {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

.sa-stats {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 16px;
}

.sa-stat {
	display: flex;
	flex-direction: column;
	gap: 6px;
	color: inherit;
	text-decoration: none;
}

.sa-stat span { color: var(--sa-muted); font-size: 14px; font-weight: 600; }
.sa-stat strong { font-size: 28px; line-height: 1.1; }
a.sa-stat:hover { border-color: var(--sa-blue); }

/* Forms */
.sa-label {
	display: block;
	margin: 14px 0 6px;
	font-size: 13px;
	font-weight: 700;
}

.sa-card > .sa-label:first-of-type,
.sa-card > h2 + .sa-label,
.sa-card > input[type="hidden"] + .sa-label { margin-top: 0; }

.sa input[type="text"],
.sa input[type="search"],
.sa input[type="email"],
.sa input[type="password"],
.sa input[type="number"],
.sa input[type="date"],
.sa select,
.sa textarea {
	width: 100%;
	min-height: 40px;
	padding: 8px 12px;
	border: 1px solid #c3ccda;
	border-radius: 8px;
	background: #fff;
	color: var(--sa-text);
	font: inherit;
}

.sa textarea { resize: vertical; }

.sa input:focus,
.sa select:focus,
.sa textarea:focus {
	outline: none;
	border-color: var(--sa-blue);
	box-shadow: 0 0 0 3px rgba(26, 111, 212, 0.2);
}

.sa input[type="file"] { display: block; margin-top: 8px; font-size: 14px; }

.sa-check {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin: 14px 0;
	font-size: 14px;
}

.sa-check input { width: 18px; height: 18px; margin: 1px 0 0; flex-shrink: 0; }

.sa-prefix {
	display: flex;
	align-items: stretch;
}

.sa-prefix span {
	display: flex;
	align-items: center;
	padding: 0 10px;
	border: 1px solid #c3ccda;
	border-right: 0;
	border-radius: 8px 0 0 8px;
	background: #eef2f7;
	color: var(--sa-muted);
	font-size: 13px;
	white-space: nowrap;
}

.sa-prefix input { border-radius: 0 8px 8px 0 !important; }

.sa .sa-num { width: 90px; }

.sa-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 16px;
}

.sa-filters input[type="search"] { flex: 1 1 220px; width: auto; }
.sa-filters select { width: auto; }
.sa-date { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.sa-date input { width: auto; }

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

/* Buttons */
.sa-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	margin-top: 14px;
	padding: 8px 16px;
	border: 1px solid #c3ccda;
	border-radius: 8px;
	background: #fff;
	color: var(--sa-text);
	font: inherit;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
}

.sa-head .sa-btn,
.sa-filters .sa-btn,
.sa-inline .sa-btn { margin-top: 0; }

.sa-btn:hover { border-color: var(--sa-blue); }
.sa-btn--primary { border-color: var(--sa-blue); background: var(--sa-blue); color: #fff; }
.sa-btn--primary:hover { background: var(--sa-blue-dark); }
.sa-btn--danger { border-color: #f1b8b2; color: var(--sa-red); }
.sa-btn--danger:hover { border-color: var(--sa-red); background: #fff5f4; }
.sa-btn--block { width: 100%; }
.sa-btn--sm { min-height: 34px; padding: 4px 12px; }
.sa-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.sa-link {
	padding: 0;
	border: 0;
	background: none;
	color: var(--sa-blue);
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
}

.sa-link--danger { color: var(--sa-red); }
.sa-link:disabled { color: #9aa4b5; cursor: not-allowed; text-decoration: none; }

.sa-danger {
	display: flex;
	gap: 10px;
	margin-top: 4px;
}

/* Tables */
.sa-table {
	width: 100%;
	border-collapse: collapse;
}

.sa-table th,
.sa-table td {
	padding: 12px 14px;
	border-bottom: 1px solid var(--sa-line);
	text-align: left;
	vertical-align: middle;
}

.sa-table thead th {
	background: #f7f9fc;
	color: var(--sa-muted);
	font-size: 12px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.sa-table tbody tr:hover { background: #fafcff; }
.sa-table tfoot th { text-align: right; }
.sa-empty { padding: 28px !important; color: var(--sa-muted); text-align: center !important; }
.sa-col-img { width: 64px; }

.sa-actions {
	display: flex;
	gap: 14px;
	align-items: center;
	justify-content: flex-end;
}

.sa-actions form { margin: 0; }

.sa-thumb {
	display: block;
	width: 48px;
	height: 48px;
	border-radius: 6px;
	object-fit: cover;
	background: #eef2f7;
}

/* Pills / statuses */
.sa-pill {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 999px;
	background: #eef2f7;
	color: var(--sa-muted);
	font-size: 12px;
	font-weight: 700;
	white-space: nowrap;
	vertical-align: middle;
}

.sa-pill--green,
.sa-status--paid,
.sa-status--completed { background: #dcfce7; color: var(--sa-green); }
.sa-pill--red,
.sa-status--cancelled,
.sa-status--refunded { background: #fee4e2; color: var(--sa-red); }
.sa-pill--blue,
.sa-status--processing,
.sa-status--dispatched,
.sa-status--ready { background: #e0edff; color: var(--sa-blue-dark); }
.sa-status--pending { background: #fff4d6; color: var(--sa-amber); }

/* Notices */
.sa-notice {
	margin: 0 0 20px;
	padding: 12px 16px;
	border-radius: 8px;
	border: 1px solid;
	font-weight: 600;
}

.sa-notice--ok { border-color: #a6e3b8; background: #ecfdf3; color: var(--sa-green); }
.sa-notice--err { border-color: #f6b8b1; background: #fff4f2; color: var(--sa-red); }
.sa-notice--warn { border-color: #f5d68a; background: #fffaeb; color: var(--sa-amber); }

/* Images */
.sa-images {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
}

.sa-images .sa-label { margin-top: 0; }

.sa-preview {
	display: block;
	width: 100%;
	max-width: 240px;
	height: auto;
	border-radius: 8px;
	border: 1px solid var(--sa-line);
}

.sa-gallery {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.sa-gallery__item {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 13px;
}

.sa-gallery__item img {
	width: 80px;
	height: 80px;
	border-radius: 6px;
	object-fit: cover;
}

/* Order notes */
.sa-notes {
	margin: 0 0 16px;
	padding: 0;
	list-style: none;
}

.sa-notes li {
	display: flex;
	flex-direction: column;
	padding: 10px 0;
	border-bottom: 1px solid var(--sa-line);
}

.sa-code {
	display: block;
	padding: 8px 10px;
	border-radius: 6px;
	background: #eef2f7;
	word-break: break-all;
}

.sa-refund { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--sa-line); }

.sa-pager {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.sa-pager a {
	min-width: 36px;
	padding: 6px 10px;
	border: 1px solid var(--sa-line);
	border-radius: 6px;
	background: #fff;
	text-align: center;
	text-decoration: none;
}

.sa-pager a[aria-current="page"] { border-color: var(--sa-blue); background: var(--sa-blue); color: #fff; }

/* Login */
.sa-login {
	display: grid;
	min-height: 100vh;
	place-items: center;
	padding: 24px;
}

.sa-login__card {
	width: min(100%, 380px);
	text-align: center;
}

.sa-login h1 { margin: 8px 0 18px; font-size: 22px; }
.sa-login .sa-label { text-align: left; }

.sa-pin {
	font-size: 24px !important;
	letter-spacing: 0.4em;
	text-align: center;
}

@media (max-width: 960px) {
	.sa-grid-2 { grid-template-columns: 1fr; }
	.sa-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
	.sa-main { padding: 20px 14px 48px; }
	.sa-top { padding: 10px 14px; }
	.sa-top__end { margin-left: 0; }
	.sa-stats,
	.sa-row-2,
	.sa-images { grid-template-columns: 1fr; }
	.sa-inline { flex-wrap: wrap; }
}
