/* MediChakri date picker (see mcx-datepick.js). Small card on wide screens, sheet from the bottom on phones. */
.ui-datepicker { display: none !important; }

/* the field */
input.mcxd-input {
	cursor: pointer;
	padding-right: 46px !important;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='18' rx='3'/><path d='M16 2v4M8 2v4M3 10h18'/></svg>") !important;
	background-repeat: no-repeat !important;
	background-position: right 16px center !important;
	background-size: 20px 20px !important;
	text-overflow: ellipsis;
}

/* the card */
.mcxd-pop[hidden], .mcxd-back[hidden] { display: none !important; }
.mcxd-pop {
	position: fixed;
	z-index: 100001;
	box-sizing: border-box;
	max-width: calc(100vw - 16px);
	padding: 16px;
	border: 1px solid #cbd5e1;
	border-radius: 18px;
	background: #fff;
	color: #0f172a;
	font-family: inherit;
	box-shadow: 0 20px 44px -16px rgba(15, 23, 42, 0.3);
	animation: mcxdIn 0.16s ease-out both;
}
.mcxd-pop *, .mcxd-pop *::before, .mcxd-pop *::after { box-sizing: border-box; }
@keyframes mcxdIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.mcxd-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.mcxd-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; font-weight: 700; color: #0f172a; }
.mcxd-pop .mcxd-x {
	flex: none; display: inline-flex; align-items: center; justify-content: center;
	width: 36px; height: 36px; min-width: 36px; padding: 0; aspect-ratio: 1 / 1;
	border: 0; border-radius: 50%; background: #f1f5f9; color: #334155; font-size: 22px; line-height: 1; cursor: pointer;
}
.mcxd-pop .mcxd-x:hover { background: #e2e8f0; }
.mcxd-sub { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: #64748b; }
.mcxd-quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.mcxd-pop .mcxd-chip {
	min-height: 44px; padding: 0 16px; border: 1px solid #cbd5e1; border-radius: 999px; background: #fff;
	color: #0f172a; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
	touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.mcxd-pop .mcxd-chip:hover { background: #f1f5f9; border-color: #64748b; }
.mcxd-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, 1.1fr); gap: 8px; }
.mcxd-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; }
.mcxd-field span { font-size: 12px; font-weight: 600; color: #64748b; }
.mcxd-pop .mcxd-field select {
	width: 100%; height: 48px; min-height: 48px; margin: 0; padding: 0 28px 0 10px;
	border: 1px solid #94a3b8; border-radius: 12px; color: #0f172a; font: inherit; font-size: 16px; font-weight: 500;
	-webkit-appearance: none; appearance: none; touch-action: manipulation;
	background: #fff center right 8px / 16px 16px no-repeat url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231e3a5f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
	text-overflow: ellipsis;
}
.mcxd-pop .mcxd-field select:focus { outline: none; border-color: #0f172a; box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.1); }
.mcxd-pop .mcxd-field select option:disabled { color: #cbd5e1; }
.mcxd-sum { margin: 12px 0 0; min-height: 0; font-size: 14px; font-weight: 600; color: #15803d; }
.mcxd-sum:empty { display: none; }
.mcxd-msg { margin: 8px 0 0; font-size: 13px; color: #b91c1c; }
.mcxd-msg:empty { display: none; }
.mcxd-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.mcxd-actions button {
	min-height: 44px; padding: 0 20px; border-radius: 999px; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
	touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.mcxd-pop .mcxd-clear { margin-right: auto; padding: 0 4px; border: 0; background: transparent; color: #64748b; text-decoration: underline; }
.mcxd-pop .mcxd-clear[hidden] { display: none; }
.mcxd-pop .mcxd-cancel { border: 1px solid #94a3b8; background: #fff; color: #0f172a; }
.mcxd-pop .mcxd-set { border: 1px solid #15803d; background: #15803d; color: #fff; }
.mcxd-pop .mcxd-set:hover { background: #166534; border-color: #166534; }
.mcxd-pop .mcxd-set[disabled] { opacity: 0.45; cursor: not-allowed; }

/* phones: a sheet from the bottom, with a dim background behind it */
.mcxd-back { position: fixed; inset: 0; z-index: 100000; background: rgba(15, 23, 42, 0.45); }
html.mcxd-lock { overflow: hidden; }
.mcxd-pop.is-sheet {
	left: 0; right: 0; top: auto; bottom: 0; width: auto !important; max-width: none;
	max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
	padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
	border-width: 1px 0 0; border-radius: 22px 22px 0 0;
	animation: mcxdUp 0.22s cubic-bezier(0.22, 0.9, 0.25, 1) both;
}
@keyframes mcxdUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 380px) {
	.mcxd-pop { padding: 12px; }
	.mcxd-pop.is-sheet { padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px)); }
	.mcxd-row { gap: 6px; }
	.mcxd-pop .mcxd-field select { padding-left: 8px; font-size: 15px; }
	.mcxd-actions button { flex: 1 1 auto; }
	.mcxd-pop .mcxd-clear { flex: 1 0 100%; margin: 0 0 2px; text-align: left; min-height: 32px; }
}
@media (prefers-reduced-motion: reduce) {
	.mcxd-pop, .mcxd-pop.is-sheet { animation: none; }
}

/* quick choices sit in an even grid (2 across on a card, 4 across on a wide sheet) */
.mcxd-quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mcxd-pop .mcxd-chip { width: 100%; padding: 0 10px; }
@media (max-width: 420px) { .mcxd-pop .mcxd-chip { font-size: 13px; padding: 0 6px; } }
