/* Client Portal */

.cp-portal {
	max-width: 520px;
	margin: 2rem auto;
	font-family: inherit;
}

.cp-portal-wide {
	max-width: 640px;
}

.cp-card {
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
	padding: 2rem;
}

.cp-title {
	margin: 0 0 0.35rem;
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.25;
}

/*
 * Card heading rendered above the card rather than inside it. Lives outside
 * .cp-card so the box starts at the form, and inherits the same 520px column
 * so the heading lines up with the card edge.
 */
.cp-title-outside {
	margin: 0 0 0.75rem;
	padding: 0;
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.25;
	color: inherit;
	text-align: center;
}

.cp-subtitle {
	margin: 0 0 1.5rem;
	color: #6b7280;
	font-size: 0.9rem;
}

.cp-tabs {
	display: flex;
	gap: 0.5rem;
	margin-bottom: 1.25rem;
}

.cp-tab {
	flex: 1;
	padding: 0.6rem 1rem;
	font-size: 0.95rem;
	font-weight: 600;
	text-align: center;
	color: #6b7280;
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.cp-tab-active {
	color: #2563eb;
	background: #eff6ff;
	border-color: #bfdbfe;
}

.cp-section {
	margin-bottom: 2rem;
}

.cp-stats {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 0.75rem;
	margin-bottom: 1.5rem;
}

.cp-stat {
	border-radius: 10px;
	padding: 0.9rem 1rem;
	text-align: center;
}

.cp-stat-label {
	display: block;
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin-bottom: 0.3rem;
}

.cp-stat-value {
	display: block;
	font-size: 1.05rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.cp-stat-total {
	background: #eff6ff;
	border: 1px solid #93c5fd;
}
.cp-stat-total .cp-stat-label {
	color: #1e40af;
}
.cp-stat-total .cp-stat-value {
	color: #1e3a8a;
}

.cp-stat-given {
	background: #ecfdf5;
	border: 1px solid #6ee7b7;
}
.cp-stat-given .cp-stat-label {
	color: #065f46;
}
.cp-stat-given .cp-stat-value {
	color: #064e3b;
}

.cp-stat-due {
	background: #fef2f2;
	border: 1px solid #fca5a5;
}
.cp-stat-due .cp-stat-label {
	color: #991b1b;
}
.cp-stat-due .cp-stat-value {
	color: #7f1d1d;
}

.cp-details-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 1.25rem 2rem;
	margin: 0;
}

.cp-detail-item {
	border-bottom: 1px solid #f3f4f6;
	padding-bottom: 0.6rem;
}

.cp-detail-item dt {
	color: #6b7280;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin-bottom: 0.15rem;
}

.cp-detail-item dd {
	margin: 0;
	font-size: 0.95rem;
	font-weight: 600;
	color: #111827;
	word-break: break-word;
}

@media (max-width: 560px) {
	.cp-details-grid {
		grid-template-columns: 1fr;
	}
}

.cp-section-title {
	margin: 0 0 1rem;
	font-size: 1.05rem;
	font-weight: 700;
	color: #111827;
}

.cp-details {
	width: 100%;
	border-collapse: collapse;
}

.cp-details th,
.cp-details td {
	text-align: left;
	padding: 0.55rem 0.5rem;
	border-bottom: 1px solid #f3f4f6;
	font-size: 0.95rem;
	vertical-align: top;
}

.cp-details th {
	width: 45%;
	color: #6b7280;
	font-weight: 600;
}

.cp-link {
	color: #2563eb;
	font-weight: 600;
	text-decoration: none;
}

.cp-link:hover {
	text-decoration: underline;
}

.cp-forgot {
	margin: 0.25rem 0 0;
	text-align: center;
	font-size: 0.9rem;
}

.cp-forgot a {
	color: #2563eb;
	font-weight: 600;
	text-decoration: none;
}

.cp-forgot a:hover {
	text-decoration: underline;
}

.cp-label {
	display: block;
	margin: 0 0 0.4rem;
	font-size: 0.85rem;
	font-weight: 600;
	color: #374151;
}

.cp-input {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 0.65rem 0.85rem;
	font-size: 1rem;
	line-height: 1.5;
	color: #111827;
	background: #fff;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	margin-bottom: 0.9rem;
}

.cp-input:focus {
	outline: none;
	border-color: #2563eb;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.cp-btn {
	display: inline-block;
	width: 100%;
	padding: 0.7rem 1rem;
	font-size: 1rem;
	font-weight: 600;
	text-align: center;
	color: #fff;
	background: #2563eb;
	border: 1px solid #2563eb;
	border-radius: 8px;
	cursor: pointer;
	margin-bottom: 0.6rem;
	transition: background 0.15s ease;
	/* Some of these are anchors, not buttons, so the theme's default
	   underline has to be cleared or the label reads as a link. */
	text-decoration: none;
}

.cp-btn:hover {
	background: #1d4ed8;
}

.cp-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.cp-btn-ghost {
	background: #fff;
	color: #374151;
	border-color: #d1d5db;
	width: auto;
	padding: 0.5rem 1rem;
	font-size: 0.9rem;
}

.cp-btn-ghost:hover {
	background: #f9fafb;
}

.cp-message {
	margin: 0 0 1rem;
	padding: 0.75rem 1rem;
	border-radius: 8px;
	font-size: 0.9rem;
}

.cp-message.cp-error {
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: #991b1b;
}

.cp-message.cp-info {
	background: #eff6ff;
	border: 1px solid #bfdbfe;
	color: #1e40af;
}

.cp-dash-head {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 1rem;
	margin-bottom: 1.25rem;
}

.cp-table {
	width: 100%;
	border-collapse: collapse;
}

.cp-table th,
.cp-table td {
	text-align: left;
	padding: 0.7rem 0.5rem;
	border-bottom: 1px solid #f3f4f6;
	font-size: 0.95rem;
}

.cp-table th {
	color: #6b7280;
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.cp-badge {
	display: inline-block;
	padding: 0.25rem 0.75rem;
	border-radius: 9999px;
	font-size: 0.8rem;
	font-weight: 600;
}

.cp-badge-working {
	background: #fef3c7;
	color: #92400e;
}

.cp-badge-pending {
	background: #dbeafe;
	color: #1e40af;
}

.cp-badge-done {
	background: #dcfce7;
	color: #166534;
}

.cp-badge-completed,
.cp-badge-paid,
.cp-badge-success {
	background: #dcfce7;
	color: #166534;
}

.cp-badge-partial,
.cp-badge-refunded {
	background: #fef3c7;
	color: #92400e;
}

.cp-badge-failed,
.cp-badge-cancelled,
.cp-badge-overdue {
	background: #fee2e2;
	color: #991b1b;
}

.cp-amount-col {
	text-align: right !important;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.cp-progress-section {
	margin-bottom: 1.5rem;
}

.cp-progress-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 0.5rem;
}

.cp-progress-title {
	font-size: 0.85rem;
	font-weight: 700;
	color: #374151;
}

.cp-progress-pct {
	font-size: 0.95rem;
	font-weight: 700;
	color: #2563eb;
	font-variant-numeric: tabular-nums;
}

.cp-progress-track {
	width: 100%;
	height: 10px;
	background: #e5e7eb;
	border-radius: 9999px;
	overflow: hidden;
}

.cp-progress-fill {
	height: 100%;
	background: linear-gradient(90deg, #2563eb, #3b82f6);
	border-radius: 9999px;
	transition: width 0.6s ease;
}

.cp-progress-summary {
	margin: 0.4rem 0 0;
	font-size: 0.8rem;
	color: #6b7280;
}

.cp-table-total td {
	border-top: 2px solid #e5e7eb;
	border-bottom: none;
	font-weight: 700;
	color: #111827;
}

@media (max-width: 560px) {
	.cp-stats {
		grid-template-columns: 1fr;
	}
	.cp-stat-value {
		font-size: 1rem;
	}
	.cp-table {
		display: block;
	}
	.cp-table thead {
		display: none;
	}
	.cp-table tbody,
	.cp-table tfoot {
		display: block;
		width: 100%;
	}
	.cp-table tr {
		display: block;
		padding: 0.6rem 0.25rem;
		border-bottom: 1px solid #f3f4f6;
	}
	.cp-table tr:last-child {
		border-bottom: none;
	}
	.cp-table td {
		display: flex;
		justify-content: space-between;
		align-items: center;
		gap: 1rem;
		padding: 0.35rem 0;
		border-bottom: none;
		white-space: normal;
		text-align: right;
	}
	.cp-table td[data-label]::before {
		content: attr(data-label);
		font-size: 0.75rem;
		font-weight: 600;
		text-transform: uppercase;
		letter-spacing: 0.03em;
		color: #6b7280;
		flex-shrink: 0;
		text-align: left;
	}
	.cp-table td:first-child {
		font-weight: 600;
	}
	.cp-table .cp-amount-col {
		text-align: right !important;
	}
	.cp-table-total {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 0.5rem 0.25rem;
		border-top: 2px solid #e5e7eb;
	}
	.cp-table-total td {
		display: block;
		padding: 0;
		border-top: none;
		border-bottom: none;
		text-align: left;
		font-weight: 700;
		color: #111827;
	}
	.cp-table-total td:last-child {
		justify-content: flex-end;
		text-align: right;
	}
}

@media (max-width: 480px) {
	.cp-card {
		padding: 1.25rem;
	}
	.cp-dash-head {
		flex-direction: column;
		align-items: stretch;
		gap: 0.75rem;
	}
	.cp-dash-head .cp-btn-ghost {
		width: 100%;
		text-align: center;
	}
}

.cp-hint {
	margin: 0.9rem 0 0;
	color: #6b7280;
	font-size: 0.85rem;
	line-height: 1.5;
}

.cp-hint--center {
	text-align: center;
}

/* Password Toggle Eye Icon */
.cp-password-wrap {
	position: relative;
	width: 100%;
	margin-bottom: 0.9rem;
}

.cp-password-wrap .cp-input {
	margin-bottom: 0;
	padding-right: 2.75rem;
}

.cp-password-toggle {
	position: absolute;
	right: 0.85rem;
	top: 50%;
	transform: translateY(-50%);
	background: transparent;
	border: none;
	box-shadow: none;
	padding: 0;
	margin: 0;
	width: 24px;
	height: 24px;
	cursor: pointer;
	color: #9ca3af;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.2s ease, opacity 0.2s ease;
	opacity: 0.75;
	outline: none;
	line-height: 1;
	z-index: 2;
}

.cp-password-toggle:hover,
.cp-password-toggle:focus {
	color: #4b5563;
	opacity: 1;
}

.cp-password-toggle svg {
	width: 18px;
	height: 18px;
	display: block;
	stroke-width: 1.75;
	pointer-events: none;
}
