/*
 * POSTEX Booking Pro — Frontend Business Owner Dashboard
 *
 * Reuses the same porcelain/sage token system as the customer booking
 * form for a cohesive brand, extended here with a neutral "app shell"
 * scaffolding: top bar, sidebar (desktop), bottom nav (mobile), cards.
 * System font stack again — no external font requests.
 */

.postex-dash,
.postex-dash-locked {
	--postex-ink: #1e2a26;
	--postex-porcelain: #f7f5f1;
	--postex-sand: #e7e2d8;
	--postex-sage: #3f6c5c;
	--postex-sage-dark: #2f4f43;
	--postex-clay: #b8523a;
	--postex-moss: #2f7a52;

	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--postex-ink);
}

.postex-dash *,
.postex-dash *::before,
.postex-dash *::after,
.postex-dash-locked *,
.postex-dash-locked *::before,
.postex-dash-locked *::after {
	box-sizing: inherit;
}

/* ---------- Access-denied notice ---------- */

.postex-dash-locked {
	display: flex;
	justify-content: center;
	padding: 3rem 1rem;
}

.postex-dash-locked__card {
	max-width: 360px;
	text-align: center;
	background: var(--postex-porcelain);
	border: 1px solid var(--postex-sand);
	border-radius: 12px;
	padding: 2rem 1.5rem;
}

.postex-dash-locked__button {
	display: inline-block;
	margin-block-start: 1rem;
	background: var(--postex-sage);
	color: #fff;
	text-decoration: none;
	padding: 0.6rem 1.25rem;
	border-radius: 8px;
	font-weight: 600;
}

.postex-dash-locked__button:hover {
	background: var(--postex-sage-dark);
}

/* ---------- Dashboard shell ---------- */

.postex-dash {
	background: var(--postex-porcelain);
	border: 1px solid var(--postex-sand);
	border-radius: 12px;
	overflow: hidden;
	min-height: 480px;
	display: flex;
	flex-direction: column;
}

.postex-dash__topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.85rem 1.25rem;
	background: #fff;
	border-block-end: 1px solid var(--postex-sand);
}

.postex-dash__brand {
	font-weight: 700;
	letter-spacing: 0.01em;
}

.postex-dash__user {
	font-size: 0.85rem;
	color: #6b7670;
}

.postex-dash__topbar-right {
	display: flex;
	align-items: center;
}

.postex-dash__install-btn {
	background: var(--postex-sage);
	color: #fff;
	border: none;
	padding: 0.4rem 0.75rem;
	border-radius: 6px;
	font-size: 0.75rem;
	font-weight: 600;
	cursor: pointer;
	margin-inline-start: 0.6rem;
}

.postex-dash__install-btn:hover {
	background: var(--postex-sage-dark);
}

.postex-dash__body {
	display: flex;
	flex: 1;
}

/* Sidebar: hidden on mobile, shown from tablet width up. */
.postex-dash__sidebar {
	display: none;
}

.postex-dash__content {
	flex: 1;
	padding: 1.25rem;
	padding-block-end: 5.5rem; /* room for the fixed bottom nav on mobile */
}

.postex-dash__page-title {
	font-size: 1.25rem;
	margin-block: 0 1rem;
}

/* ---------- Cards ---------- */

.postex-dash__cards {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.85rem;
}

