:root {
	--bg-main: #edf6ff;
	--bg-grad-a: #bfe3ff;
	--bg-grad-b: #d7ecff;
	--ink: #0f2f58;
	--ink-soft: #466a96;
	--brand: #1f93ff;
	--brand-2: #0f66cb;
	--accent: #49b9ff;
	--card: rgba(255, 255, 255, 0.9);
	--card-strong: rgba(255, 255, 255, 0.98);
	--line: #b8d5f3;
	--danger: #b42318;
	--ok: #37b574;
	--shadow-xl: 0 24px 55px rgba(30, 98, 177, 0.2);
	--shadow-md: 0 12px 28px rgba(34, 108, 194, 0.14);
}

* {
	box-sizing: border-box;
}

html,
body {
	min-height: 100%;
}

body {
	margin: 0;
	font-family: "Public Sans", sans-serif;
	color: var(--ink);
	background:
		radial-gradient(1200px 560px at 6% -10%, var(--bg-grad-b) 0%, rgba(215, 236, 255, 0) 62%),
		radial-gradient(900px 420px at 94% 112%, var(--bg-grad-a) 0%, rgba(191, 227, 255, 0) 64%),
		linear-gradient(140deg, #f5fbff 0%, #edf6ff 52%, #e7f2ff 100%);
	background-attachment: fixed;
}

[hidden] {
	display: none !important;
}

.login-screen {
	position: fixed;
	inset: 0;
	z-index: 10;
	display: grid;
	place-items: center;
	padding: 24px;
	overflow: auto;
	background: rgba(5, 20, 38, 0.46);
	backdrop-filter: blur(5px);
	-webkit-backdrop-filter: blur(5px);
}

.login-screen[hidden] {
	display: none;
}

.login-panel {
	position: relative;
	z-index: 1;
	width: min(420px, 100%);
	display: grid;
	gap: 16px;
	padding: 30px;
	border: 1px solid var(--line);
	border-radius: 16px;
	background: var(--card-strong);
	box-shadow: var(--shadow-xl);
}

body.login-active .app-shell {
	filter: blur(5px) brightness(0.52);
	pointer-events: none;
	user-select: none;
}

body.login-active {
	overflow: hidden;
}

.login-panel .eyebrow {
	margin: 0;
	color: var(--brand-2);
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
}

.login-panel h1 {
	margin: 0;
	font: 700 30px/1.1 "Sora", sans-serif;
}

.login-subtitle,
.login-error,
.form-hint {
	margin: 0;
	color: var(--ink-soft);
	font-size: 13px;
}

.login-error:not(:empty) {
	color: var(--danger);
}

.session-actions {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
	min-width: 0;
	color: var(--ink-soft);
	font-size: 13px;
	font-weight: 700;
}

.session-actions span {
	max-width: min(260px, 25vw);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

#logoutBtn {
	flex: 0 0 auto;
	min-width: max-content;
	white-space: nowrap;
}

.background-orb {
	position: fixed;
	border-radius: 50%;
	filter: blur(56px);
	opacity: 0.22;
	z-index: 0;
	pointer-events: none;
	animation: floatDrift 13s ease-in-out infinite;
}

.orb-1 {
	width: 300px;
	height: 300px;
	background: #83c6ff;
	top: -95px;
	left: -85px;
}

.orb-2 {
	width: 380px;
	height: 380px;
	background: #a4d7ff;
	bottom: -145px;
	right: -120px;
	animation-delay: -5s;
}

.app-shell {
	position: relative;
	z-index: 2;
	display: grid;
	grid-template-columns: 276px 1fr;
	min-height: 100vh;
	max-width: 1700px;
	margin: 0 auto;
	gap: 16px;
	padding: 14px;
}

.sidebar {
	position: sticky;
	top: 14px;
	height: calc(100vh - 28px);
	background:
		linear-gradient(168deg, #229dff 0%, #1875df 54%, #0f5ec3 100%),
		radial-gradient(circle at 100% 0%, rgba(232, 246, 255, 0.35), transparent 48%);
	color: #f2f7ff;
	padding: 24px 16px;
	border-radius: 22px;
	box-shadow: var(--shadow-xl);
	border: 1px solid rgba(255, 255, 255, 0.13);
	overflow: auto;
}

.brand {
	padding: 8px 8px 16px;
	margin-bottom: 8px;
	border-bottom: 1px solid rgba(219, 235, 255, 0.24);
}

.brand .eyebrow {
	margin: 0;
	font-size: 11px;
	letter-spacing: 0.19em;
	text-transform: uppercase;
	opacity: 0.84;
	font-weight: 600;
}

.brand h1 {
	margin: 8px 0 0;
	font-family: "Sora", sans-serif;
	font-size: 34px;
	line-height: 1;
	letter-spacing: -0.02em;
}

.menu-list {
	display: grid;
	gap: 8px;
	margin-top: 12px;
}

.menu-item {
	position: relative;
	border: 0;
	background: rgba(255, 255, 255, 0.11);
	backdrop-filter: blur(3px);
	color: #eaf2ff;
	text-align: left;
	padding: 12px 12px 12px 16px;
	border-radius: 12px;
	cursor: pointer;
	font-weight: 600;
	letter-spacing: 0.01em;
	transition: background 0.2s ease, color 0.2s ease;
}

.menu-item::before {
	content: "";
	position: absolute;
	left: 6px;
	top: 50%;
	transform: translateY(-50%) scaleY(0.2);
	width: 4px;
	height: 68%;
	border-radius: 6px;
	background: #d6ecff;
	opacity: 0;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.menu-item:hover {
	background: rgba(238, 248, 255, 0.28);
}

.menu-item.active {
	background: linear-gradient(108deg, rgba(243, 251, 255, 0.43), rgba(209, 233, 255, 0.28));
	color: #ffffff;
	box-shadow: inset 0 0 0 1px rgba(231, 245, 255, 0.46);
}

.menu-item.active::before {
	opacity: 1;
	transform: translateY(-50%) scaleY(1);
}

.content {
	padding: 10px 8px 18px;
}

.topbar {
	display: flex;
	justify-content: space-between;
	align-items: end;
	gap: 16px;
	margin-bottom: 16px;
	padding: 16px 18px;
	border-radius: 18px;
	background: var(--card-strong);
	backdrop-filter: blur(10px);
	box-shadow: var(--shadow-md);
	border: 1px solid #c8def5;
}

.topbar h2 {
	margin: 0;
	font-family: "Sora", sans-serif;
	font-size: clamp(28px, 3.2vw, 36px);
	line-height: 1;
	letter-spacing: -0.03em;
}

.topbar p {
	margin: 6px 0 0;
	color: var(--ink-soft);
	font-weight: 500;
}

.topbar-actions {
	display: flex;
	gap: 8px;
	align-items: center;
	width: min(560px, 100%);
}

input,
select,
button,
textarea {
	font: inherit;
}

input,
select {
	width: 100%;
	border: 1px solid var(--line);
	border-radius: 12px;
	padding: 10px 12px;
	background: #f7fbff;
	color: var(--ink);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus {
	outline: none;
	border-color: #4aa1ff;
	box-shadow: 0 0 0 4px rgba(106, 175, 247, 0.25);
}

label {
	display: grid;
	gap: 6px;
	font-size: 14px;
	color: var(--ink-soft);
	font-weight: 600;
}

.section {
	display: none;
	animation: fadeInUp 0.28s ease;
}

.section.active {
	display: block;
}

.card-grid {
	display: grid;
	gap: 16px;
}

.two-col {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metrics {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
	position: relative;
	background: var(--card);
	backdrop-filter: blur(8px);
	border: 1px solid #c9def4;
	border-radius: 18px;
	box-shadow: var(--shadow-md);
	padding: 16px;
	overflow: hidden;
}

.card::after {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	height: 3px;
	background: linear-gradient(90deg, #2a93ff 0%, #63bdff 100%);
	pointer-events: none;
}

.metric-card {
	background: linear-gradient(140deg, #ffffff 0%, #f2f9ff 100%);
	border-color: #cde2f8;
	padding: 18px;
}

.metric-card p {
	margin: 0;
	color: var(--ink-soft);
	font-weight: 600;
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.07em;
}

.metric-card h3 {
	margin: 10px 0 0;
	font-size: clamp(34px, 3vw, 42px);
	font-family: "Sora", sans-serif;
	line-height: 1;
	letter-spacing: -0.03em;
}

.dashboard-chart-card {
	margin-top: 16px;
}

.dashboard-profit-card {
	margin-top: 16px;
}

.dashboard-profit-card .section-head strong {
	color: var(--brand-2);
	font: 700 26px/1 "Sora", sans-serif;
}

.dashboard-profit-card .hint {
	margin: -2px 0 12px;
}

.dashboard-chart-wrap {
	position: relative;
	height: 280px;
	width: 100%;
}

#dashboardChartFallback {
	margin: 0;
	padding: 96px 12px;
	color: var(--ink-soft);
	text-align: center;
}

.section-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
	margin-bottom: 10px;
}

.section-head h3 {
	margin: 0;
	font-family: "Sora", sans-serif;
	font-size: 24px;
	letter-spacing: -0.02em;
}

.list {
	display: grid;
	gap: 8px;
	position: relative;
	z-index: 2;
}

.list-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	background: linear-gradient(110deg, #f8fcff, #eef6ff);
	border: 1px solid #cfe2f7;
	border-radius: 12px;
	padding: 9px 11px;
	font-weight: 600;
	transition: transform 0.16s ease;
}

.list-item:hover {
	transform: translateY(-1px);
}

.barcode-row {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 8px;
}

.hint {
	margin: 10px 0 0;
	color: var(--ink-soft);
	font-size: 13px;
	font-weight: 500;
}

.product-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
	max-height: 360px;
	overflow: auto;
	padding-right: 2px;
}

.product-chip {
	border: 1px solid #cfe2f7;
	border-radius: 14px;
	background:
		linear-gradient(140deg, rgba(255, 255, 255, 0.98), rgba(243, 249, 255, 0.98)),
		radial-gradient(circle at 100% 0%, rgba(183, 219, 252, 0.55), transparent 46%);
	padding: 11px;
	cursor: pointer;
	text-align: left;
	box-shadow: 0 9px 18px rgba(30, 98, 177, 0.14);
	transition: transform 0.17s ease, border-color 0.17s ease;
}

.product-chip:hover {
	transform: translateY(-2px);
	border-color: #4ea7ff;
}

.product-chip p {
	margin: 0;
	position: relative;
	z-index: 2;
}

.product-chip .name {
	font-weight: 700;
	margin-bottom: 4px;
}

.product-chip .meta {
	color: var(--ink-soft);
	font-size: 12px;
	font-weight: 600;
}

mark.search-hit {
	background: #ffe26b;
	color: #1f3b62;
	padding: 0 3px;
	border-radius: 4px;
	font-weight: 700;
	box-shadow: inset 0 -1px 0 rgba(160, 114, 0, 0.25);
}

.pos-layout {
	grid-template-columns: minmax(340px, 0.92fr) minmax(540px, 1.08fr);
	align-items: start;
}

.pos-panel {
	min-height: 100%;
}

.pos-toolbar {
	margin-top: 10px;
	padding: 10px 12px;
	border-radius: 10px;
	background: #edf6ff;
	border: 1px solid #c7ddf4;
	display: grid;
	gap: 6px;
}

.toggle-line {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	font-weight: 700;
	color: #204d7f;
	cursor: pointer;
	width: fit-content;
}

.toggle-line input {
	width: 16px;
	height: 16px;
	accent-color: #67a2e3;
}

.shortcut-hint {
	margin: 0;
	color: #5278a4;
	font-size: 12px;
}

.shortcut-hint kbd {
	font-family: "Sora", sans-serif;
	font-size: 11px;
	padding: 2px 6px;
	border-radius: 6px;
	border: 1px solid #a8caec;
	background: #f8fcff;
	color: #2b639a;
}

.table-wrap {
	overflow: auto;
	position: relative;
	z-index: 2;
}

table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	min-width: 640px;
	border: 1px solid #c7dcf3;
	border-radius: 14px;
	overflow: hidden;
	background: var(--card-strong);
}

#stockHistoryTable {
	min-width: 0;
	table-layout: fixed;
}

#stockHistoryTable th,
#stockHistoryTable td {
	white-space: normal;
	overflow-wrap: anywhere;
}

#stockHistoryTable th:nth-child(1) { width: 22%; }
#stockHistoryTable th:nth-child(2) { width: 24%; }
#stockHistoryTable th:nth-child(3) { width: 17%; }
#stockHistoryTable th:nth-child(4) { width: 10%; }
#stockHistoryTable th:nth-child(5) { width: 27%; }

#stockHistoryTable td:nth-child(3) {
	white-space: nowrap;
}

