/**
 * Contractor Portal Styles
 *
 * @package EPN_Billing
 */

/* ═══════════════════════════════════════════════════════════════════════════
   Variables
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
	--eb-portal-primary: #c9a227;
	--eb-portal-primary-dark: #a78820;
	--eb-portal-success: #059669;
	--eb-portal-warning: #d97706;
	--eb-portal-danger: #dc2626;
	--eb-portal-info: #2563eb;
	--eb-portal-text: #1f2937;
	--eb-portal-text-muted: #6b7280;
	--eb-portal-bg: #f9fafb;
	--eb-portal-bg-card: #ffffff;
	--eb-portal-border: #e5e7eb;
	--eb-portal-radius: 8px;
	--eb-portal-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Container
   ═══════════════════════════════════════════════════════════════════════════ */
.eb-portal {
	max-width: 900px;
	margin: 0 auto;
	padding: 20px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
	color: var(--eb-portal-text);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Header
   ═══════════════════════════════════════════════════════════════════════════ */
.eb-portal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 30px;
	padding-bottom: 20px;
	border-bottom: 2px solid var(--eb-portal-primary);
}

.eb-portal-header h1 {
	margin: 0;
	font-size: 24px;
	font-weight: 600;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
	color: #ffffff;
	line-height: 1.3;
}

.eb-portal-logout {
	display: inline-block;
	padding: 10px 18px;
	font-size: 14px;
	font-weight: 500;
	color: rgba(255, 255, 255, 0.7);
	text-decoration: none;
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: var(--eb-portal-radius);
	transition: all 0.2s;
}

.eb-portal-logout:hover {
	color: #ffffff;
	background: rgba(255, 255, 255, 0.15);
	border-color: rgba(255, 255, 255, 0.3);
	text-decoration: none;
}

/* Header actions container */
.eb-portal-header-actions {
	display: flex;
	align-items: center;
	gap: 12px;
}

/* Admin contractor selector */
.eb-portal-admin-selector {
	position: relative;
}

.eb-portal-contractor-select {
	padding: 10px 36px 10px 14px;
	font-size: 14px;
	font-weight: 500;
	color: #1f2937;
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: var(--eb-portal-radius);
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	min-width: 200px;
	transition: all 0.2s;
}

.eb-portal-contractor-select:hover {
	border-color: var(--eb-portal-primary);
}

.eb-portal-contractor-select:focus {
	outline: none;
	border-color: var(--eb-portal-primary);
	box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.15);
}

/* Custom dropdown arrow */
.eb-portal-admin-selector::after {
	content: '';
	position: absolute;
	right: 14px;
	top: 50%;
	width: 8px;
	height: 8px;
	border-right: 2px solid #6b7280;
	border-bottom: 2px solid #6b7280;
	transform: translateY(-70%) rotate(45deg);
	pointer-events: none;
}

/* Admin mode banner */
.eb-portal-admin-banner {
	background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
	border: 1px solid #fbbf24;
	border-radius: var(--eb-portal-radius);
	padding: 12px 16px;
	margin-bottom: 20px;
	font-size: 13px;
	color: #92400e;
}

.eb-portal-admin-banner strong {
	color: #78350f;
}

/* Info notice variant */
.eb-portal-notice-info {
	background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%) !important;
	border-color: #60a5fa !important;
}

.eb-portal-notice-info h2 {
	color: #1e40af !important;
}

