/* ============================================================
   Blue Oak Credit — Customer Service Portal Styles
   Design tokens, layout shell, and component styles.
   ============================================================ */

/* ---------- Design Tokens ---------- */
:root {
    --accent:        #1D3A8F;
    --blue:          #2563EB;
    --blue-700:      #1E40AF;
    --blue-soft:     #EAF0FA;
    --blue-soft-2:   #F2F6FD;
    --green:         #16A34A;
    --green-soft:    #E7F6EC;
    --amber:         #B45309;
    --amber-soft:    #FBF0DD;
    --ink:           #16224A;
    --text:          #243049;
    --muted:         #647089;
    --faint:         #8A94A8;
    --page:          #F4F7FB;
    --surface:       #FFFFFF;
    --header:        #ECEFF4;
    --border:        #E4E9F1;
    --border-strong: #D6DEEA;
    --hover:         #F5F8FC;
    --r-card:        16px;
    --r-md:          12px;
    --r-sm:          10px;
    --pad:           28px;
    --shadow-card:   0 1px 2px rgba(16,24,40,.04), 0 10px 26px rgba(23,42,80,.06);
    --shadow-modal:  0 12px 34px rgba(23,42,80,.16);
}

/* ---------- Base ---------- */
body.portal-body {
    font-family: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--page);
    margin: 0;
}

/* ---------- App Shell ---------- */
.portal-shell {
    display: flex;
    min-height: calc(100vh - 64px);
}

/* ---------- Top Bar ---------- */
.portal-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 64px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    justify-content: space-between;
}

.portal-topbar-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.portal-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

/* ---------- Sidebar ---------- */
.portal-sidebar {
    width: 252px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 16px 0;
}

.portal-sidebar-logo {
    padding: 8px 20px 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.portal-nav {
    flex: 1;
    padding: 0 10px;
}

.portal-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 11px;
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background .14s, color .14s;
    margin-bottom: 2px;
}

.portal-nav-link:hover {
    background: var(--hover);
    color: var(--text);
}

.portal-nav-link.active {
    background: var(--blue-soft);
    color: var(--blue-700);
    font-weight: 600;
}

.portal-nav-link .nav-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: .7;
}

.portal-nav-link.active .nav-icon {
    opacity: 1;
    color: var(--blue);
}

.portal-sidebar-cta {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}

.portal-sidebar-footer {
    padding: 12px 20px;
    font-size: 12px;
    color: var(--faint);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ---------- Main Content ---------- */
.portal-main {
    flex: 1;
    min-width: 0;
    padding: 28px 32px 48px;
    max-width: 1080px;
    margin: 0 auto;
    width: 100%;
}

/* ---------- Typography ---------- */
.portal-greeting {
    font-size: 27px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}

.portal-subline {
    font-size: 15px;
    color: var(--muted);
    margin-bottom: 24px;
}

.eyebrow {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--faint);
    margin-bottom: 6px;
}

.big-number {
    font-size: 36px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.big-number-sm {
    font-size: 30px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 0;
}

.label-text {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--muted);
}

/* ---------- Portal Cards ---------- */
.portal-card {
    background: var(--surface);
    border-radius: var(--r-card);
    box-shadow: var(--shadow-card);
    padding: var(--pad);
    margin-bottom: 18px;
}

.portal-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.portal-card-header a {
    font-size: 13.5px;
    color: var(--blue);
    text-decoration: none;
    font-weight: 500;
}

.portal-card-header a:hover {
    text-decoration: underline;
}

/* Blue gradient card (next payment) */
.portal-card-blue {
    background: linear-gradient(135deg, #EAF0FA 0%, #F2F6FD 100%);
    border: 1px solid var(--blue-soft);
}

/* ---------- Dashboard Grid ---------- */
.portal-dash-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 18px;
    margin-bottom: 18px;
}

/* ---------- Progress Bar ---------- */
.portal-progress-wrap {
    margin: 16px 0 12px;
}

.portal-progress-bar {
    height: 8px;
    border-radius: 99px;
    background: var(--border);
    overflow: hidden;
}

