/* ============================================================================
 * 90-Day Report : ส่วนเพิ่มสำหรับการต่อ API จริง
 * ----------------------------------------------------------------------------
 * โหลดหลัง T90Days.css ใช้ตัวแปรสี / ขนาดจาก T90Days.css (--r90-*)
 * ทุก selector อยู่ใต้ .r90 จึงไม่กระทบหน้าอื่นของระบบ
 *
 *  1. สถานะปุ่ม (กำลังบันทึก)       4. หน้า Log In (ลิงก์ในอีเมล)       7. LINE
 *  2. ข้อความผิดพลาด / ช่วยเหลือ      5. ป้ายสถานะ / ข้อมูลอ่านอย่างเดียว
 *  3. กล่องแจ้งเตือน / โหลดไม่สำเร็จ    6. Responsive
 * ========================================================================== */

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

/* 1. สถานะปุ่ม --------------------------------------------------------------- */
.r90 .btn.r90-btn--loading {
	position: relative;
	cursor: progress;
	opacity: 0.9;
}

.r90 .btn.r90-btn--loading::before {
	content: "";
	display: inline-block;
	width: 1em;
	height: 1em;
	margin-right: 0.5em;
	vertical-align: -0.15em;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: r90v-spin 0.75s linear infinite;
}

/* 2. ข้อความผิดพลาด / ช่วยเหลือ ------------------------------------------------- */
.r90 .r90-field-error[data-r90-error] {
	display: flex;
	align-items: flex-start;
	gap: 6px;
	margin: 6px 0 0;
	line-height: 1.4;
}