.eb-portal-notice-info p {
	color: #1e3a8a;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Cards
   ═══════════════════════════════════════════════════════════════════════════ */
.eb-portal-card {
	background: var(--eb-portal-bg-card);
	border-radius: var(--eb-portal-radius);
	box-shadow: var(--eb-portal-shadow);
	padding: 24px;
	margin-bottom: 24px;
}

.eb-portal-card h2 {
	margin: 0 0 20px;
	font-size: 18px;
	font-weight: 600;
	color: var(--eb-portal-text);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Secure Login Form
   ═══════════════════════════════════════════════════════════════════════════ */
.eb-portal-login {
	max-width: 420px;
	margin: 60px auto;
}

.eb-portal-login .eb-portal-card {
	padding: 40px;
	border: 1px solid var(--eb-portal-border);
}

.eb-portal-logo {
	text-align: center;
	font-size: 22px;
	color: var(--eb-portal-text);
	margin-bottom: 32px;
	letter-spacing: -0.5px;
}

.eb-portal-logo strong {
	color: var(--eb-portal-primary);
	font-weight: 700;
}

.eb-portal-login-form .eb-portal-field {
	margin-bottom: 20px;
}

.eb-portal-login-form .eb-portal-field label {
	display: block;
	margin-bottom: 8px;
	font-weight: 500;
	font-size: 14px;
	color: var(--eb-portal-text);
}

.eb-portal-login-form .eb-portal-field input {
	width: 100%;
	padding: 12px 14px;
	font-size: 15px;
	border: 1px solid var(--eb-portal-border);
	border-radius: var(--eb-portal-radius);
	transition: border-color 0.2s, box-shadow 0.2s;
	background: #fff;
}

.eb-portal-login-form .eb-portal-field input:focus {
	outline: none;
	border-color: var(--eb-portal-primary);
	box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.15);
}

.eb-portal-login-form .eb-portal-field input::placeholder {
	color: #9ca3af;
}

.eb-portal-btn-full {
	width: 100%;
	padding: 14px 24px;
	font-size: 16px;
}

.eb-portal-login-help {
	text-align: center;
	font-size: 13px;
	color: var(--eb-portal-text-muted);
	margin-top: 24px;
	margin-bottom: 0;
}

.eb-portal-login-help a {
	color: var(--eb-portal-primary);
	text-decoration: none;
}

.eb-portal-login-help a:hover {
	text-decoration: underline;
}

/* Honeypot field - hidden from real users */
.eb-portal-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Lockout message */
.eb-portal-lockout {
	text-align: center;
	padding: 20px;
}

.eb-portal-lockout-icon {
	font-size: 48px;
	display: block;
	margin-bottom: 16px;
}

.eb-portal-lockout h3 {
	color: var(--eb-portal-danger);
	margin: 0 0 12px;
	font-size: 18px;
}

.eb-portal-lockout p {
	color: var(--eb-portal-text-muted);
	margin: 0;
	font-size: 14px;
	line-height: 1.6;
}

/* Login message */
#eb-login-message {
	margin-top: 20px;
	padding: 12px 16px;
	border-radius: var(--eb-portal-radius);
	font-size: 14px;
	text-align: center;
}

#eb-login-message.success {
	background: #ecfdf5;
	color: var(--eb-portal-success);
	border: 1px solid var(--eb-portal-success);
}

#eb-login-message.error {
	background: #fef2f2;
	color: var(--eb-portal-danger);
	border: 1px solid var(--eb-portal-danger);
}

/* Notice card (shown when logged in but no access) */
.eb-portal-notice {
	text-align: center;
	padding: 40px !important;
	background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
	border: 1px solid #fde047;
}

.eb-portal-notice h2 {
	color: #854d0e !important;
	font-size: 20px !important;
	margin-bottom: 16px !important;
}

.eb-portal-notice p {
	color: #713f12;
	font-size: 15px;
	line-height: 1.6;
	margin: 0;
}

.eb-portal-notice a {
	color: #ca8a04;
	text-decoration: underline;
	font-weight: 500;
}

.eb-portal-notice a:hover {
	color: #a16207;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Buttons
   ═══════════════════════════════════════════════════════════════════════════ */
.eb-portal-btn {
	display: inline-block;
	padding: 12px 24px;
	font-size: 15px;
	font-weight: 500;
	text-decoration: none;
	border-radius: var(--eb-portal-radius);
	cursor: pointer;
	transition: all 0.2s;
	border: none;
}

.eb-portal-btn-primary {
	background: var(--eb-portal-primary);
	color: #fff;
}

.eb-portal-btn-primary:hover {
	background: var(--eb-portal-primary-dark);
	color: #fff;
}

.eb-portal-btn-primary:disabled {
	background: #9ca3af;
	cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Engagement Section (Expandable)
   ═══════════════════════════════════════════════════════════════════════════ */
.eb-portal-engagement {
	padding: 0;
	overflow: hidden;
}

.eb-portal-engagement-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 20px 24px;
	cursor: pointer;
	background: var(--eb-portal-bg);
	transition: background 0.2s;
}

.eb-portal-engagement-header:hover {
	background: #f3f4f6;
}

.eb-portal-engagement-chain {
	margin: 0 !important;
	font-size: 15px !important;
	font-weight: 500;
	color: var(--eb-portal-text);
	line-height: 1.4;
	flex: 1;
	padding-right: 16px;
}

.eb-portal-engagement-toggle {
	width: 24px;
	height: 24px;
	position: relative;
	flex-shrink: 0;
}

.eb-portal-engagement-toggle::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 10px;
	height: 10px;
	border-right: 2px solid var(--eb-portal-text-muted);
	border-bottom: 2px solid var(--eb-portal-text-muted);
	transform: translate(-50%, -70%) rotate(45deg);
	transition: transform 0.2s;
}