th,
td {
	text-align: left;
	padding: 11px 10px;
	border-bottom: 1px solid #d6e7f8;
	vertical-align: top;
}

th {
	position: sticky;
	top: 0;
	z-index: 1;
	background: #eaf4ff;
	color: #2e5f91;
	font-size: 12px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	font-weight: 700;
}

tbody tr:hover td {
	background: #f5faff;
}

tbody tr:last-child td {
	border-bottom: 0;
}

.totals {
	margin: 14px 0;
	display: grid;
	gap: 6px;
	padding: 12px;
	border-radius: 12px;
	background: #f0f8ff;
	border: 1px solid #c9e0f8;
}

.totals p {
	margin: 0;
	font-weight: 600;
}

.totals .grand {
	font-size: 21px;
	color: #0e6dd6;
	font-family: "Sora", sans-serif;
}

.member-control {
	display: flex;
	align-items: end;
	gap: 12px;
	margin: 0 0 12px;
}

.member-control label {
	width: min(220px, 100%);
}

.member-control p {
	margin: 0 0 10px;
	color: var(--ink-soft);
	font-size: 12px;
	font-weight: 600;
}

body.pos-focus #section-kasir .totals {
	padding: 14px 14px;
	border-color: #76b7f6;
	box-shadow: inset 0 0 0 1px rgba(94, 165, 241, 0.24);
}