.postex-dash__card {
	background: #fff;
	border: 1px solid var(--postex-sand);
	border-radius: 10px;
	padding: 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.postex-dash__card-label {
	font-size: 0.8rem;
	color: #6b7670;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.postex-dash__card-value {
	font-size: 2rem;
	font-weight: 700;
	color: var(--postex-sage-dark);
}

.postex-dash__card-value--small {
	font-size: 1.1rem;
}

.postex-dash__card-sub {
	font-size: 0.85rem;
	color: #6b7670;
}

.postex-dash__placeholder {
	background: #fff;
	border: 1px dashed var(--postex-sand);
	border-radius: 10px;
	padding: 2rem 1rem;
	text-align: center;
	color: #6b7670;
}

/* ---------- Mobile bottom navigation ---------- */

.postex-dash__bottomnav {
	position: fixed;
	inset-inline: 0;
	bottom: 0;
	display: flex;
	background: #fff;
	border-block-start: 1px solid var(--postex-sand);
	z-index: 10;
}

.postex-dash__bottomnav-item {
	flex: 1;
	background: none;
	border: none;
	padding: 0.6rem 0.25rem;
	font-size: 0.7rem;
	color: #6b7670;
	cursor: pointer;
}

.postex-dash__bottomnav-item.is-active {
	color: var(--postex-sage);
	font-weight: 700;
}

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

@media (min-width: 782px) {
	.postex-dash__sidebar {
		display: flex;
		flex-direction: column;
		width: 200px;
		flex-shrink: 0;
		padding: 1rem 0.75rem;
		border-inline-end: 1px solid var(--postex-sand);
		background: #fff;
	}

	.postex-dash__nav-item {
		text-align: start;
		background: none;
		border: none;
		padding: 0.6rem 0.75rem;
		border-radius: 8px;
		font-size: 0.9rem;
		color: var(--postex-ink);
		cursor: pointer;
		margin-block-end: 0.15rem;
	}

	.postex-dash__nav-item:hover {
		background: var(--postex-porcelain);
	}

	.postex-dash__nav-item.is-active {
		background: var(--postex-sage);
		color: #fff;
	}

	.postex-dash__content {
		padding: 1.75rem;
		padding-block-end: 1.75rem;
	}

	.postex-dash__bottomnav {
		display: none;
	}

	.postex-dash__cards {
		grid-template-columns: repeat(3, 1fr);
	}

	.postex-dash__card--wide {
		grid-column: span 3;
	}
}

/* ---------- Shared form controls (Appointments filters, Services form) ---------- */

.postex-dash__input,
.postex-dash__select,
.postex-dash__textarea {
	width: 100%;
	padding: 0.55rem 0.7rem;
	border: 1px solid var(--postex-sand);
	border-radius: 8px;
	background: #fff;
	color: var(--postex-ink);
	font-size: 0.9rem;
	font-family: inherit;
}

.postex-dash__input--color {
	padding: 0.2rem;
	height: 2.4rem;
}

.postex-dash__textarea {
	resize: vertical;
	min-height: 3.5rem;
}

.postex-dash__label {
	display: block;
	font-size: 0.8rem;
	font-weight: 600;
	margin-block: 0.6rem 0.3rem;
}

.postex-dash__button {
	background: var(--postex-sage);
	color: #fff;
	border: none;
	padding: 0.55rem 1rem;
	border-radius: 8px;
	font-size: 0.85rem;
	font-weight: 600;
	cursor: pointer;
}

.postex-dash__button:hover {
	background: var(--postex-sage-dark);
}

.postex-dash__button--ghost {
	background: transparent;
	color: var(--postex-sage);
	border: 1px solid var(--postex-sage);
}

.postex-dash__button--small {
	padding: 0.35rem 0.6rem;
	font-size: 0.75rem;
}

.postex-dash__hint {
	color: #6b7670;
	font-size: 0.9rem;
}

.postex-dash__form-message {
	background: #fdf1ee;
	border: 1px solid var(--postex-clay);
	color: var(--postex-clay);
	padding: 0.5rem 0.7rem;
	border-radius: 8px;
	font-size: 0.85rem;
	margin-block: 0.5rem;
}

.postex-dash__pagination {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin-block-start: 1rem;
	justify-content: center;
}

.postex-dash__pagination-info {
	font-size: 0.85rem;
	color: #6b7670;
}

/* ---------- Appointments screen ---------- */

.postex-appt__filters {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.5rem;
	margin-block-end: 1rem;
}

.postex-appt__list {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}

.postex-appt__row {
	background: #fff;
	border: 1px solid var(--postex-sand);
	border-radius: 10px;
	padding: 0.85rem;
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.6rem;
}

.postex-appt__cell--main {
	display: flex;
	flex-direction: column;
}

.postex-appt__meta {
	font-size: 0.8rem;
	color: #6b7670;
}

.postex-appt__cell--actions {
	display: flex;
	justify-content: flex-end;
	gap: 0.4rem;
	flex-wrap: wrap;
}

.postex-appt__whatsapp {
	display: inline-flex;
	align-items: center;
	background: #25d366;
	color: #fff;
	text-decoration: none;
	font-size: 0.75rem;
	font-weight: 600;
	padding: 0.35rem 0.6rem;
	border-radius: 6px;
}

.postex-appt__whatsapp:hover {
	opacity: 0.9;
}

.postex-appt__details {
	grid-column: 1 / -1;
	background: var(--postex-porcelain);
	border-radius: 8px;
	padding: 0.65rem 0.85rem;
	font-size: 0.85rem;
}

.postex-appt__details p {
	margin: 0.25rem 0;
}

@media (min-width: 782px) {
	.postex-appt__filters {
		grid-template-columns: 2fr 1fr 1fr 1fr auto;
		align-items: center;
	}

	.postex-appt__row {
		grid-template-columns: 2fr 1.3fr 1.2fr auto;
		align-items: center;
	}
}

/* ---------- Services screen ---------- */

.postex-svc__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-block-end: 1rem;
}

.postex-svc__form {
	background: #fff;
	border: 1px solid var(--postex-sand);
	border-radius: 10px;
	padding: 1rem;
	margin-block-end: 1.25rem;
}