.eb-portal-engagement-header[aria-expanded="false"] .eb-portal-engagement-toggle::before {
	transform: translate(-50%, -50%) rotate(-45deg);
}

.eb-portal-engagement-content {
	padding: 0 24px 24px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Month Section (Expandable within Engagement)
   ═══════════════════════════════════════════════════════════════════════════ */
.eb-portal-month {
	border: 1px solid var(--eb-portal-border);
	border-radius: var(--eb-portal-radius);
	margin-bottom: 12px;
	overflow: hidden;
}

.eb-portal-month:last-child {
	margin-bottom: 0;
}

.eb-portal-month-current {
	border-color: var(--eb-portal-primary);
	border-width: 2px;
}

.eb-portal-month-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	background: #fff;
	cursor: pointer;
	transition: background 0.2s;
}

.eb-portal-month-header:hover {
	background: var(--eb-portal-bg);
}

.eb-portal-month-name {
	font-weight: 600;
	font-size: 14px;
	color: var(--eb-portal-text);
	flex: 1;
}

.eb-portal-month-current .eb-portal-month-name {
	color: var(--eb-portal-primary-dark);
}

.eb-portal-month-toggle {
	width: 20px;
	height: 20px;
	position: relative;
	flex-shrink: 0;
}

.eb-portal-month-toggle::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 8px;
	height: 8px;
	border-right: 2px solid var(--eb-portal-text-muted);
	border-bottom: 2px solid var(--eb-portal-text-muted);
	transform: translate(-50%, -70%) rotate(45deg);
	transition: transform 0.2s;
}

.eb-portal-month-header.collapsed .eb-portal-month-toggle::before {
	transform: translate(-50%, -50%) rotate(-45deg);
}

.eb-portal-month-body {
	padding: 16px;
	border-top: 1px solid var(--eb-portal-border);
	background: #fafafa;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Calculation Row
   ═══════════════════════════════════════════════════════════════════════════ */
.eb-portal-calculation {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	font-size: 15px;
	margin-bottom: 16px;
}

.eb-portal-calc-days,
.eb-portal-calc-rate,
.eb-portal-calc-total {
	font-weight: 500;
	color: var(--eb-portal-text);
}

.eb-portal-calc-times,
.eb-portal-calc-equals {
	color: var(--eb-portal-text-muted);
	font-size: 16px;
}

.eb-portal-calc-total {
	font-weight: 600;
	color: var(--eb-portal-primary-dark);
	font-size: 16px;
}

/* Editable calculation */
.eb-portal-calculation-editable .eb-portal-calc-input-wrapper {
	display: flex;
	align-items: center;
	gap: 6px;
}

.eb-portal-calc-days-input {
	width: 110px;
	padding: 8px 10px;
	font-size: 15px;
	font-weight: 500;
	text-align: center;
	border: 2px solid var(--eb-portal-border);
	border-radius: var(--eb-portal-radius);
	background: #fff;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.eb-portal-calc-days-input:focus {
	outline: none;
	border-color: var(--eb-portal-primary);
	box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.15);
}

.eb-portal-calc-days-input::placeholder {
	color: #9ca3af;
	font-weight: 400;
}

.eb-portal-calc-days-label {
	font-weight: 500;
	color: var(--eb-portal-text);
}

/* Fixed monthly calculation (no days input) */
.eb-portal-calculation-fixed {
	padding: 10px 16px;
	background: #f8fafc;
	border: 1px solid var(--eb-portal-border);
	border-radius: var(--eb-portal-radius);
}

.eb-portal-calc-fixed-label {
	font-weight: 500;
	color: var(--eb-portal-text-muted);
	margin-right: 8px;
}

/* Days-only calculation (no rate set) */
.eb-portal-calculation-days-only {
	padding: 10px 16px;
	background: #f8fafc;
	border: 1px solid var(--eb-portal-border);
	border-radius: var(--eb-portal-radius);
}

/* Custom monthly calculation (contractor enters amount) */
.eb-portal-calculation-custom {
	padding: 10px 16px;
	background: #f8fafc;
	border: 1px solid var(--eb-portal-border);
	border-radius: var(--eb-portal-radius);
}

.eb-portal-calc-amount-wrapper {
	display: flex;
	align-items: center;
	gap: 6px;
}

.eb-portal-calc-currency {
	font-size: 16px;
	font-weight: 600;
	color: var(--eb-portal-text);
}

.eb-portal-calc-amount-input {
	width: 140px;
	padding: 8px 10px;
	font-size: 15px;
	font-weight: 500;
	border: 1px solid var(--eb-portal-border);
	border-radius: var(--eb-portal-radius);
	background: #fff;
	text-align: right;
}