.portal-progress-fill {
    height: 100%;
    border-radius: 99px;
    background: var(--green);
    transition: width .4s;
}

.portal-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12.5px;
    color: var(--muted);
    margin-top: 6px;
}

/* ---------- Stat Row ---------- */
.stat-row {
    display: flex;
    gap: 0;
    border-top: 1px solid var(--border);
    margin-top: 16px;
    padding-top: 16px;
}

.stat-item {
    flex: 1;
    padding-right: 16px;
    border-right: 1px solid var(--border);
    margin-right: 16px;
}

.stat-item:last-child {
    border-right: none;
    margin-right: 0;
    padding-right: 0;
}

.stat-label {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--faint);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
}

/* ---------- Autopay Chip ---------- */
.autopay-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--green-soft);
    color: var(--green);
    border-radius: 99px;
    font-size: 12.5px;
    font-weight: 600;
    padding: 5px 12px;
    margin: 12px 0;
}

/* ---------- Badges ---------- */
.portal-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    letter-spacing: 0.01em;
}

.portal-badge-current {
    background: var(--blue-soft);
    color: var(--blue-700);
}

.portal-badge-approved {
    background: var(--green-soft);
    color: var(--green);
}

.portal-badge-paid {
    background: var(--green-soft);
    color: var(--green);
}

.portal-badge-upcoming {
    background: var(--amber-soft);
    color: var(--amber);
}

.portal-badge-scheduled {
    background: var(--header);
    color: var(--muted);
}

/* ---------- Quick Actions ---------- */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

.quick-action-card {
    background: var(--surface);
    border-radius: var(--r-card);
    box-shadow: var(--shadow-card);
    padding: 18px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow .14s, border-color .14s, transform .1s;
    border: 1px solid transparent;
    cursor: pointer;
}

.quick-action-card:hover {
    box-shadow: var(--shadow-card), 0 0 0 2px var(--blue);
    transform: translateY(-1px);
    color: var(--text);
    text-decoration: none;
}

.quick-action-info {
    flex: 1;
    min-width: 0;
}

.quick-action-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 2px;
}

.quick-action-sub {
    font-size: 12.5px;
    color: var(--muted);
}

/* ---------- Icon Tile ---------- */
.icon-tile {
    width: 40px;
    height: 40px;
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 17px;
}

.icon-tile-blue  { background: var(--blue-soft);  color: var(--blue); }
.icon-tile-green { background: var(--green-soft); color: var(--green); }
.icon-tile-amber { background: var(--amber-soft); color: var(--amber); }
.icon-tile-navy  { background: var(--accent);     color: #fff; }

/* ---------- Activity List ---------- */
.activity-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-info {
    flex: 1;
    min-width: 0;
}

.activity-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}

.activity-sub {
    font-size: 12.5px;
    color: var(--muted);
}

.activity-right {
    text-align: right;
    flex-shrink: 0;
}

.activity-amount {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}

.activity-date {
    font-size: 12px;
    color: var(--muted);
}

/* ---------- Payment Schedule Table ---------- */
.portal-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
}

.portal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    white-space: nowrap;
}

.portal-table th {
    background: var(--blue-soft-2);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--faint);
    padding: 10px 14px;
    text-align: left;
}

.portal-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.portal-table tr:last-child td {
    border-bottom: none;
}

.portal-table tr.row-upcoming {
    background: #FBFAF3;
}

/* ---------- Payment History List ---------- */
.payment-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.payment-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.payment-item:last-child { border-bottom: none; }

.payment-info { flex: 1; min-width: 0; }

.payment-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}

.payment-sub { font-size: 12.5px; color: var(--muted); }

.payment-right { text-align: right; flex-shrink: 0; }

/* ---------- Buttons ---------- */
.btn-portal-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 99px;
    font-size: 14.5px;
    font-weight: 600;
    padding: 11px 22px;
    cursor: pointer;
    text-decoration: none;
    transition: background .14s, transform .1s;
    box-shadow: 0 1px 2px rgba(29,58,143,.28);
}