.r90 .r90-field-error[data-r90-error]::before {
	content: "!";
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	margin-top: 1px;
	border-radius: 50%;
	background: var(--r90-danger, #d92d20);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
}

.r90 .r90-panel__value .r90-field-error[data-r90-error] {
	margin-bottom: 4px;
}

.r90 .r90-field-help {
	margin: 6px 0 0;
	color: var(--r90-muted, #5a6283);
	font-size: 13px;
	line-height: 1.45;
}

.r90 .r90-dropzone.r90-error {
	border-color: var(--r90-danger, #d92d20);
	background: var(--r90-danger-soft, #fde3e2);
}

/* 3. กล่องแจ้งเตือน / โหลดไม่สำเร็จ ------------------------------------------------ */
.r90 .r90-alert--error {
	color: var(--r90-danger-ink, #a5221b);
	border: 1px solid var(--r90-danger-soft, #fde3e2);
}

.r90 .r90-alert--info {
	color: var(--r90-ink-soft, #3d4674);
	border: 1px solid var(--r90-line-strong, #d7dce8);
}

.r90 .r90-loading--error,
.r90 .r90-loading--empty {
	flex-wrap: wrap;
	text-align: center;
}

.r90 .r90-loading--empty {
	color: var(--r90-muted, #5a6283);
}

.r90 .r90-retry {
	margin-left: 8px;
	white-space: nowrap;
}

/* 4. หน้า Log In (ลิงก์ในอีเมล) ---------------------------------------------------- */
.r90 .r90-access {
	text-align: center;
}

.r90 .r90-access__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	margin-bottom: 14px;
	border-radius: 50%;
	background: var(--r90-blue-soft, #e5eefd);
	color: var(--r90-navy, #1e2969);
	font-size: 28px;
}

.r90 .r90-access__title {
	margin: 0 0 10px;
	color: var(--r90-ink, #1a1f36);
	font-family: var(--r90-font-display, serif);
	font-size: 22px;
}

.r90 .r90-access__text {
	margin: 0 0 8px;
	color: var(--r90-ink-soft, #3d4674);
	font-size: 15px;
	line-height: 1.6;
}

.r90 .r90-access__text--ja {
	font-family: var(--r90-font-ja, sans-serif);
	font-size: 13px;
}

.r90 .r90-access .r90-note {
	margin-top: 20px;
	text-align: left;
}

/* 5. ป้ายสถานะ / ข้อมูลอ่านอย่างเดียว ------------------------------------------------ */
.r90 .r90-badge--changed {
	margin-left: 6px;
	padding: 1px 8px;
	border-radius: 999px;
	background: var(--r90-blue-soft, #e5eefd);
	color: var(--r90-navy, #1e2969);
	font-size: 11px;
	font-weight: 700;
	vertical-align: 1px;
}

.r90 .r90-readonly {
	margin: 0;
	padding: 10px 14px;
	border: 1px dashed var(--r90-line-strong, #d7dce8);
	border-radius: var(--r90-radius-control, 10px);
	background: var(--r90-surface-soft, #f9fafc);
	color: var(--r90-ink, #1a1f36);
	font-weight: 600;
}

.r90 .r90-person__pending strong {
	color: var(--r90-ink, #1a1f36);
}

/* 7. LINE ----------------------------------------------------------------------- */
/* สีตามแนวทางของ LINE (#06C755) - ก่อนเปิดใช้จริงให้ใช้รูปปุ่มอย่างเป็นทางการจาก LINE Developers */
.r90 .btn.r90-btn--line {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	border: 0;
	background: #06c755;
	color: #fff;
	font-weight: 700;
}

.r90 .btn.r90-btn--line:hover,
.r90 .btn.r90-btn--line:focus {
	background: #05b34c;
	color: #fff;
}

.r90 .btn.r90-btn--line:active {
	background: #048b3b;
}

.r90 .r90-btn--line__mark {
	padding: 2px 6px;
	border-radius: 6px;
	background: #fff;
	color: #06c755;
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.02em;
	line-height: 1.3;
}

.r90 .btn.r90-btn--line-outline {
	border-color: #06c755;
	color: #048b3b;
	font-weight: 700;
}

.r90 .r90-line-pending {
	margin-bottom: 8px;
	padding: 16px;
	border: 1px solid #b9e2c8;
	border-radius: var(--r90-radius-control, 10px);
	background: #f1fbf4;
	color: var(--r90-ink-soft, #3d4674);
	font-size: 14px;
}

.r90 .r90-line-pending__title {
	margin: 0 0 6px;
	color: var(--r90-ink, #1a1f36);
	font-weight: 700;
}

.r90 .r90-line-pending__note {
	margin: 10px 0 0;
	font-size: 13px;
}

.r90 .r90-line__lead {
	color: var(--r90-ink-soft, #3d4674);
	font-size: 14px;
}

.r90 .r90-line__list {
	margin: 0 0 14px;
	padding: 0;
	list-style: none;
}

.r90 .r90-line__item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 0;
	border-top: 1px solid var(--r90-line, #e6eaf1);
}

.r90 .r90-line__item:last-child {
	border-bottom: 1px solid var(--r90-line, #e6eaf1);
}

.r90 .r90-line__name {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	min-width: 0;
	overflow-wrap: anywhere;
}

.r90 .r90-line__warn {
	flex-basis: 100%;
	color: var(--r90-warn-ink, #c2410c);
	font-size: 13px;
}

.r90 .r90-line__remove {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border: 1px solid var(--r90-line-strong, #d7dce8);
	border-radius: 50%;
	background: #fff;
	color: var(--r90-muted, #5a6283);
	cursor: pointer;
}

.r90 .r90-line__remove:hover {
	border-color: var(--r90-danger, #d92d20);
	color: var(--r90-danger, #d92d20);
}

/* 6. Responsive ------------------------------------------------------------------ */
@media (max-width: 767.98px) {
	.r90 .r90-retry {
		margin: 10px 0 0;
		width: 100%;
	}

	.r90 .r90-access__title {
		font-size: 19px;
	}

	.r90 .r90-access__text {
		font-size: 14px;
	}

	.r90 .r90-actions .btn {
		min-width: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.r90 .btn.r90-btn--loading::before {
		animation-duration: 2s;
	}
}
