/* =========================================================================
   Cash Advance Funding Portal — Stylesheet
   ========================================================================= */

:root {
    --brand:        #0b3d91;
    --brand-dark:   #082b66;
    --brand-light:  #e7eefb;
    --accent:       #0aa861;
    --accent-dark:  #07854c;
    --danger:       #c0392b;
    --warning:      #d97706;
    --bg:           #f5f7fb;
    --surface:      #ffffff;
    --text:         #1a2235;
    --text-muted:   #5a6275;
    --border:       #d8dde7;
    --radius:       8px;
    --shadow:       0 1px 3px rgba(15, 23, 42, .08), 0 4px 12px rgba(15, 23, 42, .04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main.container { flex: 1; }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { color: var(--text); margin: 0 0 12px; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

/* ----- Navigation ----- */
.nav {
    background: var(--brand);
    color: #fff;
    box-shadow: var(--shadow);
}
.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.nav-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.nav-brand:hover { text-decoration: none; }
.brand-mark {
    background: #fff;
    color: var(--brand);
    font-weight: 800;
    padding: 6px 10px;
    border-radius: 6px;
    letter-spacing: 1px;
}
.brand-text { font-weight: 600; }
.nav-links { display: flex; align-items: center; gap: 18px; }
.nav-links a { color: #e6ecfa; }
.nav-links a:hover { color: #fff; text-decoration: none; }
.nav-admin {
    background: rgba(255,255,255,.18);
    padding: 4px 10px;
    border-radius: 4px;
}
.nav-user { color: #cdd9f1; font-size: 14px; }

/* ----- Cards ----- */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    margin-bottom: 22px;
}
.card-narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
.card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* ----- Forms ----- */
.form-group { margin-bottom: 14px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { display: grid; gap: 14px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 700px) {
    .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
}
.form-group.full { grid-column: 1 / -1; }

label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
    font-size: 13px;
}
label .req { color: var(--danger); }

input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=date], input[type=number], input[type=url], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    transition: border .15s, box-shadow .15s;
    font-family: inherit;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(11, 61, 145, .12);
}
textarea { min-height: 80px; resize: vertical; }
.help { color: var(--text-muted); font-size: 12px; margin-top: 4px; }

/* ----- Buttons ----- */
.btn {
    display: inline-block;
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: background .15s, transform .05s;
    text-decoration: none;
    line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-primary  { background: var(--brand); color: #fff; }
.btn-primary:hover  { background: var(--brand-dark); }
.btn-success  { background: var(--accent); color: #fff; }
.btn-success:hover  { background: var(--accent-dark); }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-outline  { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.6); }
.btn-outline:hover { background: rgba(255,255,255,.15); }
.btn-secondary{ background: #e6e9f1; color: var(--text); }
.btn-secondary:hover { background: #d6dae6; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.btn-row.right { justify-content: flex-end; }
.btn-row.between { justify-content: space-between; }

/* ----- Flash ----- */
.flash {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
    border-left: 4px solid;
}
.flash-success { background: #e7f8ef; border-color: var(--accent); color: #115e3a; }
.flash-error   { background: #fdecea; border-color: var(--danger); color: #7a1d14; }
.flash-warning { background: #fff7e6; border-color: var(--warning); color: #8a4a00; }
.flash-info    { background: var(--brand-light); border-color: var(--brand); color: var(--brand-dark); }

/* ----- Tables ----- */
.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
.table th { background: #f0f3fa; font-weight: 600; color: #4a5266; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #f9fafd; }

/* ----- Status badges ----- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.badge-submitted    { background: var(--brand-light); color: var(--brand-dark); }
.badge-under_review { background: #fff7e6; color: #8a4a00; }
.badge-approved     { background: #e7f8ef; color: #115e3a; }
.badge-rejected     { background: #fdecea; color: #7a1d14; }
.badge-draft        { background: #eef0f5; color: #5a6275; }

/* ----- Multi-step form ----- */
.stepper {
    display: flex;
    overflow-x: auto;
    gap: 6px;
    margin-bottom: 24px;
    padding-bottom: 8px;
}
.step {
    flex: 1 1 0;
    min-width: 110px;
    padding: 10px 12px;
    background: #eef0f5;
    color: var(--text-muted);
    border-radius: 6px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    border-top: 3px solid transparent;
    white-space: nowrap;
}
.step .step-num {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    opacity: .8;
}
.step.active   { background: var(--brand-light); color: var(--brand-dark); border-top-color: var(--brand); }
.step.complete { background: #e7f8ef; color: var(--accent-dark); border-top-color: var(--accent); }

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--brand-dark);
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--brand-light);
}

/* ----- Hero ----- */
.hero {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff;
    padding: 50px 30px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}
.hero h1 { color: #fff; font-size: 32px; }
.hero p { font-size: 17px; color: #d6e0f5; max-width: 640px; }
.hero .btn { margin-top: 16px; }

/* ----- Signature pad ----- */
.signature-wrap {
    border: 2px dashed var(--border);
    border-radius: 6px;
    padding: 8px;
    background: #fafbfd;
}
.signature-canvas {
    background: #fff;
    border-radius: 4px;
    width: 100%;
    height: 150px;
    cursor: crosshair;
    display: block;
    touch-action: none;
}
.signature-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

/* ----- Profile / dashboard tiles ----- */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin: 16px 0;
}
.tile {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--brand);
}
.tile h3 { color: var(--brand-dark); margin-bottom: 6px; }
.tile p { color: var(--text-muted); margin: 0 0 10px; font-size: 14px; }

.kv { display: grid; grid-template-columns: 220px 1fr; gap: 8px 16px; margin: 4px 0; }
.kv .k { color: var(--text-muted); font-size: 13px; }
.kv .v { color: var(--text); font-weight: 500; word-break: break-word; }
@media (max-width: 600px) {
    .kv { grid-template-columns: 1fr; }
    .kv .k { font-weight: 600; }
}

/* ----- Footer ----- */
.footer {
    background: #1a2235;
    color: #aab1c4;
    padding: 18px 0;
    font-size: 13px;
    text-align: center;
    margin-top: 40px;
}
.footer .footer-sub { font-size: 12px; opacity: .75; margin-top: 4px; }
.footer p { margin: 2px 0; }

/* Empty state */
.empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

/* Doc preview list */
.doc-list { display: grid; gap: 12px; margin-top: 14px; }
.doc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--accent);
}
.doc-row strong { color: var(--text); }
.doc-row .sub { color: var(--text-muted); font-size: 12px; }
