/**
 * หน้าเจ้าหน้าที่ - com_mystaff
 *
 * Colours come from the Gov template's tone (--my-primary, --my-dark ...) so
 * the page follows whatever tone the site is set to; the fallbacks are for a
 * site on another template.
 */
.mystaff {
	--ms-primary: var(--my-primary, #1d5fb4);
	--ms-dark: var(--my-dark, #123a73);
	--ms-soft: color-mix(in srgb, var(--ms-primary) 10%, #fff);
	--ms-line: #dfe5ee;
	--ms-text: #1f2933;
	--ms-muted: #66788a;
	--ms-bg: #fff;
	--ms-danger: #c0392b;
	--ms-ok: #1e8e4f;
	--ms-radius: 14px;
	--ms-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 20px rgba(16, 24, 40, .06);
	color: var(--ms-text);
	font-size: 1rem;
	line-height: 1.55;
	max-width: 1180px;
	margin: 0 auto;
	padding: 8px 0 32px;
}

.mystaff *,
.mystaff *::before,
.mystaff *::after { box-sizing: border-box; }

.mystaff [hidden] { display: none !important; }

/* ------------------------------------------------------------ basics -- */

.ms-card {
	background: var(--ms-bg);
	border: 1px solid var(--ms-line);
	border-radius: var(--ms-radius);
	box-shadow: var(--ms-shadow);
	padding: 22px;
}

.ms-card__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 0 0 14px;
}

.ms-card__head h2 {
	margin: 0;
	font-size: 1.15rem;
	color: var(--ms-dark);
}

.ms-title {
	margin: 4px 0 6px;
	font-size: 1.35rem;
	text-align: center;
	color: var(--ms-dark);
}

.ms-muted { color: var(--ms-muted); }
.ms-small { font-size: .85rem; }
.ms-center { text-align: center; margin: 10px 0 0; }
.ms-hint { font-size: .85rem; color: var(--ms-muted); text-align: center; margin: 8px 0 0; }

.ms-field {
	display: block;
	margin: 0 0 14px;
	border: 0;
	padding: 0;
	min-width: 0;
}

.ms-field > span,
.ms-field > legend,
.ms-label {
	display: block;
	font-weight: 600;
	font-size: .92rem;
	margin: 0 0 6px;
}

.ms-field em { color: var(--ms-danger); font-style: normal; }

.ms-input {
	display: block;
	width: 100%;
	min-height: 44px;
	padding: 9px 12px;
	border: 1px solid #c9d3df;
	border-radius: 10px;
	background: #fff;
	color: inherit;
	font: inherit;
	transition: border-color .15s, box-shadow .15s;
}

.ms-input:focus {
	outline: 0;
	border-color: var(--ms-primary);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--ms-primary) 22%, transparent);
}

textarea.ms-input { min-height: 90px; resize: vertical; }

.ms-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0 14px;
}

.ms-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 42px;
	padding: 8px 16px;
	border: 1px solid #c9d3df;
	border-radius: 10px;
	background: #fff;
	color: var(--ms-text);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
	transition: background .15s, border-color .15s, transform .05s;
}