.postex-svc__form-row {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.75rem;
}

@media (min-width: 600px) {
	.postex-svc__form-row {
		grid-template-columns: repeat(3, 1fr);
	}
}

.postex-svc__form-actions {
	display: flex;
	gap: 0.5rem;
	margin-block-start: 1rem;
}

.postex-svc__list {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.6rem;
}

@media (min-width: 600px) {
	.postex-svc__list {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1000px) {
	.postex-svc__list {
		grid-template-columns: repeat(3, 1fr);
	}
}

.postex-svc__card {
	background: #fff;
	border: 1px solid var(--postex-sand);
	border-radius: 10px;
	padding: 0.85rem;
	display: flex;
	gap: 0.65rem;
	align-items: flex-start;
}

.postex-svc__card.is-inactive {
	opacity: 0.6;
}

.postex-svc__swatch {
	width: 14px;
	height: 14px;
	border-radius: 50%;
	margin-block-start: 0.3rem;
	flex-shrink: 0;
}

.postex-svc__card-body {
	display: flex;
	flex-direction: column;
	flex: 1;
}

.postex-svc__card-meta {
	font-size: 0.8rem;
	color: #6b7670;
}

.postex-svc__badge {
	display: inline-block;
	margin-block-start: 0.25rem;
	font-size: 0.7rem;
	background: var(--postex-sand);
	color: var(--postex-ink);
	padding: 0.1rem 0.4rem;
	border-radius: 4px;
	width: fit-content;
}

.postex-svc__card-actions {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

/* ---------- Business Hours screen ---------- */

.postex-hrs__section {
	background: #fff;
	border: 1px solid var(--postex-sand);
	border-radius: 10px;
	padding: 1rem;
	margin-block-end: 1.25rem;
}

.postex-dash__section-title {
	font-size: 1rem;
	margin-block: 0 0.75rem;
}

.postex-hrs__week {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin-block-end: 0.75rem;
}

.postex-hrs__day {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.4rem;
	align-items: center;
	padding-block: 0.4rem;
	border-block-end: 1px solid var(--postex-sand);
}

.postex-hrs__day:last-child {
	border-block-end: none;
}

.postex-hrs__day-toggle {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-weight: 600;
	font-size: 0.9rem;
}

@media (min-width: 600px) {
	.postex-hrs__day {
		grid-template-columns: 1fr 1fr 1fr;
	}
}

/* ---------- Settings screen ---------- */

.postex-set__payment-options {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-block-end: 0.5rem;
}

/* ---------- Calendar screen ---------- */

.postex-cal__toolbar {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	margin-block-end: 0.75rem;
}

.postex-cal__views {
	display: flex;
	gap: 0.4rem;
}

.postex-cal__view-btn {
	background: #fff;
	border: 1px solid var(--postex-sand);
	color: var(--postex-ink);
	padding: 0.4rem 0.8rem;
	border-radius: 6px;
	font-size: 0.8rem;
	cursor: pointer;
}

.postex-cal__view-btn.is-active {
	background: var(--postex-sage);
	border-color: var(--postex-sage);
	color: #fff;
}

.postex-cal__nav {
	display: flex;
	gap: 0.4rem;
}

.postex-cal__filters {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.5rem;
	margin-block-end: 0.75rem;
}

.postex-cal__heading {
	font-size: 1rem;
	margin-block: 0 0.6rem;
}

.postex-cal__body {
	min-height: 200px;
}

/* Month grid */

.postex-cal__month-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 3px;
	background: var(--postex-sand);
	border: 1px solid var(--postex-sand);
	border-radius: 8px;
	overflow: hidden;
}

.postex-cal__month-cell {
	background: #fff;
	min-height: 70px;
	padding: 0.3rem;
	display: flex;
	flex-direction: column;
	gap: 2px;
	cursor: pointer;
	font-size: 0.7rem;
}

.postex-cal__month-cell.is-outside {
	background: var(--postex-porcelain);
	color: #b3aea3;
}

.postex-cal__month-cell.is-today .postex-cal__month-daynum {
	background: var(--postex-sage);
	color: #fff;
	border-radius: 50%;
}

.postex-cal__month-daynum {
	font-weight: 600;
	width: 1.4rem;
	height: 1.4rem;
	display: flex;
	align-items: center;
	justify-content: center;
}

.postex-cal__chip {
	background: var(--postex-porcelain);
	border-inline-start: 3px solid var(--postex-sage);
	border-radius: 3px;
	padding: 1px 4px;
	font-size: 0.65rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.postex-cal__more {
	font-size: 0.65rem;
	color: #6b7670;
}

@media (max-width: 599px) {
	.postex-cal__month-cell {
		min-height: 54px;
		font-size: 0.6rem;
	}
}

/* Week / day agenda */

.postex-cal__agenda-day {
	margin-block-end: 1rem;
}

.postex-cal__agenda-header {
	font-weight: 700;
	font-size: 0.85rem;
	margin-block-end: 0.4rem;
	padding-block-end: 0.3rem;
	border-block-end: 1px solid var(--postex-sand);
}

.postex-cal__card {
	background: #fff;
	border: 1px solid var(--postex-sand);
	border-inline-start: 4px solid var(--postex-sage);
	border-radius: 8px;
	padding: 0.5rem 0.7rem;
	margin-block-end: 0.4rem;
	display: flex;
	gap: 0.6rem;
	align-items: baseline;
	cursor: pointer;
	font-size: 0.85rem;
}

.postex-cal__card-time {
	font-weight: 700;
	flex-shrink: 0;
}

.postex-cal__card-service {
	color: #6b7670;
	font-size: 0.8rem;
}

/* Details overlay */

.postex-cal__details-overlay {
	position: fixed;
	inset: 0;
	background: rgba(30, 42, 38, 0.45);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 50;
	padding: 1rem;
}

/* Critical: without this, the element's own `display: flex` above wins
   the cascade over the browser's default `[hidden] { display: none }`
   rule (same specificity, our stylesheet loads later) — so the overlay
   would render permanently open and block the entire calendar screen
   regardless of the `hidden` attribute. */
.postex-cal__details-overlay[hidden] {
	display: none;
}

.postex-cal__details-card {
	background: #fff;
	border-radius: 10px;
	padding: 1.25rem;
	max-width: 360px;
	width: 100%;
	position: relative;
}

.postex-cal__details-card p {
	margin: 0.3rem 0;
	font-size: 0.9rem;
}

.postex-cal__details-close {
	position: absolute;
	top: 0.5rem;
	inset-inline-end: 0.6rem;
	background: none;
	border: none;
	font-size: 1.3rem;
	line-height: 1;
	cursor: pointer;
	color: #6b7670;
}

@media (min-width: 600px) {
	.postex-cal__filters {
		grid-template-columns: 1fr 1fr;
		max-width: 500px;
	}
}

@media (min-width: 782px) {
	.postex-cal__toolbar {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}
}

/* ---------- Reports screen ---------- */

.postex-rep__filters {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.6rem;
	margin-block-end: 0.75rem;
}

.postex-rep__actions {
	display: flex;
	gap: 0.5rem;
	margin-block-end: 1rem;
}

.postex-rep__tables {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1rem;
}

.postex-rep__table {
	display: flex;
	flex-direction: column;
}

.postex-rep__table-row {
	display: flex;
	justify-content: space-between;
	padding: 0.45rem 0;
	border-block-end: 1px solid var(--postex-sand);
	font-size: 0.85rem;
}

.postex-rep__table-row:last-child {
	border-block-end: none;
}

.postex-rep__table-count {
	font-weight: 700;
	color: var(--postex-sage-dark);
}

@media (min-width: 600px) {
	.postex-rep__filters {
		grid-template-columns: repeat(4, 1fr);
	}
}

@media (min-width: 900px) {
	.postex-rep__tables {
		grid-template-columns: 1fr 1fr;
	}
}

/* ---------- Phase 10 polish: focus, disabled, loading, empty states ---------- */

.postex-dash button:focus-visible,
.postex-dash input:focus-visible,
.postex-dash select:focus-visible,
.postex-dash textarea:focus-visible,
.postex-dash a:focus-visible {
	outline: 2px solid var(--postex-sage);
	outline-offset: 2px;
}

.postex-dash__button:disabled,
.postex-dash__button--ghost:disabled {
	opacity: 0.55;
	cursor: not-allowed;
	pointer-events: none;
}

/* Lightweight inline loading spinner — no library, ~10 lines of CSS. */
.postex-dash__hint--loading {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
}

.postex-dash__hint--loading::before {
	content: "";
	width: 14px;
	height: 14px;
	border: 2px solid var(--postex-sand);
	border-top-color: var(--postex-sage);
	border-radius: 50%;
	animation: postex-spin 0.7s linear infinite;
	flex-shrink: 0;
}

@keyframes postex-spin {
	to {
		transform: rotate(360deg);
	}
}

@media (prefers-reduced-motion: reduce) {
	.postex-dash__hint--loading::before {
		animation: none;
	}
}

/* Empty states get slightly more visual weight than plain hint text. */
.postex-dash__empty-state {
	text-align: center;
	padding: 1.75rem 1rem;
	color: #6b7670;
	font-size: 0.9rem;
	background: #fff;
	border: 1px dashed var(--postex-sand);
	border-radius: 10px;
}

/* Error variant of the shared hint/message styles. */
.postex-dash__hint--error {
	color: var(--postex-clay);
}