body.pos-focus #section-kasir .totals p {
	font-size: 17px;
}

body.pos-focus #section-kasir .totals .grand {
	font-size: 32px;
	line-height: 1.1;
}

body.pos-focus #section-kasir #cartGrandTotal {
	font-size: 44px;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: #0d68ce;
	text-shadow: 0 0 12px rgba(126, 186, 255, 0.35);
}

body.pos-focus #section-kasir .payment-actions {
	font-size: 18px;
	border-top: 1px solid #c4dcf5;
	padding-top: 12px;
}

body.pos-focus #section-kasir #cashChange {
	font-size: 34px;
	color: #0f73dd;
	font-family: "Sora", sans-serif;
	letter-spacing: -0.02em;
}

body.pos-focus #section-kasir #barcodeInput {
	font-size: 20px;
	font-weight: 600;
	letter-spacing: 0.02em;
	padding-top: 12px;
	padding-bottom: 12px;
}

.payment-grid,
.form-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 11px;
	position: relative;
	z-index: 2;
}

.form-actions {
	grid-column: 1 / -1;
	display: flex;
	gap: 8px;
	margin-top: 4px;
	flex-wrap: wrap;
}

.report-type-actions {
	margin-top: 14px;
	position: relative;
	z-index: 2;
}

.stock-report-metrics {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 12px;
	padding: 12px 0;
	border-bottom: 1px solid var(--line);
}

