/*
 * com_myprocure - ประกาศจัดซื้อจัดจ้าง
 *
 * Colours come from the Gov template's tokens when it is there, and fall back
 * to plain values so the page still reads under any other template.
 */
.my-procure {
	--mp-primary: var(--my-primary, #1b5fa8);
	--mp-ink: var(--my-ink, #1f2937);
	--mp-muted: var(--my-muted, #6b7280);
	--mp-line: var(--my-line, #e5e7eb);
	--mp-card: var(--my-card, #ffffff);
	--mp-radius: var(--my-radius-sm, 10px);
	color: var(--mp-ink);
}

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

/* ---------------------------------------------------------------- hero --- */
.mp-hero {
	display: flex; align-items: center; gap: 14px;
	padding: 18px 20px; margin-bottom: 16px; border-radius: var(--my-radius, 14px);
	color: #fff; background: linear-gradient(135deg, #b45309, #92400e);
	box-shadow: var(--my-shadow, 0 2px 14px rgba(16, 40, 80, .08));
}
.mp-hero__icon {
	flex: none; width: 52px; height: 52px; border-radius: 50%;
	display: inline-flex; align-items: center; justify-content: center;
	background: rgba(255, 255, 255, .18); font-size: 1.4rem;
}
.mp-hero h1 { margin: 0; font-size: 1.25rem; line-height: 1.4; color: #fff; }
.mp-hero p { margin: 2px 0 0; opacity: .92; font-size: .92rem; }

.mp-box {
	background: var(--mp-card); border: 1px solid var(--mp-line);
	border-radius: var(--my-radius, 14px); padding: 16px;
}

/* ---------------------------------------------------------------- tabs --- */
.mp-tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 2px solid var(--mp-line); margin-bottom: 14px; }
.mp-tab {
	appearance: none; background: transparent; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px;
	padding: 8px 13px; font: inherit; font-size: .9rem; font-weight: 600; color: var(--mp-muted); cursor: pointer;
	border-radius: 8px 8px 0 0; display: inline-flex; align-items: center; gap: 7px;
}
.mp-tab:hover { color: var(--tab); background: color-mix(in srgb, var(--tab) 8%, transparent); }
.mp-tab.is-active { color: var(--tab); border-bottom-color: var(--tab); }
.mp-tab:focus-visible { outline: 2px solid var(--tab); outline-offset: 2px; }
.mp-count {
	font-size: .72rem; font-weight: 700; min-width: 1.5em; text-align: center; padding: 1px 7px; border-radius: 999px;
	background: color-mix(in srgb, var(--tab) 16%, transparent); color: var(--tab);
}
.mp-tab.is-active .mp-count { background: var(--tab); color: #fff; }
/* On a phone nine tabs in rows push the notices off the screen: one row that swipes instead. */
@media (max-width: 640px) {
	.mp-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; -webkit-overflow-scrolling: touch; gap: 2px; }
	.mp-tab { flex: none; white-space: nowrap; padding: 8px 10px; }
}
.mp-pane { display: none; }
/* Turning a page scrolls back to the top of the list; stop short of the template's sticky header. */
.my-procure [data-mp-pane] { scroll-margin-top: 160px; }
.mp-pane.is-active { display: block; }
.mp-pane__title { margin: 0 0 12px; font-size: 1.1rem; color: var(--tab); }

/* --------------------------------------------------------------- tools --- */
.mp-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.mp-search {
	flex: 1; min-width: 200px; display: flex; align-items: center; gap: 8px;
	border: 1px solid var(--mp-line); border-radius: 10px; padding: 7px 12px; color: var(--mp-muted); background: var(--mp-card);
}
.mp-search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; color: var(--mp-ink); outline: none; }
.mp-search__count { font-size: .8rem; white-space: nowrap; }
.mp-printbtn {
	display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-size: .85rem; font-weight: 700;
	color: #fff; background: var(--mp-primary); padding: 7px 13px; border-radius: 8px; white-space: nowrap;
}
.mp-printbtn:hover { filter: brightness(1.08); color: #fff; }
.mp-updated { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--mp-muted); white-space: nowrap; }
@media (max-width: 560px) { .mp-updated { flex: 1 1 100%; } }

/* --------------------------------------------------------------- cards --- */
.mp-list { display: flex; flex-direction: column; gap: 10px; }
.mp-card {
	position: relative; display: flex; flex-direction: column; gap: 6px;
	border: 1px solid var(--mp-line); border-left: 4px solid var(--c, #d97706);
	border-radius: var(--mp-radius); padding: 13px 16px; background: var(--mp-card);
}
.mp-card:hover { border-color: var(--c, #d97706); }
.mp-card.is-new { box-shadow: 0 0 0 1px color-mix(in srgb, #dc2626 35%, transparent); }
.mp-card[hidden] { display: none; }
.mp-card__title { margin: 0; font-size: 1rem; line-height: 1.55; font-weight: 700; }
.mp-card__title a { color: inherit; text-decoration: none; }
.mp-card__title a:hover { text-decoration: underline; text-decoration-color: var(--c); }
.mp-new {
	display: inline-flex; align-items: center; gap: 4px; font-size: .7rem; font-weight: 800; color: #fff;
	background: #dc2626; padding: 1px 7px; border-radius: 6px; vertical-align: middle; margin-right: 4px;
	animation: mpPulse 1.6s ease-in-out infinite;
}
@keyframes mpPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .5); } 50% { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0); } }
@media (prefers-reduced-motion: reduce) { .mp-new, .mp-arrow, .mp-gauge__fill { animation: none !important; } }

.mp-meta { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: .85rem; color: var(--mp-muted); }
.mp-meta span { display: inline-flex; align-items: center; gap: 6px; }
.mp-meta b { color: var(--mp-ink); font-weight: 700; }
.mp-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .02em; }

/* actions row: documents left, counters and share right */
.mp-actions {
	display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
	margin-top: 4px; padding-top: 9px; border-top: 1px dashed var(--mp-line);
}
.mp-btn {
	display: inline-flex; align-items: center; gap: 7px; text-decoration: none; cursor: pointer;
	font: inherit; font-size: .85rem; font-weight: 700; line-height: 1.2;
	color: #fff; background: var(--c, var(--mp-primary)); border: 1px solid var(--c, var(--mp-primary));
	border-radius: 999px; padding: 7px 15px; transition: filter .12s, transform .12s;
}
.mp-btn:hover { filter: brightness(1.08); color: #fff; }
.mp-btn:active { transform: translateY(1px); }
.mp-btn.is-ghost { background: transparent; color: var(--c, var(--mp-primary)); }
.mp-btn.is-ghost:hover { background: color-mix(in srgb, var(--c, var(--mp-primary)) 10%, transparent); color: var(--c, var(--mp-primary)); }
.mp-btn.is-done { background: #16a34a; border-color: #16a34a; color: #fff; }
.mp-actions__end { margin-left: auto; display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mp-stats { display: inline-flex; align-items: center; gap: 12px; font-size: .8rem; color: var(--mp-muted); }
.mp-stats span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
@media (max-width: 640px) {
	.mp-actions .mp-btn { flex: 1 1 auto; justify-content: center; }
	.mp-actions__end { margin-left: 0; width: 100%; justify-content: space-between; }
}

.mp-empty { color: var(--mp-muted); margin: 8px 0 0; }
.mp-noresult[hidden] { display: none; }

.mp-pager { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; align-items: center; margin-top: 16px; }
.mp-pg {
	appearance: none; border: 1px solid var(--mp-line); background: var(--mp-card); color: var(--mp-ink); cursor: pointer;
	font: inherit; font-size: .85rem; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 8px;
}
.mp-pg:hover:not(:disabled) { border-color: var(--mp-primary); }
.mp-pg.is-cur { background: var(--mp-primary); border-color: var(--mp-primary); color: #fff; font-weight: 700; }
.mp-pg:disabled { opacity: .4; cursor: default; }

/* ------------------------------------------------------------ progress --- */
.mp-prog {
	margin: 6px 0 2px; padding: 10px 12px 6px; border: 1px solid var(--mp-line); border-radius: 10px;
	background: color-mix(in srgb, var(--pc) 5%, var(--mp-card));
}
.mp-prog__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.mp-prog__status { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: .9rem; color: var(--pc); }
.mp-prog__body { display: flex; align-items: center; gap: 14px; }
.mp-gauge { position: relative; flex: none; width: 112px; text-align: center; }
.mp-gauge svg { display: block; width: 100%; height: auto; overflow: visible; }
.mp-gauge__fill { animation: mpGauge .9s ease-out both; }
@keyframes mpGauge { from { stroke-dasharray: 0 999; } }
.mp-gauge__num { position: absolute; left: 0; right: 0; top: 30px; font-weight: 800; color: var(--pc); line-height: 1; }
.mp-gauge__num b { font-size: 1.45rem; }
.mp-gauge__num i { font-size: .8rem; font-style: normal; margin-left: 1px; }
.mp-gauge__cap { position: absolute; left: 0; right: 0; top: 53px; font-size: .68rem; font-weight: 600; color: var(--mp-muted); }
.mp-track { flex: 1; display: flex; align-items: flex-start; padding-top: 18px; min-width: 0; }
.mp-step { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; min-width: 0; }
.mp-step::before { content: ""; position: absolute; top: 15px; right: 50%; width: 100%; height: 3px; background: var(--mp-line); z-index: 0; }
.mp-step:first-child::before { display: none; }
.mp-step.is-done::before { background: var(--pc); }
.mp-dot {
	position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%;
	display: inline-flex; align-items: center; justify-content: center; font-size: .8rem;
	background: var(--mp-card); border: 3px solid var(--mp-line); color: var(--mp-muted);
}
.mp-step.is-done .mp-dot { border-color: var(--pc); color: var(--pc); }
.mp-step.is-current .mp-dot { background: var(--pc); border-color: var(--pc); color: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--pc) 22%, transparent); }
.mp-step__name { font-size: .72rem; font-weight: 600; line-height: 1.2; color: var(--mp-muted); }
.mp-step.is-done .mp-step__name { color: var(--mp-ink); }
.mp-step.is-current .mp-step__name { color: var(--pc); font-weight: 800; }
.mp-step__date { font-size: .66rem; line-height: 1.2; color: var(--mp-muted); white-space: nowrap; }
.mp-step.is-done .mp-step__date { color: var(--pc); font-weight: 700; }
.mp-arrow { position: absolute; top: -18px; color: var(--pc); line-height: 1; animation: mpBounce 1.2s ease-in-out infinite; }
@keyframes mpBounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(3px); } }
.mp-cancel {
	display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 700; color: #dc2626;
	background: color-mix(in srgb, #dc2626 10%, transparent); padding: 6px 11px; border-radius: 8px;
}
@media (max-width: 560px) {
	.mp-prog__body { flex-direction: column; align-items: stretch; }
	.mp-gauge { margin: 0 auto; }
	.mp-step__date { white-space: normal; }
}

/* ---------------------------------------------------------- one notice --- */
.mp-detail__back { margin: 0 0 10px; }
.mp-detail__back a { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.mp-detail__type {
	display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; color: #fff;
	background: var(--c); padding: 3px 10px; border-radius: 999px; margin-bottom: 8px;
}
.mp-detail h1 { margin: 0 0 10px; font-size: 1.3rem; line-height: 1.5; }
.mp-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 18px; margin: 0 0 12px; }
.mp-facts div { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--c) 6%, var(--mp-card)); }
.mp-facts dt { font-size: .76rem; font-weight: 600; color: var(--mp-muted); }
.mp-facts dd { margin: 0; font-weight: 700; word-break: break-word; }
.mp-detail__desc { margin: 12px 0; line-height: 1.7; }
.mp-files { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mp-file {
	display: flex; align-items: center; gap: 12px; padding: 10px 12px;
	border: 1px solid var(--mp-line); border-radius: 10px; background: var(--mp-card);
}
.mp-file__icon {
	flex: none; width: 42px; height: 42px; border-radius: 9px; display: inline-flex; flex-direction: column;
	align-items: center; justify-content: center; color: #fff; background: var(--fc, #64748b); font-size: 1.05rem;
}
.mp-file__icon small { font-size: .55rem; font-weight: 800; letter-spacing: .03em; }
.mp-file__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mp-file__name { font-weight: 700; word-break: break-word; }
.mp-file__meta { font-size: .78rem; color: var(--mp-muted); }
.mp-section-title { margin: 18px 0 6px; font-size: 1.02rem; display: flex; align-items: center; gap: 8px; }
@media (max-width: 560px) { .mp-file { flex-wrap: wrap; } .mp-file .mp-btn { width: 100%; justify-content: center; } }

/* -------------------------------------------------------------- toast --- */
.mp-toast {
	position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 9999;
	background: #111827; color: #fff; padding: 9px 16px; border-radius: 999px; font-size: .88rem;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
