/* ===== PORTAL ===== */
.portal-body {
    background: var(--gray-50);
    min-height: 100vh;
}

/* ===== LOGIN ===== */
.portal-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--navy-deep) 0%, var(--navy) 50%, var(--teal) 100%);
    padding: 24px;
}
.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-xl);
}
.logo-centered {
    justify-content: center;
    margin-bottom: 32px;
}
.login-card h1 {
    font-family: var(--font-display);
    font-size: 28px;
    color: var(--navy);
    text-align: center;
    margin-bottom: 8px;
}
.login-subtitle {
    font-size: 14px;
    color: var(--gray-500);
    text-align: center;
    margin-bottom: 28px;
    line-height: 1.5;
}
.password-wrapper {
    position: relative;
}
.password-wrapper input {
    padding-right: 44px;
}
.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--gray-500);
}
.password-toggle svg { width: 20px; height: 20px; }
.login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 13px;
}
.checkbox-label-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--gray-700);
}
.checkbox-label-inline input { accent-color: var(--teal); }
.forgot-link {
    color: var(--teal);
    font-weight: 500;
}
.forgot-link:hover { text-decoration: underline; }
.login-error {
    margin-top: 12px;
    padding: 10px 14px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    border-radius: var(--radius);
    font-size: 13px;
    text-align: center;
}
.login-footer {
    margin-top: 28px;
    text-align: center;
    font-size: 13px;
    color: var(--gray-500);
}
.login-footer a { color: var(--teal); font-weight: 500; }
.login-footer a:hover { text-decoration: underline; }
.back-link {
    display: block;
    margin-top: 12px;
}

/* ===== PORTAL NAV ===== */
.portal-nav {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
}
.portal-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
}
.logo-mark-sm { padding: 6px 8px; }
.logo-mark-sm .logo-e,
.logo-mark-sm .logo-w,
.logo-mark-sm .logo-m { font-size: 18px; }
.portal-nav-right {
    display: flex;
    align-items: center;
    gap: 24px;
}
.portal-nav-label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--teal);
}
.portal-user {
    display: flex;
    align-items: center;
    gap: 12px;
}
.portal-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--navy) 0%, var(--teal) 100%);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}
.portal-user-info {
    display: flex;
    flex-direction: column;
}
.portal-user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--navy);
}
.portal-user-property {
    font-size: 12px;
    color: var(--gray-500);
}
.btn-logout {
    background: none;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 8px;
    cursor: pointer;
    color: var(--gray-500);
    transition: all 0.2s;
}
.btn-logout:hover { color: #dc2626; border-color: #dc2626; }
.btn-logout svg { width: 18px; height: 18px; }

/* ===== PORTAL CONTENT ===== */
.portal-content {
    padding: 32px 0 60px;
}

/* Welcome */
.portal-welcome {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 32px;
}
.portal-welcome h1 {
    font-family: var(--font-display);
    font-size: 28px;
    color: var(--navy);
    margin-bottom: 4px;
}
.portal-welcome p {
    color: var(--gray-500);
    font-size: 15px;
}
.portal-date {
    font-size: 14px;
    color: var(--gray-500);
    background: var(--white);
    padding: 8px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}
.summary-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--gray-200);
}
.summary-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.summary-icon svg { width: 24px; height: 24px; }
.summary-icon-pending { background: #fef3c7; color: #d97706; }
.summary-icon-approved { background: #d1fae5; color: #059669; }
.summary-icon-question { background: #dbeafe; color: #2563eb; }
.summary-icon-total { background: #ede9fe; color: #7c3aed; }
.summary-number {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.2;
}
.summary-label {
    font-size: 13px;
    color: var(--gray-500);
}

/* Tabs */
.portal-tabs {
    display: flex;
    gap: 4px;
    background: var(--white);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border: 1px solid var(--gray-200);
    border-bottom: none;
    padding: 4px 4px 0;
}
.portal-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-500);
    background: none;
    border: none;
    cursor: pointer;
    border-radius: var(--radius) var(--radius) 0 0;
    transition: all 0.2s;
    position: relative;
}
.portal-tab svg { width: 18px; height: 18px; }
.portal-tab.active {
    color: var(--navy);
    background: var(--gray-50);
}
.portal-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--teal);
}
.portal-tab:hover:not(.active) {
    color: var(--navy);
    background: var(--gray-100);
}
.tab-badge {
    background: #dc2626;
    color: var(--white);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    line-height: 1.3;
}

/* Tab Panels */
.tab-panel {
    display: none;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 24px;
}
.tab-panel.active { display: block; }
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.panel-header h2 {
    font-family: var(--font-display);
    font-size: 20px;
    color: var(--navy);
}
.filter-select {
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--gray-700);
    background: var(--white);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236c757d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
}