.btn-portal-primary:hover { background: #162e73; color: #fff; text-decoration: none; }
.btn-portal-primary:active { transform: translateY(.5px); }

.btn-portal-primary.btn-full { width: 100%; }

.btn-portal-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    color: var(--blue);
    border: 1.5px solid var(--blue);
    border-radius: 99px;
    font-size: 14.5px;
    font-weight: 600;
    padding: 10px 22px;
    cursor: pointer;
    text-decoration: none;
    transition: background .14s;
}

.btn-portal-outline:hover { background: var(--blue-soft); color: var(--blue); text-decoration: none; }

.btn-portal-ghost {
    background: none;
    border: none;
    color: var(--blue);
    font-size: 13.5px;
    font-weight: 500;
    padding: 0;
    cursor: pointer;
    text-decoration: none;
}

.btn-portal-ghost:hover { text-decoration: underline; color: var(--blue); }

/* ---------- Document List ---------- */
.doc-list { list-style: none; margin: 0; padding: 0; }

.doc-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.doc-item:last-child { border-bottom: none; }

.doc-info { flex: 1; min-width: 0; }

.doc-name { font-size: 14px; font-weight: 600; color: var(--ink); }

.doc-meta { font-size: 12.5px; color: var(--muted); }

.doc-actions { display: flex; gap: 8px; flex-shrink: 0; }

.doc-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--r-sm);
    background: var(--blue-soft);
    color: var(--blue);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    transition: background .14s;
}

.doc-btn:hover { background: #d2e3f8; color: var(--blue); }

/* ---------- Help Cards ---------- */
.help-contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 18px;
}

.help-contact-card {
    background: var(--surface);
    border-radius: var(--r-card);
    box-shadow: var(--shadow-card);
    padding: 28px 24px;
    text-align: center;
}

.help-contact-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

/* ---------- FAQ Accordion ---------- */
.faq-item {
    border-bottom: 1px solid var(--border);
}

.faq-item:first-child { border-top: 1px solid var(--border); }

.faq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    cursor: pointer;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--ink);
    user-select: none;
}

.faq-question .faq-chevron {
    flex-shrink: 0;
    transition: transform .2s;
    color: var(--muted);
}

.faq-item.open .faq-chevron { transform: rotate(180deg); }

.faq-answer {
    display: none;
    padding: 0 0 16px;
    font-size: 14px;
    color: var(--muted);
    line-height: 1.6;
}

.faq-item.open .faq-answer { display: block; }

/* ---------- Login Page ---------- */
.portal-login-shell {
    display: flex;
    min-height: 100vh;
}

.portal-login-brand {
    flex: 1.05;
    background: linear-gradient(165deg, #1D3A8F, #16275E);
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 40px 48px;
    overflow: hidden;
}

.portal-login-brand::after {
    content: '';
    position: absolute;
    bottom: -100px;
    right: -100px;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37,99,235,.25) 0%, transparent 70%);
    pointer-events: none;
}

.portal-login-brand-logo {
    margin-bottom: auto;
}

.portal-login-brand-headline {
    font-size: 34px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.01em;
    margin-bottom: 14px;
    line-height: 1.2;
    position: relative;
    z-index: 1;
}

.portal-login-brand-sub {
    font-size: 16px;
    color: rgba(255,255,255,.72);
    margin-bottom: 28px;
    position: relative;
    z-index: 1;
}

.portal-login-feature-list {
    list-style: none;
    margin: 0 0 40px;
    padding: 0;
    position: relative;
    z-index: 1;
}

.portal-login-feature-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,.88);
    font-size: 15px;
    margin-bottom: 14px;
}

.portal-login-feature-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(147,180,255,.18);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #93B4FF;
    flex-shrink: 0;
}

.portal-login-brand-footer {
    font-size: 13px;
    color: rgba(255,255,255,.5);
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.portal-login-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 48px;
    background: var(--surface);
}

.portal-login-form-inner {
    width: 100%;
    max-width: 380px;
}

