/* Agency Core - Client Portal Styles */
:root {
	--ag-primary: #2563eb;
	--ag-primary-dark: #1d4ed8;
	--ag-success: #16a34a;
	--ag-warning: #f59e0b;
	--ag-danger: #ef4444;
	--ag-purple: #7c3aed;
	--ag-gray: #94a3b8;
	--ag-text: #334155;
	--ag-text-light: #64748b;
	--ag-bg: #f8fafc;
	--ag-border: #e2e8f0;
	--ag-radius: 12px;
}

/* Portal Wrapper */
.ag-portal-wrap { max-width: 960px; margin: 0 auto; padding: 24px 16px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: var(--ag-text); }
.ag-portal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.ag-portal-header h2 { margin: 0; font-size: 24px; font-weight: 800; }
.ag-portal-section { margin-bottom: 32px; }
.ag-portal-section h3 { margin: 0 0 16px; font-size: 18px; font-weight: 700; }
.ag-portal-notice { padding: 16px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: var(--ag-radius); }
.ag-portal-notice a { color: var(--ag-primary); font-weight: 600; }
.ag-empty { text-align: center; padding: 48px 16px; color: var(--ag-text-light); font-size: 15px; }
.ag-error { text-align: center; padding: 24px; background: #fef2f2; border: 1px solid #fecaca; border-radius: var(--ag-radius); color: var(--ag-danger); }

/* Buttons */
.ag-btn { display: inline-block; padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; border: none; transition: all .2s; text-align: center; line-height: 1.4; }
.ag-btn-primary { background: var(--ag-primary); color: #fff; }
.ag-btn-primary:hover { background: var(--ag-primary-dark); color: #fff; }
.ag-btn-outline { background: #fff; color: var(--ag-primary); border: 2px solid var(--ag-primary); }
.ag-btn-outline:hover { background: var(--ag-primary); color: #fff; }
.ag-btn-sm { padding: 6px 14px; font-size: 13px; }
.ag-btn-block { display: block; width: 100%; }
.ag-btn-pay { background: var(--ag-primary); color: #fff; padding: 12px 24px; font-size: 15px; margin-top: 12px; }
.ag-btn-pay:hover { opacity: .9; color: #fff; }

/* Login */
.ag-login-card { max-width: 420px; margin: 40px auto; background: #fff; border-radius: var(--ag-radius); box-shadow: 0 4px 20px rgba(0,0,0,.08); overflow: hidden; }
.ag-login-header { background: var(--ag-primary); padding: 24px; text-align: center; }
.ag-login-header h2 { color: #fff; margin: 0; font-size: 22px; }
.ag-login-header p { color: rgba(255,255,255,.8); margin: 4px 0 0; font-size: 14px; }
.ag-login-form { padding: 24px; }
.ag-form-field { margin-bottom: 16px; }
.ag-form-field label { display: block; font-size: 13px; font-weight: 600; color: var(--ag-text); margin-bottom: 6px; }
.ag-input { width: 100%; padding: 10px 14px; border: 2px solid var(--ag-border); border-radius: 8px; font-size: 14px; transition: border-color .2s; box-sizing: border-box; }
.ag-input:focus { border-color: var(--ag-primary); outline: none; }
.ag-login-status { margin-bottom: 12px; font-size: 13px; }
.ag-login-status .error { color: var(--ag-danger); }
.ag-login-status .success { color: var(--ag-success); }

/* Dashboard Cards */
.ag-dashboard-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.ag-dash-card { background: #fff; border: 1px solid var(--ag-border); border-radius: var(--ag-radius); padding: 20px; text-align: center; }
.ag-dash-card-highlight { border-color: var(--ag-danger); background: #fef2f2; }
.ag-dash-icon { font-size: 28px; display: block; margin-bottom: 4px; }
.ag-dash-label { font-size: 12px; color: var(--ag-text-light); display: block; }
.ag-dash-value { font-size: 20px; font-weight: 800; color: var(--ag-text); display: block; margin-top: 4px; }

/* Tables */
.ag-table-wrap { overflow-x: auto; }
.ag-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--ag-radius); overflow: hidden; border: 1px solid var(--ag-border); }
.ag-table thead th { background: var(--ag-bg); padding: 12px 14px; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--ag-text-light); text-align: left; border-bottom: 2px solid var(--ag-border); white-space: nowrap; }
.ag-table tbody td { padding: 12px 14px; font-size: 14px; border-bottom: 1px solid #f1f5f9; }
.ag-table tbody tr:last-child td { border-bottom: none; }
.ag-table tbody tr:hover { background: #f8fafc; }

/* Status Badges */
.ag-status-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.ag-status-draft { background: #f1f5f9; color: var(--ag-gray); }
.ag-status-sent { background: #fef3c7; color: #92400e; }
.ag-status-paid { background: #dcfce7; color: #166534; }
.ag-status-overdue { background: #fef2f2; color: #991b1b; }
.ag-status-cancelled { background: #f1f5f9; color: var(--ag-gray); }
.ag-status-partial { background: #f3e8ff; color: #6b21a8; }
.ag-status-active { background: #dcfce7; color: #166534; }
.ag-status-pending { background: #fef3c7; color: #92400e; }
.ag-status-suspended { background: #fef2f2; color: #991b1b; }
.ag-status-completed { background: #dbeafe; color: #1e40af; }

.ag-text-danger { color: var(--ag-danger) !important; font-weight: 700; }

/* Invoice Detail */
.ag-invoice-detail { background: #fff; border: 1px solid var(--ag-border); border-radius: var(--ag-radius); overflow: hidden; }
.ag-inv-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--ag-border); flex-wrap: wrap; gap: 12px; }
.ag-inv-header h2 { margin: 0 8px 0 0; font-size: 20px; display: inline; }
.ag-inv-actions { display: flex; gap: 8px; }
.ag-inv-meta-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 20px 24px; background: var(--ag-bg); }
.ag-inv-meta-grid > div span { font-size: 12px; color: var(--ag-text-light); display: block; }
.ag-inv-meta-grid > div strong { font-size: 15px; display: block; margin-top: 2px; }
.ag-inv-totals { padding: 16px 24px; }
.ag-inv-total-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; max-width: 320px; margin-left: auto; }
.ag-inv-grand-total { font-size: 18px; font-weight: 900; color: var(--ag-primary); border-top: 2px solid var(--ag-primary); padding-top: 12px; margin-top: 8px; }
.ag-inv-payment { padding: 20px 24px; background: var(--ag-bg); border-top: 1px solid var(--ag-border); }
.ag-inv-payment h4 { margin: 0 0 12px; }
.ag-inv-notes { padding: 16px 24px; font-size: 13px; color: var(--ag-text-light); border-top: 1px solid var(--ag-border); }

/* Payment Bank Items */
.ag-payment-bank h4 { margin: 0 0 8px; font-size: 14px; }
.ag-bank-list { display: flex; flex-direction: column; gap: 6px; }
.ag-bank-item { padding: 10px 14px; background: #fff; border: 1px solid var(--ag-border); border-radius: 8px; font-size: 13px; font-weight: 600; }
.ag-payment-note { margin: 12px 0 0; font-size: 12px; color: var(--ag-text-light); }

/* Profile */
.ag-profile-card { background: #fff; border: 1px solid var(--ag-border); border-radius: var(--ag-radius); padding: 24px; }
.ag-profile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.ag-profile-item span { font-size: 12px; color: var(--ag-text-light); display: block; }
.ag-profile-item strong { font-size: 15px; display: block; margin-top: 2px; }
.ag-profile-full { grid-column: 1 / -1; }
.ag-profile-note { margin: 16px 0 0; font-size: 13px; color: var(--ag-text-light); }

/* Responsive */
@media (max-width: 640px) {
	.ag-dashboard-cards { grid-template-columns: repeat(2, 1fr); }
	.ag-inv-meta-grid { grid-template-columns: 1fr; }
	.ag-profile-grid { grid-template-columns: 1fr; }
	.ag-portal-header { flex-direction: column; align-items: flex-start; }
}
