/**
 * CCD Order App Mode — layout shell (mobile + desktop).
 */

html,
body.ccd-order-app-shell-body {
	margin: 0;
	padding: 0;
	min-height: 100%;
	background: #f5f6f8;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	-webkit-font-smoothing: antialiased;
}

body.ccd-order-app-shell-body {
	overflow-x: hidden;
}

#ccd-app.ccd-app-layout {
	min-height: 100vh;
	min-height: 100dvh;
	display: flex;
	flex-direction: row;
	background: #f5f6f8;
	color: #111827;
	max-width: 480px;
	margin: 0 auto;
	position: relative;
	box-sizing: border-box;
}

.ccd-app-column {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: 100dvh;
	position: relative;
}

/* ── Header / Top bar ─────────────────────────────────────────── */

.ccd-app-topbar {
	position: sticky;
	top: 0;
	z-index: 50;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 16px;
	padding-top: calc(12px + env(safe-area-inset-top, 0px));
	background: #2563eb;
	color: #fff;
	box-shadow: 0 2px 12px rgba(37, 99, 235, 0.35);
}

.ccd-app-topbar__menu {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.18);
	color: #fff;
	font-size: 20px;
	cursor: pointer;
	flex-shrink: 0;
}

.ccd-app-topbar__brand {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
	flex: 1 1 auto;
}

.ccd-app-topbar__name {
	font-size: 17px;
	font-weight: 700;
	letter-spacing: 0.01em;
	line-height: 1.2;
}

.ccd-app-topbar__user {
	font-size: 12px;
	opacity: 0.9;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 220px;
}

.ccd-app-topbar__logout {
	flex-shrink: 0;
	color: #fff;
	text-decoration: none;
	font-size: 13px;
	font-weight: 600;
	padding: 8px 12px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.18);
}

.ccd-app-topbar__logout:hover,
.ccd-app-topbar__logout:focus {
	background: rgba(255, 255, 255, 0.28);
	color: #fff;
}

/* ── Sidebar ──────────────────────────────────────────────────── */

.ccd-app-sidebar {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 80;
	width: min(280px, 86vw);
	height: 100%;
	background: #0f172a;
	color: #e2e8f0;
	transform: translateX(-105%);
	transition: transform 0.2s ease;
	padding: calc(16px + env(safe-area-inset-top, 0px)) 12px 24px;
	box-sizing: border-box;
	overflow-y: auto;
}

body.ccd-sidebar-open .ccd-app-sidebar {
	transform: translateX(0);
}

.ccd-app-sidebar-backdrop {
	position: fixed;
	inset: 0;
	z-index: 70;
	background: rgba(15, 23, 42, 0.45);
}

.ccd-app-sidebar__head {
	padding: 8px 12px 20px;
	border-bottom: 1px solid #1e293b;
	margin-bottom: 12px;
}

.ccd-app-sidebar__title {
	display: block;
	font-size: 18px;
	font-weight: 700;
	color: #f8fafc;
}

.ccd-app-sidebar__user {
	display: block;
	margin-top: 4px;
	font-size: 13px;
	color: #94a3b8;
}

.ccd-app-sidebar__nav {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.ccd-app-sidebar__item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
	border-radius: 12px;
	color: #cbd5e1;
	text-decoration: none;
	font-weight: 600;
	font-size: 15px;
}

.ccd-app-sidebar__item.is-active,
.ccd-app-sidebar__item:hover {
	background: #1e293b;
	color: #fff;
}

.ccd-app-sidebar__icon {
	width: 24px;
	text-align: center;
}

/* ── Main ─────────────────────────────────────────────────────── */

.ccd-app-main {
	flex: 1 1 auto;
	padding: 16px 16px 108px;
	box-sizing: border-box;
	width: 100%;
}

.ccd-app-main .wrap,
.ccd-app-main .ccd-order-app-shell {
	margin: 0;
	padding: 0;
	max-width: none;
}

.ccd-app-main .ccd-page-header h1 {
	font-size: 22px;
	margin: 0 0 4px;
}

.ccd-app-main .ccd-dashboard-hello {
	margin: 0 0 16px;
	color: #6b7280;
	font-size: 14px;
}

.ccd-app-main .ccd-dashboard-stats {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
	margin-bottom: 16px;
}