.portal-login-title {
    font-size: 26px;
    font-weight: 800;
    color: var(--ink);
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.portal-login-subtitle {
    font-size: 15px;
    color: var(--muted);
    margin-bottom: 28px;
}

.portal-field {
    margin-bottom: 16px;
}

.portal-field label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 6px;
}

.portal-field-wrap {
    position: relative;
}

.portal-field-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--faint);
    font-size: 15px;
    pointer-events: none;
}

.portal-input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--r-sm);
    font-size: 15px;
    color: var(--ink);
    background: var(--surface);
    transition: border-color .14s, box-shadow .14s;
    box-sizing: border-box;
}

.portal-input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37,99,235,.14);
}

.portal-input.no-icon { padding-left: 12px; }

.portal-login-help {
    font-size: 13px;
    color: var(--muted);
    margin-top: 24px;
    text-align: center;
}

.portal-login-help a { color: var(--blue); text-decoration: none; }
.portal-login-help a:hover { text-decoration: underline; }

.portal-login-footer-link {
    position: fixed;
    bottom: 16px;
    left: 24px;
    font-size: 13px;
    color: var(--muted);
}

/* ---------- Upcoming Payment Banner ---------- */
.upcoming-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.upcoming-card-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

/* ---------- Bottom Tab Bar (Mobile) ---------- */
.portal-bottom-tabs {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
}

.portal-bottom-tabs-inner {
    display: flex;
    justify-content: space-around;
    align-items: stretch;
}

.portal-tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 4px;
    min-height: 50px;
    color: var(--faint);
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    gap: 3px;
    background: none;
    border: none;
    cursor: pointer;
    transition: color .14s;
}

.portal-tab-btn.active { color: var(--blue); }
.portal-tab-btn i { font-size: 20px; }

/* ---------- Loan Details Header ---------- */
.portal-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.portal-page-header-left h1 {
    font-size: 24px;
    font-weight: 800;
    color: var(--ink);
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.portal-page-header-left p { color: var(--muted); font-size: 14px; margin: 0; }

/* ---------- Loan Terms Grid ---------- */
.loan-terms-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    margin-top: 20px;
}

.loan-term-item {
    padding: 16px 18px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.loan-term-item:nth-child(4n) { border-right: none; }
.loan-term-item:nth-last-child(-n+4) { border-bottom: none; }

.loan-term-label {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--faint);
    margin-bottom: 6px;
}

.loan-term-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
}

/* ============================================================
   Responsive
   ============================================================ */

/* ≤1080px: remove side padding */
@media (max-width: 1080px) {
    .portal-main { padding: 24px 20px 48px; }
}

/* ≤920px: collapse two-col grids */
@media (max-width: 920px) {
    .portal-dash-grid       { grid-template-columns: 1fr; }
    .help-contact-grid      { grid-template-columns: 1fr; }
    .quick-actions-grid     { grid-template-columns: repeat(2, 1fr); }
    .loan-terms-grid        { grid-template-columns: repeat(2, 1fr); }
    .loan-term-item:nth-child(2n)  { border-right: none; }
    .loan-term-item:nth-child(4n)  { border-right: 1px solid var(--border); }
    .upcoming-card          { flex-direction: column; align-items: flex-start; }
    .upcoming-card-actions  { align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
}

/* ≤720px: mobile — hide sidebar, show bottom tabs */
@media (max-width: 720px) {
    .portal-sidebar         { display: none; }
    .portal-bottom-tabs     { display: block; }
    .portal-main            { padding: 20px 16px 80px; }
    .portal-topbar          { padding: 0 16px; }
    .quick-actions-grid     { grid-template-columns: 1fr; }
    .portal-login-brand     { display: none; }
    .portal-login-form-panel { padding: 32px 20px; }
    .portal-page-header     { flex-direction: column; }
}

/* ≤420px: single-col term grid */
@media (max-width: 420px) {
    .loan-terms-grid        { grid-template-columns: 1fr 1fr; }
    .big-number             { font-size: 28px; }
    .big-number-sm          { font-size: 24px; }
    .portal-greeting        { font-size: 22px; }
}