/* Invoice List */
.invoice-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto auto;
    gap: 16px;
    align-items: center;
    padding: 16px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.invoice-item:hover {
    border-color: var(--teal);
    box-shadow: var(--shadow-sm);
    background: var(--gray-50);
}
.invoice-id {
    font-weight: 700;
    font-size: 14px;
    color: var(--navy);
    white-space: nowrap;
}
.invoice-detail {
    display: flex;
    flex-direction: column;
}
.invoice-period {
    font-size: 14px;
    color: var(--gray-700);
}
.invoice-property {
    font-size: 12px;
    color: var(--gray-500);
}
.invoice-amount {
    font-weight: 700;
    font-size: 16px;
    color: var(--navy);
    text-align: right;
}
.invoice-due {
    font-size: 12px;
    color: var(--gray-500);
    text-align: right;
    white-space: nowrap;
}
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.status-pending { background: #fef3c7; color: #92400e; }
.status-approved { background: #d1fae5; color: #065f46; }
.status-question { background: #dbeafe; color: #1e40af; }
.status-paid { background: #e0e7ff; color: #3730a3; }

/* Proposal Items */
.proposal-item {
    padding: 20px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.proposal-info h3 {
    font-size: 16px;
    color: var(--navy);
    margin-bottom: 4px;
}
.proposal-info p {
    font-size: 13px;
    color: var(--gray-500);
}
.proposal-actions {
    display: flex;
    gap: 8px;
}

/* Message Items */
.message-item {
    padding: 20px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 8px;
}
.message-item.unread {
    border-left: 3px solid var(--teal);
    background: rgba(42,107,124,0.03);
}
.message-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 8px;
}
.message-subject {
    font-weight: 600;
    font-size: 15px;
    color: var(--navy);
}
.message-date {
    font-size: 12px;
    color: var(--gray-500);
    white-space: nowrap;
}
.message-body {
    font-size: 14px;
    color: var(--gray-500);
    line-height: 1.6;
}
.message-ref {
    font-size: 12px;
    color: var(--teal);
    margin-top: 8px;
    font-weight: 500;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    max-width: 680px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    position: relative;
}
.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: var(--gray-100);
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    transition: all 0.2s;
    z-index: 1;
}
.modal-close:hover { background: var(--gray-200); color: var(--navy); }
.modal-header {
    padding: 28px 28px 0;
}
.modal-header h2 {
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--navy);
    margin-bottom: 8px;
}
.modal-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.modal-body { padding: 24px 28px; }
.modal-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 28px;
    padding: 20px;
    background: var(--gray-50);
    border-radius: var(--radius);
}
.meta-label {
    display: block;
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 2px;
}
.meta-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--navy);
}
.meta-total {
    font-size: 20px;
    color: var(--teal);
}
.modal-section-title {
    font-family: var(--font-display);
    font-size: 16px;
    color: var(--navy);
    margin-bottom: 12px;
}

/* Line Items */
.line-items {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
}
.line-item-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 8px;
    padding: 10px 16px;
    background: var(--navy);
    color: var(--white);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.line-item-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 8px;
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--gray-100);
}
.line-item-row:last-child { border-bottom: none; }
.line-item-row:hover { background: var(--gray-50); }
.line-item-row span:last-child {
    font-weight: 600;
    text-align: right;
}

/* Summary */
.modal-summary {
    border-top: 2px solid var(--gray-200);
    padding-top: 16px;
}
.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    color: var(--gray-700);
}
.summary-total {
    font-size: 18px;
    font-weight: 700;
    color: var(--navy);
    padding-top: 12px;
    border-top: 2px solid var(--navy);
    margin-top: 8px;
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 12px;
    padding: 20px 28px 28px;
}
.btn-approve {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    background: #059669;
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-approve:hover { background: #047857; transform: translateY(-1px); }
.btn-approve svg { width: 20px; height: 20px; }
.btn-question {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    background: var(--white);
    color: var(--navy);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-question:hover { border-color: var(--teal); color: var(--teal); }
.btn-question svg { width: 20px; height: 20px; }

/* Question Form */
.modal-question-form {
    padding: 0 28px 28px;
    border-top: 1px solid var(--gray-200);
    margin-top: -8px;
    padding-top: 20px;
}
.modal-question-form h3 {
    font-family: var(--font-display);
    font-size: 17px;
    color: var(--navy);
    margin-bottom: 16px;
}
.question-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}
.btn-outline-dark {
    padding: 12px 24px;
    background: var(--white);
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.btn-outline-dark:hover { border-color: var(--gray-500); }

/* Confirmation */
.modal-confirmation {
    text-align: center;
    padding: 40px 28px 48px;
}
.confirmation-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
}
.confirmation-icon svg { width: 100%; height: 100%; }
.confirmation-icon.icon-approved { color: #059669; }
.confirmation-icon.icon-question { color: #2563eb; }
.modal-confirmation h3 {
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--navy);
    margin-bottom: 8px;
}
.modal-confirmation p {
    color: var(--gray-500);
    font-size: 15px;
}

/* ===== PORTAL FOOTER ===== */
.portal-footer {
    text-align: center;
    padding: 24px;
    font-size: 12px;
    color: var(--gray-500);
    letter-spacing: 0.5px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .login-card { padding: 32px 24px; }
    .portal-nav-label { display: none; }
    .portal-user-info { display: none; }
    .summary-cards { grid-template-columns: repeat(2, 1fr); }
    .portal-tabs { overflow-x: auto; }
    .invoice-item { grid-template-columns: 1fr auto; gap: 8px; }
    .invoice-detail, .invoice-due { display: none; }
    .modal-meta { grid-template-columns: 1fr; }
    .line-item-header, .line-item-row { grid-template-columns: 1.5fr 1fr 1fr; }
    .line-item-header span:nth-child(2), .line-item-row span:nth-child(2) { display: none; }
    .modal-actions { flex-direction: column; }
    .portal-welcome { flex-direction: column; gap: 12px; }
}

@media (max-width: 480px) {
    .summary-cards { grid-template-columns: 1fr; }
    .portal-tab span:not(.tab-badge) { display: none; }
}
