/* Mixtli Invoice Manager – Public Invoice Styles */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=DM+Serif+Display&display=swap');

.mim-invoice-wrap {
    font-family: 'DM Sans', sans-serif;
    max-width: 900px;
    margin: 40px auto;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
}

/* Header */
.mim-inv-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: #0f172a;
    color: #fff;
    padding: 36px 40px 32px;
    gap: 40px;
}
.mim-inv-company h1 {
    font-family: 'DM Sans', sans-serif;
    font-size: 22px; font-weight: 600;
    margin: 0 0 6px; color: #fff;
}
.mim-inv-company p { margin: 0; font-size: 14px; color: #94a3b8; }

.mim-inv-meta { text-align: right; }
.mim-inv-label {
    font-family: 'DM Serif Display', serif;
    font-size: 36px; letter-spacing: 4px; color: #f1f5f9;
    margin-bottom: 14px;
}
.mim-inv-meta-table { border-collapse: collapse; margin-left: auto; }
.mim-inv-meta-table td { padding: 3px 0 3px 20px; font-size: 14px; color: #cbd5e1; }
.mim-inv-meta-table td:first-child { color: #64748b; }

/* Parties */
.mim-inv-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}
.mim-inv-party {
    background: #fff;
    padding: 24px 40px;
}
.mim-party-label {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .6px; color: #94a3b8; margin: 0 0 10px;
}
.mim-party-name {
    font-size: 15px; font-weight: 600; color: #0f172a; margin: 0 0 6px;
}
.mim-inv-party p { margin: 0 0 4px; font-size: 14px; color: #475569; }

/* Section */
.mim-section-title {
    font-size: 17px; font-weight: 600; color: #0f172a;
    margin: 0; padding: 24px 40px 16px;
}

/* Table */
.mim-inv-table {
    width: 100%; border-collapse: collapse;
    font-size: 14px;
}
.mim-inv-table thead tr {
    background: #0f172a;
}
.mim-inv-table th {
    color: #e2e8f0; font-size: 12px; font-weight: 500;
    text-transform: uppercase; letter-spacing: .5px;
    padding: 10px 40px; text-align: left;
}
.mim-inv-table th.col-cost { text-align: right; }
.mim-inv-table td { padding: 14px 40px; vertical-align: top; color: #334155; border-bottom: 1px solid #f1f5f9; }
.mim-inv-table td.col-service { font-weight: 600; color: #0f172a; width: 180px; }
.mim-inv-table td.col-cost { text-align: right; font-weight: 600; color: #0f172a; width: 100px; }
.mim-row-renewal td { background: #fafafa; color: #94a3b8; }
.mim-row-renewal td.col-service { color: #64748b; }

/* Bottom row */
.mim-inv-bottom {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 32px;
    padding: 32px 40px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    align-items: start;
}
.mim-inv-payment h3 { font-size: 15px; font-weight: 600; color: #0f172a; margin: 0 0 10px; }
.mim-inv-payment p { font-size: 13px; color: #475569; line-height: 1.7; margin: 0 0 14px; }
.mim-inv-notice {
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
    border-radius: 0 6px 6px 0;
    padding: 12px 16px;
    font-size: 13px; color: #1e40af; line-height: 1.6;
}
.mim-inv-notice strong { color: #1e3a8a; }

/* Totals */
.mim-inv-totals {
    background: #0f172a;
    border-radius: 10px;
    padding: 20px 24px;
    min-width: 260px;
}
.mim-total-row {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 8px 0; font-size: 14px; color: #94a3b8;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.mim-total-row:last-child { border-bottom: none; }
.mim-total-row strong { font-size: 15px; color: #f1f5f9; }
.mim-total-renewal { opacity: .5; font-size: 12px; }
.mim-total-deposit strong,
.mim-total-balance strong { color: #fff; font-size: 17px; }
.mim-total-balance { border-top: 1px solid rgba(255,255,255,.15) !important; padding-top: 12px !important; margin-top: 4px; }
.mim-total-balance span { color: #e2e8f0; }

/* Footer */
.mim-inv-footer {
    text-align: center; font-size: 12px; color: #94a3b8;
    padding: 16px 40px 20px; border-top: 1px solid #f1f5f9; margin: 0;
}

@media (max-width: 680px) {
    .mim-inv-header   { flex-direction: column; padding: 24px 20px; }
    .mim-inv-meta     { text-align: left; }
    .mim-inv-parties  { grid-template-columns: 1fr; }
    .mim-inv-table th,
    .mim-inv-table td { padding-left: 20px; padding-right: 20px; }
    .mim-inv-bottom   { grid-template-columns: 1fr; padding: 24px 20px; }
    .mim-section-title { padding-left: 20px; padding-right: 20px; }
    .mim-inv-totals   { min-width: 0; }
}

/* ─── PDF Download Bar (desktop) ──────────────────────────────── */
.mim-pdf-bar {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px 12px 0 0;
    border-bottom: none;
    max-width: 900px;
    margin: 40px auto 0;
    padding: 14px 24px;
}
.mim-pdf-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.mim-pdf-bar-title {
    font-size: 14px;
    font-weight: 600;
    color: #475569;
}
.mim-pdf-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #0f172a;
    color: #fff;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    transition: background .15s, transform .1s;
    white-space: nowrap;
}
.mim-pdf-btn:hover {
    background: #1e293b;
    color: #fff;
    transform: translateY(-1px);
}
.mim-pdf-btn svg {
    flex-shrink: 0;
}

/* Make invoice-wrap connect to bar */
.mim-pdf-bar + .mim-invoice-wrap {
    margin-top: 0;
    border-radius: 0 0 12px 12px;
}

/* ─── FAB for mobile ───────────────────────────────────────────── */
.mim-pdf-fab {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: #0f172a;
    color: #fff;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(15,23,42,.35);
    text-decoration: none;
    z-index: 9999;
    transition: background .15s, transform .15s;
}
.mim-pdf-fab:hover {
    background: #1e293b;
    transform: scale(1.08);
}
.mim-pdf-fab svg {
    display: block;
}

@media (max-width: 680px) {
    /* Show FAB, hide bar button on mobile */
    .mim-pdf-fab { display: flex; }
    .mim-pdf-btn { display: none; }

    .mim-pdf-bar {
        margin-top: 16px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    .mim-pdf-bar + .mim-invoice-wrap {
        border-radius: 0;
    }
}