.stock-report-metrics p {
	margin: 0 0 6px;
	color: var(--ink-soft);
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
}

.stock-report-metrics strong {
	font: 700 28px/1 "Sora", sans-serif;
	color: var(--brand-2);
}

.payment-actions {
	margin-top: 12px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	position: relative;
	z-index: 2;
}

.btn {
	border: 0;
	border-radius: 12px;
	padding: 10px 13px;
	cursor: pointer;
	font-weight: 700;
	letter-spacing: 0.01em;
	transition: transform 0.17s ease, box-shadow 0.17s ease, opacity 0.2s ease;
}

.btn:hover {
	transform: translateY(-1px);
}

.btn:active {
	transform: translateY(0);
}

.btn.primary {
	background: linear-gradient(118deg, var(--brand) 0%, var(--brand-2) 66%);
	color: #fff;
	box-shadow: 0 12px 20px rgba(28, 69, 117, 0.28);
}

.btn.secondary {
	background: #f8fcff;
	color: #2b639a;
	border: 1px solid #bdd7f2;
}

.btn.ghost {
	background: rgba(79, 162, 243, 0.14);
	color: #1c75d6;
	border: 1px solid rgba(84, 160, 234, 0.45);
}

.btn.danger {
	background: #fff3f3;
	color: #c93434;
	border: 1px solid #ffcaca;
}

.mt-16 {
	margin-top: 16px;
}

dialog {
	border: 0;
	border-radius: 18px;
	width: min(500px, 92vw);
	box-shadow: var(--shadow-xl);
	padding: 0;
	overflow: hidden;
}