.ccd-app-main .ccd-stat-card {
	background: #fff;
	border-radius: 16px;
	padding: 14px 12px;
	box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.ccd-app-main .ccd-stat-value {
	font-size: 22px;
	font-weight: 700;
	line-height: 1.1;
}

.ccd-app-main .ccd-dashboard-actions {
	display: grid;
	grid-template-columns: 1fr;
	gap: 12px;
}

.ccd-app-main .ccd-dash-action {
	display: grid;
	grid-template-columns: auto 1fr;
	grid-template-rows: auto auto;
	column-gap: 12px;
	row-gap: 2px;
	align-items: center;
	text-decoration: none;
	color: inherit;
	background: #fff;
	border-radius: 16px;
	padding: 16px;
	box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.ccd-app-main .ccd-dash-action__icon {
	grid-row: 1 / span 2;
	width: 44px;
	height: 44px;
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #eff6ff;
	font-size: 22px;
}

.ccd-app-main .ccd-dash-action--primary .ccd-dash-action__icon {
	background: #2563eb;
	color: #fff;
}

.ccd-app-main .ccd-dash-action__title {
	font-weight: 700;
	font-size: 16px;
}

.ccd-app-main .ccd-dash-action__hint {
	font-size: 13px;
	color: #6b7280;
}

/* ── Bottom navigation ────────────────────────────────────────── */

.ccd-app-bottomnav {
	position: fixed;
	left: 50%;
	transform: translateX(-50%);
	bottom: 0;
	width: 100%;
	max-width: 480px;
	z-index: 60;
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	align-items: end;
	gap: 0;
	padding: 8px 6px calc(8px + env(safe-area-inset-bottom, 0px));
	background: rgba(255, 255, 255, 0.96);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border-top: 1px solid #e5e7eb;
	box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
	box-sizing: border-box;
}

.ccd-app-bottomnav__item {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	min-height: 52px;
	padding: 6px 2px;
	text-decoration: none;
	color: #6b7280;
	font-size: 11px;
	font-weight: 600;
	border-radius: 12px;
	border: 0;
	background: transparent;
	cursor: pointer;
	font-family: inherit;
	-webkit-tap-highlight-color: transparent;
}

.ccd-app-bottomnav__item.is-active {
	color: #2563eb;
}

.ccd-app-bottomnav__icon {
	font-size: 18px;
	line-height: 1;
}

.ccd-app-bottomnav__label {
	line-height: 1.2;
}

.ccd-app-bottomnav__item--fab {
	position: relative;
	top: -10px;
}

.ccd-app-bottomnav__item--fab .ccd-app-bottomnav__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: #2563eb;
	color: #fff;
	font-size: 26px;
	font-weight: 500;
	box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

.ccd-app-bottomnav__item--fab .ccd-app-bottomnav__label {
	color: #2563eb;
}

/* ── More sheet ───────────────────────────────────────────────── */

.ccd-app-more {
	position: fixed;
	inset: 0;
	z-index: 90;
	background: rgba(15, 23, 42, 0.4);
	display: flex;
	align-items: flex-end;
	justify-content: center;
}

.ccd-app-more[hidden] {
	display: none !important;
}

.ccd-app-more__sheet {
	width: 100%;
	max-width: 480px;
	background: #fff;
	border-radius: 20px 20px 0 0;
	padding: 12px 12px calc(16px + env(safe-area-inset-bottom, 0px));
	box-shadow: 0 -12px 32px rgba(15, 23, 42, 0.18);
}

.ccd-app-more__item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 12px;
	border-radius: 12px;
	text-decoration: none;
	color: #111827;
	font-weight: 600;
	font-size: 15px;
}

.ccd-app-more__item:hover,
.ccd-app-more__item:active {
	background: #f3f4f6;
}

.ccd-app-more__icon {
	width: 28px;
	text-align: center;
}

/* ── Desktop / tablet enhancement ─────────────────────────────── */

@media (min-width: 481px) {
	#ccd-app.ccd-app-layout {
		box-shadow: 0 0 0 1px #e5e7eb, 0 24px 48px rgba(15, 23, 42, 0.08);
		min-height: 100vh;
	}
}

@media (min-width: 900px) {
	body.ccd-order-app-shell-body {
		background: #e5e7eb;
	}

	#ccd-app.ccd-app-layout {
		max-width: 1100px;
		margin: 24px auto;
		min-height: calc(100vh - 48px);
		border-radius: 20px;
		overflow: hidden;
		background: #f5f6f8;
	}

	.ccd-app-topbar__menu {
		display: none;
	}

	.ccd-app-sidebar {
		position: relative;
		transform: none;
		width: 240px;
		flex: 0 0 240px;
		height: auto;
		min-height: 100%;
		border-radius: 0;
	}

	.ccd-app-sidebar-backdrop {
		display: none !important;
	}

	.ccd-app-bottomnav,
	.ccd-app-more {
		display: none !important;
	}

	.ccd-app-main {
		padding: 24px 28px 32px;
	}

	.ccd-app-main .ccd-dashboard-actions {
		grid-template-columns: repeat(2, 1fr);
	}
}