.eb-portal-calc-amount-input:focus {
	outline: none;
	border-color: var(--eb-portal-primary);
	box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.1);
}

.eb-portal-calc-amount-label {
	font-size: 13px;
	color: var(--eb-portal-text-muted);
	font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Issue Date
   ═══════════════════════════════════════════════════════════════════════════ */
.eb-portal-issue-date {
	margin-bottom: 16px;
}

.eb-portal-issue-date label {
	display: block;
	font-size: 0.85rem;
	font-weight: 600;
	color: #555;
	margin-bottom: 4px;
}

.eb-portal-issue-date input[type="date"] {
	padding: 8px 12px;
	border: 1px solid #ddd;
	border-radius: 6px;
	font-size: 0.95rem;
	color: #333;
	background: #fff;
}

.eb-portal-issue-date input[type="date"]:focus {
	outline: none;
	border-color: #c9a227;
	box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.15);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Extra Amount (Ad-hoc Payment)
   ═══════════════════════════════════════════════════════════════════════════ */
.eb-portal-extra-amount {
	margin-bottom: 16px;
}

.eb-portal-extra-toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	background: transparent;
	border: 1px dashed var(--eb-portal-border);
	border-radius: var(--eb-portal-radius);
	color: var(--eb-portal-muted);
	font-size: 13px;
	cursor: pointer;
	transition: all 0.2s ease;
}

.eb-portal-extra-toggle:hover {
	border-color: var(--eb-portal-primary);
	color: var(--eb-portal-primary);
}

.eb-portal-extra-toggle[aria-expanded="true"] {
	border-style: solid;
	border-color: var(--eb-portal-primary);
	color: var(--eb-portal-primary);
	background: rgba(26, 117, 255, 0.04);
}

.eb-portal-extra-toggle-icon {
	font-size: 16px;
	font-weight: 500;
	transition: transform 0.2s ease;
}

.eb-portal-extra-toggle[aria-expanded="true"] .eb-portal-extra-toggle-icon {
	transform: rotate(45deg);
}

.eb-portal-extra-fields {
	margin-top: 12px;
	padding: 16px;
	background: #f8fafc;
	border: 1px solid var(--eb-portal-border);
	border-radius: var(--eb-portal-radius);
}

.eb-portal-extra-row {
	display: flex;
	gap: 16px;
	flex-wrap: wrap;
}

.eb-portal-extra-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.eb-portal-extra-field label {
	font-size: 13px;
	font-weight: 500;
	color: var(--eb-portal-text);
}

.eb-portal-extra-field-desc {
	flex: 1;
	min-width: 200px;
}

.eb-portal-extra-input {
	padding: 8px 12px;
	border: 1px solid var(--eb-portal-border);
	border-radius: var(--eb-portal-radius);
	font-size: 14px;
	color: var(--eb-portal-text);
}

.eb-portal-extra-input:focus {
	outline: none;
	border-color: var(--eb-portal-primary);
	box-shadow: 0 0 0 3px rgba(26, 117, 255, 0.1);
}

.eb-portal-extra-input[name="extra_amount"] {
	width: 120px;
}

.eb-portal-extra-note {
	margin: 12px 0 0 0;
	font-size: 12px;
	color: var(--eb-portal-muted);
}

/* Submitted extra amount display */
.eb-portal-extra-submitted {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	margin-bottom: 12px;
	background: #eef2ff;
	border: 1px solid #c7d2fe;
	border-radius: var(--eb-portal-radius);
	font-size: 13px;
}

.eb-portal-extra-label {
	color: var(--eb-portal-muted);
}

.eb-portal-extra-value {
	font-weight: 600;
	color: #4338ca;
}

.eb-portal-extra-desc {
	color: var(--eb-portal-muted);
	font-style: italic;
}

/* Grand total (shown when extra amount exists) */
.eb-portal-grand-total,
.eb-portal-grand-total-preview {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	margin-bottom: 12px;
	background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
	border: 1px solid #f59e0b;
	border-radius: var(--eb-portal-radius);
	font-size: 14px;
}

.eb-portal-grand-total-label {
	color: #92400e;
	font-weight: 500;
}

.eb-portal-grand-total-value {
	font-weight: 700;
	color: #b45309;
	font-size: 15px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Files Row
   ═══════════════════════════════════════════════════════════════════════════ */
.eb-portal-files-row {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 16px;
}

/* Submitted files - display links */
.eb-portal-file-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	background: var(--eb-portal-bg);
	border: 1px solid var(--eb-portal-border);
	border-radius: var(--eb-portal-radius);
	color: var(--eb-portal-text);
	font-size: 13px;
	font-weight: 500;
	text-decoration: none;
	transition: all 0.2s;
}