.ms-btn:hover { background: #f4f7fb; border-color: #b6c3d3; }
.ms-btn:active { transform: translateY(1px); }
.ms-btn:disabled { opacity: .55; cursor: default; }

.ms-btn--primary {
	background: var(--ms-primary);
	border-color: var(--ms-primary);
	color: #fff;
}

.ms-btn--primary:hover { background: var(--ms-dark); border-color: var(--ms-dark); color: #fff; }
.ms-btn--danger { color: var(--ms-danger); }
.ms-btn--danger:hover { background: #fdf0ee; border-color: #efc2bb; }
.ms-btn--ghost { background: transparent; }
.ms-btn--sm { min-height: 32px; padding: 4px 10px; font-size: .85rem; border-radius: 8px; }
.ms-btn--block { display: flex; width: 100%; margin-top: 6px; }

.ms-btn.is-busy { position: relative; color: transparent !important; }
.ms-btn.is-busy::after {
	content: "";
	position: absolute;
	width: 18px;
	height: 18px;
	border: 2px solid currentColor;
	border-color: #fff #fff transparent transparent;
	border-radius: 50%;
	animation: ms-spin .7s linear infinite;
}
.ms-btn:not(.ms-btn--primary).is-busy::after { border-color: var(--ms-primary) var(--ms-primary) transparent transparent; }

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

.ms-link {
	background: none;
	border: 0;
	padding: 4px 2px;
	color: var(--ms-primary);
	font: inherit;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.ms-link:disabled { color: var(--ms-muted); text-decoration: none; cursor: default; }
.ms-link--strong { font-weight: 700; }
.ms-back { display: block; margin: 14px auto 0; }

.ms-msg { min-height: 1.4em; margin: 8px 0; font-size: .92rem; }
.ms-msg.is-error { color: var(--ms-danger); }
.ms-msg.is-ok { color: var(--ms-ok); }
.ms-msg.is-info { color: var(--ms-muted); }

.ms-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin-top: 6px;
}

.ms-close {
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: #f1f4f8;
	font-size: 1.4rem;
	line-height: 1;
	cursor: pointer;
}

/* ------------------------------------------------------------- sign-in -- */

.ms-gate {
	display: flex;
	justify-content: center;
	padding: 12px 0;
}

.ms-auth {
	width: 100%;
	max-width: 420px;
	padding: 28px 24px;
}

.ms-auth__badge {
	display: grid;
	place-items: center;
	width: 60px;
	height: 60px;
	margin: 0 auto 6px;
	border-radius: 18px;
	background: var(--ms-soft);
	color: var(--ms-primary);
}

.ms-auth > .ms-step > .ms-muted { text-align: center; }

.ms-hello { text-align: center; margin: 0; font-size: 1.05rem; }
.ms-known .ms-muted { text-align: center; margin: 0 0 12px; font-size: .9rem; }

.ms-auth__links {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	margin-top: 10px;
}

.ms-pin { position: relative; margin: 6px 0 4px; }

.ms-pin__input {
	position: absolute;
	inset: 0 0 auto 0;
	height: 44px;
	opacity: 0;
	pointer-events: none;
}

.ms-dots {
	display: flex;
	justify-content: center;
	gap: 14px;
	padding: 12px 0 18px;
	cursor: text;
}

.ms-dots i {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	border: 2px solid color-mix(in srgb, var(--ms-primary) 55%, #fff);
	transition: background .12s, transform .12s;
}

.ms-dots i.is-on { background: var(--ms-primary); border-color: var(--ms-primary); transform: scale(1.08); }

.ms-pin__input:focus + .ms-keypad,
.ms-pin:focus-within .ms-dots i { border-color: var(--ms-primary); }

.ms-keypad {
	display: grid;
	grid-template-columns: repeat(3, 72px);
	justify-content: center;
	gap: 12px 22px;
}

.ms-key {
	width: 72px;
	height: 72px;
	border-radius: 50%;
	border: 1px solid var(--ms-line);
	background: #f7f9fc;
	color: var(--ms-dark);
	font: inherit;
	font-size: 1.6rem;
	font-weight: 600;
	cursor: pointer;
	transition: background .1s, transform .05s;
	-webkit-tap-highlight-color: transparent;
}

.ms-key:hover { background: var(--ms-soft); }
.ms-key:active { transform: scale(.94); background: color-mix(in srgb, var(--ms-primary) 18%, #fff); }
.ms-key--back { font-size: 1.3rem; background: transparent; border-color: transparent; }

.ms-pin.is-busy .ms-keypad { opacity: .5; pointer-events: none; }
.ms-pin.is-shake .ms-dots { animation: ms-shake .4s; }

@keyframes ms-shake {
	20%, 60% { transform: translateX(-8px); }
	40%, 80% { transform: translateX(8px); }
}

.ms-code {
	text-align: center;
	font-size: 1.8rem;
	font-weight: 700;
	letter-spacing: .5em;
	padding-left: .5em;
	margin: 14px 0 4px;
	min-height: 58px;
}

/* ----------------------------------------------------------- dashboard -- */

.ms-top {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 20px;
	margin-bottom: 16px;
	border-radius: var(--ms-radius);
	background: linear-gradient(120deg, var(--ms-dark), var(--ms-primary));
	color: #fff;
	box-shadow: var(--ms-shadow);
}

.ms-me { display: flex; align-items: center; gap: 12px; }
.ms-me p { margin: 0; }
.ms-me__hello { font-size: .85rem; opacity: .85; }
.ms-me__name { font-size: 1.15rem; font-weight: 700; }

.ms-avatar {
	display: grid;
	place-items: center;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .2);
	font-size: 1.3rem;
	font-weight: 700;
}

.ms-top__actions { display: flex; flex-wrap: wrap; gap: 8px; }

.ms-top .ms-btn--ghost {
	color: #fff;
	border-color: rgba(255, 255, 255, .45);
}

.ms-top .ms-btn--ghost:hover { background: rgba(255, 255, 255, .14); border-color: #fff; }

.ms-tabs {
	display: flex;
	gap: 6px;
	margin: 0 0 16px;
	padding: 5px;
	background: #eef2f7;
	border-radius: 12px;
	overflow-x: auto;
}

.ms-tab {
	flex: 1 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 44px;
	padding: 8px 16px;
	border: 0;
	border-radius: 9px;
	background: transparent;
	color: var(--ms-muted);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
}

.ms-tab:hover { color: var(--ms-dark); }
.ms-tab.is-active { background: #fff; color: var(--ms-primary); box-shadow: 0 1px 4px rgba(16, 24, 40, .12); }

.ms-split {
	display: grid;
	grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
	gap: 16px;
	align-items: start;
}

.ms-list { position: sticky; top: calc(var(--my-header-h, 0px) + 12px); }

/* cover and photos */

.ms-drop {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 100%;
	min-height: 120px;
	padding: 14px;
	border: 2px dashed #c3cedb;
	border-radius: 12px;
	background: #f8fafc;
	color: var(--ms-muted);
	font: inherit;
	cursor: pointer;
	transition: border-color .15s, background .15s;
}

.ms-drop:hover { border-color: var(--ms-primary); background: var(--ms-soft); color: var(--ms-primary); }
.ms-drop--file { min-height: 96px; }
.ms-drop.is-picked { border-style: solid; border-color: var(--ms-primary); color: var(--ms-dark); background: var(--ms-soft); word-break: break-all; }

.ms-cover__img {
	aspect-ratio: 16 / 9;
	border-radius: 12px;
	overflow: hidden;
	background: #eef2f7;
	display: grid;
	place-items: center;
}

.ms-cover__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ms-cover__tools { display: flex; gap: 8px; margin-top: 8px; }

.ms-thumbs {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
	gap: 8px;
}

.ms-thumb {
	position: relative;
	aspect-ratio: 1;
	border-radius: 10px;
	overflow: hidden;
	background: #eef2f7;
	display: grid;
	place-items: center;
	font-size: .85rem;
	color: var(--ms-muted);
}

.ms-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ms-thumb--add {
	border: 2px dashed #c3cedb;
	background: #f8fafc;
	font: inherit;
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	gap: 4px;
	align-items: center;
	justify-content: center;
}

.ms-thumb--add small { font-size: .75rem; }
.ms-thumb--add:hover { border-color: var(--ms-primary); color: var(--ms-primary); }

.ms-thumb__x,
.ms-thumb__star {
	position: absolute;
	top: 4px;
	width: 26px;
	height: 26px;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, .55);
	color: #fff;
	font-size: 1rem;
	line-height: 1;
	cursor: pointer;
}

.ms-thumb__x { right: 4px; }
.ms-thumb__star { left: 4px; font-size: .8rem; }
.ms-thumb__star:hover { background: #e0a100; }

/* activity album pictures: the cover is ringed and labelled */
.ms-thumbs--album { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
/* the picture fills the whole square tile (as a grid item it stopped short of the bottom) */
.ms-thumbs--album .ms-thumb > img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.ms-thumb.is-cover::after {
	content: '';
	position: absolute;
	inset: 0;
	border: 3px solid var(--ms-primary);
	border-radius: inherit;
	pointer-events: none;
}
.ms-thumb__badge {
	position: absolute;
	left: 4px;
	bottom: 4px;
	padding: 1px 8px;
	border-radius: 99px;
	background: var(--ms-primary);
	color: #fff;
	font-size: .72rem;
	font-weight: 600;
}

/* files attached to news */
.ms-drop--slim { min-height: 64px; flex-direction: row; gap: 8px; }

.ms-files { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.ms-files:empty { display: none; }

.ms-file {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	border: 1px solid #d9e1ea;
	border-radius: 10px;
	background: #fff;
	min-width: 0;
}

.ms-file.is-loading { opacity: .65; }
.ms-file__ext {
	flex: none;
	min-width: 44px;
	padding: 2px 6px;
	border-radius: 4px;
	background: #475569;
	color: #fff;
	font-size: .72rem;
	font-weight: 700;
	text-align: center;
}
.ms-file__ext--pdf { background: #c62828; }
.ms-file__ext--doc, .ms-file__ext--docx { background: #2b579a; }
.ms-file__ext--xls, .ms-file__ext--xlsx { background: #217346; }
.ms-file__ext--zip { background: #7a5c00; }
.ms-file__ext--rar { background: #6a3d9a; }
.ms-file__name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: .92rem; }
.ms-file__size { flex: none; color: var(--ms-muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
.ms-file__x {
	flex: none;
	width: 28px;
	height: 28px;
	border: 0;
	border-radius: 50%;
	background: #eef2f7;
	color: var(--ms-dark);
	font-size: 1rem;
	line-height: 1;
	cursor: pointer;
}
.ms-file__x:hover { background: #fde2e1; color: #b42318; }

.ms-stack { display: grid; gap: 16px; min-width: 0; }

/* pictures to tick, from a Facebook post */
.ms-thumbs--pick { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); margin-bottom: 10px; }
.ms-thumb--pick { cursor: pointer; outline: 3px solid transparent; outline-offset: -3px; }
.ms-thumb--pick:has(input:checked) { outline-color: var(--ms-primary); }
.ms-thumb--pick input {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 22px;
	height: 22px;
	accent-color: var(--ms-primary);
}
.ms-thumb--pick:not(:has(input:checked)) img { opacity: .45; }

.ms-check { display: flex; align-items: center; gap: 8px; margin: 6px 0; cursor: pointer; }
.ms-check input { width: 18px; height: 18px; accent-color: var(--ms-primary); }
.ms-msg { white-space: pre-line; }

.ms-editor { border-radius: 10px; }
.ms-editor textarea { width: 100%; }

/* lists */

.ms-daybar {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: -4px 0 10px;
}

.ms-daybar .ms-btn--sm { flex: 0 0 auto; min-height: 38px; min-width: 38px; font-size: 1rem; white-space: nowrap; }
.ms-daybar [data-day-today] { font-size: .85rem; }
.ms-daybar__date { flex: 1 1 auto; min-width: 0; min-height: 38px; padding: 6px 10px; }

/* วันที่แบบ วว/ดด/ปปปป (พ.ศ.) - the real date input hides under the calendar button */
.ms-thdate { position: relative; display: flex; min-width: 0; }
.ms-thdate--bar { flex: 1 1 auto; }
.ms-thdate__text { flex: 1 1 auto; width: 100%; min-width: 0; padding-right: 44px; font-variant-numeric: tabular-nums; }
.ms-thdate--bar .ms-thdate__text { min-height: 38px; padding-top: 6px; padding-bottom: 6px; }
.ms-thdate__pick {
	position: absolute;
	top: 50%;
	right: 4px;
	width: 34px;
	height: 34px;
	transform: translateY(-50%);
	display: grid;
	place-items: center;
	border-radius: 8px;
	color: var(--ms-muted);
	overflow: hidden;
}
.ms-thdate__pick:hover { background: var(--ms-soft); color: var(--ms-primary); }
.ms-thdate__native {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	opacity: 0;
	cursor: pointer;
}

.ms-items { list-style: none; margin: 0; padding: 0; max-height: 70vh; overflow: auto; }

.ms-item {
	display: flex;
	gap: 12px;
	padding: 10px 0;
	border-top: 1px solid var(--ms-line);
}

.ms-item:first-child { border-top: 0; }

.ms-item__pic {
	flex: 0 0 72px;
	height: 54px;
	border-radius: 8px;
	overflow: hidden;
	background: #eef2f7;
}

.ms-item__pic img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ms-item__pic--wide { flex-basis: 96px; }

.ms-ext {
	display: grid;
	place-items: center;
	flex-basis: 54px;
	font-size: .75rem;
	font-weight: 800;
	color: #fff;
	background: #7b8a9a;
}

.ms-ext[data-ext="PDF"] { background: #d9453b; }
.ms-ext[data-ext="DOC"], .ms-ext[data-ext="DOCX"] { background: #2b5fb4; }
.ms-ext[data-ext="XLS"], .ms-ext[data-ext="XLSX"] { background: #1e8e4f; }
.ms-ext[data-ext="PPT"], .ms-ext[data-ext="PPTX"] { background: #d0662a; }

.ms-item__body { min-width: 0; flex: 1; }

.ms-item__title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-weight: 600;
	color: var(--ms-dark);
	text-decoration: none;
	line-height: 1.4;
}

.ms-item__title:hover { text-decoration: underline; }
.ms-item__meta { margin: 2px 0 0; font-size: .82rem; color: var(--ms-muted); }
.ms-item__tools { display: flex; gap: 6px; margin: 6px 0 0; }

.ms-tag {
	display: inline-block;
	margin-right: 6px;
	padding: 0 7px;
	border-radius: 999px;
	background: #fff4d6;
	color: #8a6100;
	font-size: .75rem;
	font-style: normal;
	font-weight: 600;
}

.ms-tag--fb { background: #e7efff; color: #1b4fb8; }

.ms-empty { padding: 18px 0; text-align: center; color: var(--ms-muted); }

/* Facebook */

.ms-fb { max-width: 820px; }

.ms-choice { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.ms-choice legend { width: 100%; }
.ms-choice label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.ms-choice input { width: 18px; height: 18px; accent-color: var(--ms-primary); }

.ms-progress {
	height: 8px;
	margin: 14px 0 4px;
	border-radius: 999px;
	background: #e6ebf2;
	overflow: hidden;
}

.ms-progress i {
	display: block;
	width: 0;
	height: 100%;
	background: var(--ms-primary);
	transition: width .3s;
}

.ms-log {
	margin: 8px 0 0;
	padding: 0 0 0 4px;
	list-style: none;
	max-height: 320px;
	overflow: auto;
	font-size: .9rem;
}

.ms-log li { padding: 4px 0; border-bottom: 1px dashed var(--ms-line); }
.ms-log li small { color: var(--ms-muted); }
.ms-log .is-head { border: 0; padding-top: 10px; color: var(--ms-dark); }
.ms-log .is-good { color: var(--ms-ok); }
.ms-log .is-bad { color: var(--ms-danger); }

/* dialog and toast */

.ms-overlay {
	position: fixed;
	inset: 0;
	z-index: 1050;
	display: grid;
	place-items: center;
	padding: 16px;
	background: rgba(15, 23, 42, .5);
}

.ms-dialog { width: 100%; max-width: 380px; }

.ms-toast {
	position: fixed;
	left: 50%;
	bottom: calc(24px + env(safe-area-inset-bottom, 0px));
	z-index: 1100;
	transform: translateX(-50%);
	max-width: calc(100vw - 32px);
	padding: 12px 18px;
	border-radius: 12px;
	background: #1f2933;
	color: #fff;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
	animation: ms-rise .2s ease-out;
}

.ms-toast.is-error { background: var(--ms-danger); }

@keyframes ms-rise { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ------------------------------------------------------------ events -- */

.ms-field[hidden] { display: none; }
[data-event-form] .ms-check { margin: 2px 0 16px; }
.ms-time { font-variant-numeric: tabular-nums; letter-spacing: .02em; }

/* เลือกเวลา 24 ชม.: คอลัมน์ชั่วโมง + นาที แบบตัวเลือกเวลาของเครื่อง แต่ไม่มี AM/PM */
.ms-tpick { position: relative; display: flex; min-width: 0; }
.ms-tpick .ms-time { flex: 1 1 auto; width: 100%; min-width: 0; padding-right: 44px; cursor: pointer; }
.ms-tpick__btn { border: 0; background: none; padding: 0; cursor: pointer; }
.ms-tpick.is-open .ms-tpick__btn { color: var(--ms-primary); }
.ms-tpop {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	z-index: 30;
	width: 232px;
	padding: 10px;
	background: #fff;
	border: 1px solid var(--ms-line);
	border-radius: 12px;
	box-shadow: 0 12px 32px rgba(16, 24, 40, .16);
}
.ms-tpop[hidden] { display: none; }
.ms-tpop__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ms-tpop__col b { display: block; margin-bottom: 4px; text-align: center; font-size: .8rem; font-weight: 600; color: var(--ms-muted); }
.ms-tpop__list {
	position: relative;   /* offsetTop of the chosen one counts from here */
	height: 224px;
	overflow-y: auto;
	overscroll-behavior: contain;
	display: grid;
	align-content: start;
	gap: 2px;
	padding: 4px;
	border-radius: 8px;
	background: #f5f7fb;
}
.ms-tpop__list button {
	padding: 7px 0;
	border: 0;
	border-radius: 6px;
	background: none;
	color: var(--ms-text);
	font: inherit;
	font-size: 1rem;
	font-variant-numeric: tabular-nums;
	cursor: pointer;
}
.ms-tpop__list button:hover { background: var(--ms-soft); }
.ms-tpop__list button.is-on { background: var(--ms-primary); color: #fff; font-weight: 700; }
.ms-tpop__foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; }

/* สีของกิจกรรม: ตามประเภท / สีสำเร็จ / เลือกเอง */
.ms-swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ms-swatch {
	position: relative;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 2px solid #fff;
	border-radius: 50%;
	background: var(--sw, #fff);
	box-shadow: 0 0 0 1px var(--ms-line);
	cursor: pointer;
}
.ms-swatch.is-on { box-shadow: 0 0 0 2px var(--ms-text); }
.ms-swatch.is-on::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 45%;
	width: 7px;
	height: 12px;
	border: solid #fff;
	border-width: 0 2.5px 2.5px 0;
	transform: translate(-50%, -50%) rotate(45deg);
}
.ms-swatch--auto {
	width: auto;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 0 12px 0 6px;
	border-radius: 999px;
	background: #fff;
	color: var(--ms-text);
	font: inherit;
	font-size: .85rem;
}
.ms-swatch--auto i { width: 18px; height: 18px; border-radius: 50%; flex: none; }
.ms-swatch--auto.is-on::after { display: none; }
.ms-swatch--auto.is-on { background: var(--ms-soft); }
.ms-swatch--pick {
	display: grid;
	place-items: center;
	overflow: hidden;
	background: conic-gradient(#e53935, #fdd835, #43a047, #1e88e5, #8e24aa, #e53935);
	color: #fff;
	font-weight: 700;
	text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}
.ms-swatch--pick.is-on { background: var(--sw); }
.ms-swatch--pick.is-on span { display: none; }
.ms-swatch--pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }

/* ลิงก์แนบ: ชื่อที่แสดง + ลิงก์ */
.ms-links { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.ms-links:empty { display: none; }
.ms-linkrow { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) auto; gap: 6px; align-items: center; }

/* รายการกิจกรรม: วันที่ในกล่องสีของกิจกรรม */
.ms-daybar .ms-monthbar__label { flex: 1 1 auto; text-align: center; white-space: nowrap; }
.ms-daybar [data-month-now] { font-size: .85rem; }
.ms-item--event { border-inline-start: 4px solid var(--ev, var(--ms-primary)); padding-inline-start: 10px; }
.ms-evdate {
	flex: 0 0 52px;
	height: 54px;
	border-radius: 10px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	line-height: 1.1;
	background: color-mix(in srgb, var(--ev, var(--ms-primary)) 13%, #fff);
	color: var(--ev, var(--ms-primary));
}
.ms-evdate strong { font-size: 1.25rem; }
.ms-evdate small { font-size: .72rem; }
.ms-tag--ev { background: color-mix(in srgb, var(--ev, var(--ms-primary)) 14%, #fff); color: var(--ms-text); }

/* ------------------------------------------------------------- phones -- */

@media (max-width: 900px) {
	.ms-split { grid-template-columns: minmax(0, 1fr); }
	.ms-list { position: static; }
	.ms-items { max-height: none; }
}

@media (max-width: 560px) {
	.mystaff { padding-top: 0; }
	.ms-card { padding: 16px; }
	.ms-auth { padding: 22px 16px; border-radius: 12px; }
	.ms-row { grid-template-columns: minmax(0, 1fr); }
	.ms-keypad { grid-template-columns: repeat(3, 66px); gap: 10px 20px; }
	.ms-key { width: 66px; height: 66px; }
	.ms-top { padding: 14px 16px; }
	.ms-top__actions { width: 100%; }
	.ms-top__actions .ms-btn { flex: 1 1 auto; min-height: 38px; padding: 6px 10px; font-size: .88rem; }
	/* All tabs in view at once: equal columns, icon over a label that may wrap. */
	.ms-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
	.ms-tab { flex-direction: column; gap: 2px; padding: 7px 4px; white-space: normal; text-align: center; line-height: 1.25; }
	.ms-tab span { font-size: .8rem; }
	.ms-linkrow { grid-template-columns: minmax(0, 1fr) auto; }
	.ms-linkrow [data-link-url] { grid-column: 1; }
	.ms-linkrow .ms-file__x { grid-column: 2; grid-row: 1 / span 2; }
}

/* Rename: the name box with ↺ beside it */
.ms-rename { display: flex; gap: 6px; align-items: stretch; }
.ms-rename .ms-input { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.ms-rename .ms-btn { flex: none; font-size: 1.1rem; }

@media (prefers-reduced-motion: reduce) {
	.mystaff * { animation: none !important; transition: none !important; }
}