dialog::backdrop {
	background: rgba(25, 89, 160, 0.35);
	backdrop-filter: blur(3px);
}

.receipt {
	padding: 16px;
	background: linear-gradient(180deg, #ffffff 0%, #f1f8ff 100%);
}

.receipt pre {
	margin: 0;
	background: #fbfeff;
	color: #143a67;
	padding: 13px;
	border-radius: 10px;
	border: 1px dashed #b9d6f2;
	overflow: auto;
	font-size: 13px;
}

.receipt-actions {
	margin-top: 10px;
	display: flex;
	justify-content: flex-end;
	gap: 8px;
}

.badge-low {
	color: var(--danger);
	font-weight: 700;
}

.pill {
	display: inline-flex;
	align-items: center;
	white-space: nowrap;
	border-radius: 999px;
	padding: 3px 9px;
	font-size: 12px;
	font-weight: 700;
	background: #edf5ff;
	border: 1px solid #c2daef;
}

.pill.in {
	color: var(--ok);
}

.pill.out {
	color: var(--danger);
}

@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(7px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes floatDrift {
	0%,
	100% {
		transform: translateY(0) translateX(0);
	}
	50% {
		transform: translateY(10px) translateX(6px);
	}
}

@media (max-width: 1320px) {
	.metrics {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.two-col,
	.pos-layout,
	.payment-grid,
	.form-grid {
		grid-template-columns: 1fr;
	}
}

@media (min-width: 1200px) and (max-height: 800px) {
	.content {
		padding-top: 4px;
	}

	.topbar {
		padding: 12px 14px;
		margin-bottom: 10px;
	}

	.topbar h2 {
		font-size: 29px;
	}

	#section-kasir .pos-layout {
		gap: 10px;
		grid-template-columns: minmax(320px, 0.85fr) minmax(620px, 1.15fr);
	}

	#section-kasir .pos-panel {
		padding: 12px;
	}

	#section-kasir .section-head {
		margin-bottom: 8px;
	}

	#section-kasir .section-head h3 {
		font-size: 20px;
	}

	#section-kasir .hint {
		margin-top: 6px;
		font-size: 12px;
	}

	#section-kasir .pos-toolbar {
		margin-top: 8px;
		padding: 8px 10px;
	}

	#section-kasir .product-grid {
		max-height: 220px;
		gap: 8px;
	}

	#section-kasir .table-wrap {
		max-height: 220px;
	}

	#section-kasir .totals {
		margin: 10px 0;
		padding: 9px 10px;
		gap: 4px;
	}

	#section-kasir .payment-grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: 8px;
	}

	#section-kasir .payment-actions {
		margin-top: 8px;
		padding-top: 8px;
	}

	body.pos-focus #section-kasir #cartGrandTotal {
		font-size: 38px;
	}

	body.pos-focus #section-kasir #cashChange {
		font-size: 30px;
	}
}

@media (max-width: 980px) {
	.app-shell {
		grid-template-columns: 1fr;
		padding: 10px;
	}

	.sidebar {
		position: sticky;
		top: 10px;
		height: auto;
		max-height: none;
		border-radius: 16px;
		padding: 14px;
	}

	.brand {
		padding-bottom: 10px;
	}

	.brand h1 {
		font-size: 30px;
	}

	.menu-list {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 6px;
	}

	.menu-item {
		text-align: center;
		font-size: 12px;
		padding: 9px 7px;
	}

	.menu-item::before {
		display: none;
	}

	.content {
		padding: 2px;
	}

	.topbar {
		flex-direction: column;
		align-items: stretch;
		padding: 14px;
	}

	.topbar-actions {
		flex-direction: column;
		width: 100%;
	}

	.card,
	.metric-card {
		padding: 14px;
	}
}

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

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

	.barcode-row {
		grid-template-columns: 1fr;
	}

	.table-wrap {
		border-radius: 10px;
	}

	table {
		min-width: 560px;
	}

	.form-actions,
	.payment-actions,
	.receipt-actions {
		flex-direction: column;
		align-items: stretch;
	}

	.topbar h2 {
		font-size: 30px;
	}

	.member-control {
		align-items: stretch;
		flex-direction: column;
		gap: 6px;
	}

	.member-control label {
		width: 100%;
	}

	.member-control p {
		margin-bottom: 0;
	}

	.dashboard-chart-wrap {
		height: 230px;
	}

	.stock-report-metrics {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