.eb-portal-file-link:hover {
	background: #e5e7eb;
	text-decoration: none;
	color: var(--eb-portal-text);
}

.eb-portal-file-link .eb-portal-file-icon::before {
	font-size: 14px;
}

.eb-portal-file-invoice-link .eb-portal-file-icon::before {
	content: "📄";
}

.eb-portal-file-timesheet-link .eb-portal-file-icon::before {
	content: "📋";
}

/* Upload files row */
.eb-portal-files-upload {
	gap: 16px;
}

.eb-portal-file-upload-item {
	position: relative;
	flex: 1;
	min-width: 160px;
	max-width: 200px;
}

.eb-portal-file-upload-item input[type="file"] {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
	z-index: 2;
}

.eb-portal-file-upload-display {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 14px;
	background: #fff;
	border: 2px dashed var(--eb-portal-border);
	border-radius: var(--eb-portal-radius);
	cursor: pointer;
	transition: all 0.2s;
}

.eb-portal-file-upload-item:hover .eb-portal-file-upload-display {
	border-color: var(--eb-portal-primary);
	background: #fffdf0;
}

.eb-portal-file-upload-display .eb-portal-file-icon::before {
	content: "📎";
	font-size: 16px;
}

.eb-portal-file-label {
	flex: 1;
	font-size: 13px;
	color: var(--eb-portal-text-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.eb-portal-file-status {
	font-size: 12px;
	color: var(--eb-portal-text-muted);
}

/* Upload states */
.eb-portal-file-upload-item.uploading .eb-portal-file-upload-display {
	border-color: var(--eb-portal-info);
	background: #eff6ff;
	position: relative;
	overflow: hidden;
}

.eb-portal-file-upload-item.uploading .eb-portal-file-status {
	color: var(--eb-portal-info);
	font-weight: 500;
}

/* Progress bar inside upload item */
.eb-portal-file-upload-item.uploading .eb-portal-file-upload-display::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	height: 3px;
	background: var(--eb-portal-info);
	animation: eb-progress-pulse 1.5s ease-in-out infinite;
	width: 100%;
}

@keyframes eb-progress-pulse {

	0%,
	100% {
		opacity: 0.4;
	}

	50% {
		opacity: 1;
	}
}

/* Ready state (file selected, waiting for submit) */
.eb-portal-file-upload-item.ready .eb-portal-file-upload-display {
	border-color: var(--eb-portal-primary);
	border-style: solid;
	background: #fffdf0;
}

.eb-portal-file-upload-item.ready .eb-portal-file-label {
	color: var(--eb-portal-text);
	font-weight: 500;
}

.eb-portal-file-upload-item.ready .eb-portal-file-status {
	color: var(--eb-portal-primary-dark);
	font-weight: 500;
}

.eb-portal-file-upload-item.uploaded .eb-portal-file-upload-display {
	border-color: var(--eb-portal-success);
	border-style: solid;
	background: #ecfdf5;
}

.eb-portal-file-upload-item.uploaded .eb-portal-file-label {
	color: var(--eb-portal-success);
	font-weight: 500;
}

.eb-portal-file-upload-item.uploaded .eb-portal-file-status {
	color: var(--eb-portal-success);
}

.eb-portal-file-upload-item.error .eb-portal-file-upload-display {
	border-color: var(--eb-portal-danger);
	background: #fef2f2;
}

.eb-portal-file-upload-item.error .eb-portal-file-status {
	color: var(--eb-portal-danger);
}

/* ═══════════════════════════════════════════════════════════════════════════
   File Download Links (with loader)
   ═══════════════════════════════════════════════════════════════════════════ */
.eb-portal-file-download {
	position: relative;
	min-width: 100px;
}

.eb-portal-file-download.downloading {
	pointer-events: none;
	opacity: 0.8;
}

.eb-portal-file-loader {
	display: inline-block;
	width: 14px;
	height: 14px;
	border: 2px solid var(--eb-portal-border);
	border-top-color: var(--eb-portal-primary);
	border-radius: 50%;
	animation: eb-spin 0.8s linear infinite;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Button Spinner
   ═══════════════════════════════════════════════════════════════════════════ */
.eb-btn-spinner {
	display: inline-block;
	width: 14px;
	height: 14px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #ffffff;
	border-radius: 50%;
	animation: eb-spin 0.8s linear infinite;
	margin-right: 8px;
	vertical-align: middle;
}

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

/* No files message */
.eb-portal-no-files {
	color: var(--eb-portal-text-muted);
	font-size: 13px;
	font-style: italic;
	margin: 0 0 16px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Month Actions & Messages
   ═══════════════════════════════════════════════════════════════════════════ */
.eb-portal-month-actions {
	margin-top: 16px;
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.eb-portal-month-actions .eb-portal-btn {
	padding: 10px 20px;
	font-size: 14px;
}

.eb-portal-save-draft-hint {
	margin: 8px 0 0;
	font-size: 12px;
	color: #6b7280;
}

.eb-portal-month-message {
	margin-top: 12px;
	padding: 10px 14px;
	border-radius: var(--eb-portal-radius);
	font-size: 13px;
}

.eb-portal-month-message.success {
	background: #ecfdf5;
	color: var(--eb-portal-success);
	border: 1px solid var(--eb-portal-success);
}

.eb-portal-month-message.error {
	background: #fef2f2;
	color: var(--eb-portal-danger);
	border: 1px solid var(--eb-portal-danger);
}

/* Submitted month display */
.eb-portal-month-submitted {
	padding: 4px 0;
}

/* Revision notice */
.eb-portal-revision-notice {
	background: #fef3c7;
	padding: 12px 14px;
	border-radius: var(--eb-portal-radius);
	margin-bottom: 16px;
	font-size: 13px;
	color: #92400e;
}

.eb-portal-revision-notice strong {
	color: #78350f;
}

/* Draft notice — neutral/grey, distinct from the amber revision notice. */
.eb-portal-draft-notice {
	background: #f3f4f6;
	padding: 12px 14px;
	border-radius: var(--eb-portal-radius);
	margin-bottom: 16px;
	font-size: 13px;
	color: #374151;
	border-left: 3px solid #9ca3af;
}

.eb-portal-draft-notice strong {
	color: #1f2937;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Badges
   ═══════════════════════════════════════════════════════════════════════════ */
.eb-badge {
	display: inline-block;
	padding: 4px 10px;
	font-size: 12px;
	font-weight: 500;
	border-radius: 20px;
	background: #e5e7eb;
	color: #374151;
}

/* Month header badges container */
.eb-portal-month-badges {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
	flex-shrink: 0;
}

.eb-badge-success {
	background: #d1fae5;
	color: #065f46;
}

.eb-badge-warning {
	background: #fef3c7;
	color: #92400e;
}

.eb-badge-danger {
	background: #fee2e2;
	color: #991b1b;
}

.eb-badge-info {
	background: #dbeafe;
	color: #1e40af;
}

.eb-badge-draft {
	background: #e5e7eb;
	color: #4b5563;
	border: 1px dashed #9ca3af;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
	.eb-portal {
		padding: 16px;
	}

	.eb-portal-header {
		flex-direction: column;
		gap: 16px;
		text-align: center;
	}

	.eb-portal-header-actions {
		flex-direction: column;
		width: 100%;
		gap: 10px;
	}

	.eb-portal-contractor-select {
		width: 100%;
		min-width: unset;
	}

	.eb-portal-logout {
		width: 100%;
		text-align: center;
	}

	.eb-portal-engagement-header {
		padding: 16px;
	}

	.eb-portal-engagement-chain {
		font-size: 13px !important;
	}

	.eb-portal-engagement-content {
		padding: 0 16px 16px;
	}

	.eb-portal-calculation {
		gap: 8px;
		font-size: 14px;
	}

	.eb-portal-calc-days-input {
		width: 100px;
		padding: 6px 8px;
		font-size: 14px;
	}

	.eb-portal-calc-amount-input {
		width: 120px;
		padding: 6px 8px;
		font-size: 14px;
	}

	.eb-portal-files-row {
		flex-direction: column;
	}

	.eb-portal-file-upload-item {
		max-width: none;
	}

	.eb-portal-extra-row {
		flex-direction: column;
	}

	.eb-portal-extra-field-desc {
		min-width: unset;
	}

	.eb-portal-extra-input[name="extra_amount"] {
		width: 100%;
	}
}

/* ═══════════════════════════════════════════════════════════════════════════
   Signed Timesheet Upload Section
   ═══════════════════════════════════════════════════════════════════════════ */

.eb-portal-signed-upload {
	margin-top: 20px;
	padding-top: 20px;
	border-top: 1px solid var(--eb-portal-border);
}

.eb-portal-signed-upload h4 {
	margin: 0 0 8px 0;
	font-size: 14px;
	font-weight: 600;
	color: var(--eb-portal-text);
}

.eb-portal-signed-hint {
	margin: 0 0 16px 0;
	font-size: 13px;
	color: var(--eb-portal-muted);
}

.eb-portal-signed-form {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.eb-portal-signed-form .eb-portal-file-upload-item {
	max-width: 300px;
}

.eb-portal-signed-actions {
	margin-top: 4px;
}

.eb-portal-signed-message {
	padding: 10px 14px;
	border-radius: 4px;
	font-size: 13px;
}

.eb-portal-signed-message.success {
	background: #ecfdf5;
	color: var(--eb-portal-success);
}

.eb-portal-signed-message.error {
	background: #fef2f2;
	color: var(--eb-portal-danger);
}

/* Signed timesheet link styling */
.eb-portal-file-signed-link .eb-portal-file-icon::before {
	content: "✍️" !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Combined Invoice Mode
   ═══════════════════════════════════════════════════════════════════════════ */

.eb-portal-combined-mode {
	margin-bottom: 20px;
}

.eb-portal-combined-toggle {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 20px;
	background: var(--eb-portal-bg-card);
	border: 1px solid var(--eb-portal-border);
	border-radius: var(--eb-portal-radius);
	box-shadow: var(--eb-portal-shadow);
}

.eb-portal-toggle-label {
	display: flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
	font-weight: 600;
	font-size: 15px;
	color: var(--eb-portal-text);
	margin: 0;
}

.eb-portal-toggle-input {
	display: none;
}

.eb-portal-toggle-switch {
	position: relative;
	width: 44px;
	height: 24px;
	background: #d1d5db;
	border-radius: 12px;
	transition: background 0.2s;
	flex-shrink: 0;
}

.eb-portal-toggle-switch::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 20px;
	height: 20px;
	background: #fff;
	border-radius: 50%;
	transition: transform 0.2s;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.eb-portal-toggle-input:checked + .eb-portal-toggle-switch {
	background: var(--eb-portal-primary);
}

.eb-portal-toggle-input:checked + .eb-portal-toggle-switch::after {
	transform: translateX(20px);
}

.eb-portal-combined-hint {
	font-size: 13px;
	color: var(--eb-portal-text-muted);
}

.eb-portal-combined-panel {
	margin-top: 12px;
	padding: 20px;
	background: var(--eb-portal-bg-card);
	border: 2px solid var(--eb-portal-primary);
	border-radius: var(--eb-portal-radius);
	box-shadow: var(--eb-portal-shadow);
}

.eb-portal-combined-month-select {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 16px;
}

.eb-portal-combined-month-select label {
	font-weight: 600;
	font-size: 14px;
	color: var(--eb-portal-text);
}

.eb-portal-combined-month-dropdown {
	padding: 8px 12px;
	border: 1px solid var(--eb-portal-border);
	border-radius: 6px;
	font-size: 14px;
	background: #fff;
	color: var(--eb-portal-text);
}

.eb-portal-combined-engagements {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-bottom: 16px;
}

.eb-portal-combined-row {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	background: var(--eb-portal-bg);
	border: 1px solid var(--eb-portal-border);
	border-radius: 6px;
}

.eb-combined-eng-name {
	flex: 1;
	font-size: 14px;
	font-weight: 500;
	color: var(--eb-portal-text);
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.eb-combined-eng-input {
	flex-shrink: 0;
}

.eb-combined-input-group {
	display: flex;
	align-items: center;
	gap: 6px;
}

.eb-combined-days-input,
.eb-combined-amount-input {
	width: 80px;
	padding: 6px 10px;
	border: 1px solid var(--eb-portal-border);
	border-radius: 4px;
	font-size: 14px;
	text-align: right;
	background: #fff;
}

.eb-combined-days-input:focus,
.eb-combined-amount-input:focus {
	border-color: var(--eb-portal-primary);
	outline: none;
	box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.15);
}

/* Read-only value box for submitted combined rows — same footprint as the
   editable input (.eb-combined-days-input/.eb-combined-amount-input), greyed. */
.eb-combined-readonly-value {
	display: inline-block;
	min-width: 80px;
	padding: 6px 10px;
	border: 1px solid var(--eb-portal-border);
	border-radius: 4px;
	font-size: 14px;
	text-align: right;
	background: #f3f4f6;
	color: var(--eb-portal-text-muted);
}

/* Plain read-only calc for submitted day-based rows ("N d × €rate") — kept
   unboxed by design, just sized to match the rest of the row (not theme default). */
.eb-combined-readonly-calc {
	font-size: 14px;
	color: var(--eb-portal-text);
	white-space: nowrap;
}

.eb-combined-currency {
	font-size: 14px;
	color: var(--eb-portal-text-muted);
	font-weight: 500;
}

.eb-combined-rate-label {
	font-size: 13px;
	color: var(--eb-portal-text-muted);
	white-space: nowrap;
}

.eb-combined-fixed {
	font-size: 13px;
	color: var(--eb-portal-text-muted);
	font-style: italic;
}

/* Pre-filled from billing period indicator (yellow, matching billing v2 style) */
.eb-combined-prefilled {
	background: #fef3c7;
	border-color: #fcd34d;
	border-style: dashed;
}

span.eb-combined-prefilled {
	padding: 2px 8px;
	border: 1px dashed #fcd34d;
	border-radius: 4px;
	cursor: help;
}

/* Saved-draft value in combined mode — grey dashed, distinct from amber prefill. */
.eb-combined-draft {
	background: #f3f4f6;
	border-color: #9ca3af;
	border-style: dashed;
}

span.eb-combined-draft {
	padding: 2px 8px;
	border: 1px dashed #9ca3af;
	border-radius: 4px;
	cursor: help;
}

/* Inherited "consultant's days" default — subtle blue, distinct from grey draft + amber prefill.
   The value is rendered MUTED + ITALIC so it reads as a suggestion, not a saved entry;
   JS un-mutes it the moment the contractor edits. */
.eb-combined-inherited {
	background: #eff6ff;
	border-color: #93c5fd;
	border-style: dashed;
	color: #6b7280;
}

/* Standard-form days field seeded from the inherited default. */
.eb-portal-days-inherited {
	background: #eff6ff;
	color: #6b7280;
}

/* "suggested" chip — marks an inferred (not stored) value, visible without hover. */
.eb-suggested-tag {
	display: inline-block;
	margin: 0 4px;
	padding: 0 6px;
	background: #dbeafe;
	color: #1e40af;
	border-radius: 10px;
	font-size: 10px;
	font-weight: 600;
	font-style: normal;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	vertical-align: middle;
}

/* Standard-form helper line under a suggested days field. */
.eb-portal-suggested-hint {
	margin: 6px 0 0;
	font-size: 12px;
	color: #6b7280;
}

/* Combined-mode legend explaining the prefill colours. */
.eb-combined-legend {
	margin: 10px 0 0;
	font-size: 11px;
	color: #6b7280;
	display: flex;
	gap: 14px;
	flex-wrap: wrap;
}

.eb-combined-legend .eb-legend-swatch {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 2px;
	margin-right: 4px;
	vertical-align: middle;
	border: 1px dashed transparent;
}

.eb-combined-legend .eb-legend-suggested {
	background: #eff6ff;
	border-color: #93c5fd;
}

.eb-combined-legend .eb-legend-draft {
	background: #f3f4f6;
	border-color: #9ca3af;
}

.eb-combined-eng-total {
	min-width: 90px;
	text-align: right;
	font-size: 14px;
	font-weight: 600;
	color: var(--eb-portal-text);
}

.eb-portal-combined-total-row {
	display: flex;
	justify-content: flex-end;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	margin-bottom: 16px;
	background: #fefce8;
	border: 1px solid #fde68a;
	border-radius: 6px;
}

.eb-portal-combined-total-label {
	font-size: 15px;
	font-weight: 600;
	color: var(--eb-portal-text);
}

.eb-portal-combined-total-value {
	font-size: 18px;
	font-weight: 700;
	color: var(--eb-portal-primary-dark);
}

.eb-portal-combined-invoice-upload {
	margin-bottom: 16px;
}

.eb-portal-combined-invoice-upload .eb-portal-file-upload-item {
	max-width: 400px;
}

.eb-portal-combined-actions {
	display: flex;
	gap: 10px;
}

.eb-portal-combined-message {
	margin-top: 12px;
	padding: 10px 14px;
	border-radius: 4px;
	font-size: 13px;
}

.eb-portal-combined-message.success {
	background: #ecfdf5;
	color: var(--eb-portal-success);
}

.eb-portal-combined-message.error {
	background: #fef2f2;
	color: var(--eb-portal-danger);
}

.eb-portal-combined-empty {
	padding: 12px;
	text-align: center;
	color: var(--eb-portal-text-muted);
	font-style: italic;
}

/* Hide individual engagement cards when combined mode is active */
.eb-portal-engagement.eb-combined-active {
	display: none;
}

@media (max-width: 600px) {
	.eb-portal-combined-row {
		flex-direction: column;
		align-items: stretch;
		gap: 8px;
	}

	.eb-combined-eng-name {
		white-space: normal;
	}

	.eb-combined-eng-total {
		text-align: left;
	}

	.eb-portal-combined-total-row {
		flex-direction: column;
		align-items: flex-start;
		gap: 4px;
	}
}