/* ============================================
   FinCalc Pro — Premium Design System
   ============================================ */

:root {
    /* Colors */
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-card-hover: rgba(24, 34, 56, 0.8);
    --bg-input: rgba(15, 23, 42, 0.8);
    --border: rgba(99, 102, 115, 0.2);
    --border-focus: rgba(99, 179, 237, 0.5);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent: #3b82f6;
    --accent-light: #60a5fa;
    --accent-glow: rgba(59, 130, 246, 0.3);
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Spacing */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 24px var(--accent-glow);
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Background pattern */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(16, 185, 129, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ============================================
   Header
   ============================================ */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 14, 23, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--accent-gradient);
    color: white;
}

.logo-accent {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-tabs {
    display: flex;
    gap: 4px;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-tab:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
}

.nav-tab.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-light);
}

/* ============================================
   Header Right & Auth UI
   ============================================ */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.user-badge svg {
    color: var(--accent-light);
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

/* ============================================
   Main Layout
   ============================================ */
.main {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px 60px;
}

.section {
    display: none;
    animation: fadeInUp 0.4s ease;
}

.section.active {
    display: block;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.section-header {
    margin-bottom: 32px;
}

.section-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 6px;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    border-color: rgba(99, 102, 115, 0.35);
}

.card-header {
    padding: 20px 24px 0;
}

.card-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-header h2 svg {
    color: var(--accent-light);
    flex-shrink: 0;
}

.card-body {
    padding: 20px 24px 24px;
}

/* Calculator Grid */
.calculator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.card-main {
    border-color: rgba(59, 130, 246, 0.2);
}

.card-result {
    position: sticky;
    top: 88px;
    align-self: start;
}

/* Promissória Grid */
.promissoria-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.card-summary {
    grid-column: 1 / -1;
}

/* ============================================
   Form Styles
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.label-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    background: var(--accent-gradient);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 20px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

input[type="text"],
input[type="number"],
input[type="date"] {
    width: 100%;
    max-width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    outline: none;
}

input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

input::placeholder {
    color: var(--text-muted);
}

.input-wrapper.currency input {
    padding-left: 44px;
}

.input-prefix {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 1;
}

.input-suffix {
    position: absolute;
    right: 14px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    pointer-events: none;
}

/* Slider */
.slider-container {
    padding: 8px 0;
}

.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent) 0%, #8b5cf6 100%);
    outline: none;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.slider:hover {
    opacity: 1;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3), 0 0 0 3px var(--accent-glow);
    transition: transform 0.15s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3), 0 0 0 3px var(--accent-glow);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Radio Cards */
.radio-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.radio-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 10px;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.radio-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.radio-card:hover {
    border-color: rgba(99, 179, 237, 0.3);
    background: rgba(59, 130, 246, 0.05);
}

.radio-card.active {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.radio-card.active .radio-content {
    color: var(--accent-light);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
}

.btn-block {
    width: 100%;
    margin-top: 8px;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-sm), 0 0 16px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md), 0 0 24px var(--accent-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-light);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.btn-secondary:hover {
    background: rgba(59, 130, 246, 0.25);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.8rem;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

/* ============================================
   Results
   ============================================ */
.result-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.stat {
    padding: 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    display: block;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-value.accent {
    color: var(--accent-light);
}

.stat.highlight {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.2);
}

/* Parcelas Table */
.parcelas-table-wrapper {
    margin-bottom: 20px;
}

.parcelas-table-wrapper h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table-scroll {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.parcelas-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.parcelas-table th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid var(--border);
}

.parcelas-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    color: var(--text-secondary);
}

.parcelas-table tr:last-child td {
    border-bottom: none;
}

.parcelas-table tr:hover td {
    background: rgba(255,255,255,0.02);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.status-badge.pendente {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.status-badge.pago {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

/* Summary info on promissória tab */
.summary-info {
    margin-bottom: 16px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.9rem;
}

.summary-row:last-child {
    border-bottom: none;
}

.summary-row .label {
    color: var(--text-secondary);
}

.summary-row .value {
    font-weight: 600;
    color: var(--text-primary);
}

.summary-row .value.accent {
    color: var(--accent-light);
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 16px;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ============================================
   Histórico
   ============================================ */
.historico-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.historico-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.historico-item:hover {
    border-color: rgba(99, 102, 115, 0.35);
    background: rgba(255,255,255,0.05);
}

.historico-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.historico-nome {
    font-weight: 600;
    font-size: 0.95rem;
}

.historico-detalhe {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.historico-actions {
    display: flex;
    gap: 8px;
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal {
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-actions {
    display: flex;
    gap: 8px;
}

.modal-body {
    overflow-y: auto;
    padding: 24px;
}

/* ============================================
   Promissória Document (Print-ready)
   ============================================ */
.promissoria-doc {
    background: #fff;
    color: #1a1a1a;
    padding: 40px;
    border-radius: var(--radius-sm);
    font-family: 'Inter', serif;
    line-height: 1.7;
    font-size: 0.9rem;
}

.promissoria-doc .doc-header {
    text-align: center;
    border-bottom: 3px solid #1a1a1a;
    padding-bottom: 16px;
    margin-bottom: 24px;
}

.promissoria-doc .doc-title {
    font-size: 1.5rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
    color: #1a1a1a;
}

.promissoria-doc .doc-subtitle {
    font-size: 0.8rem;
    color: #666;
}

.promissoria-doc .doc-number {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
    margin-top: 8px;
}

.promissoria-doc .doc-section {
    margin-bottom: 20px;
}

.promissoria-doc .doc-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #555;
    border-bottom: 1px solid #ddd;
    padding-bottom: 6px;
    margin-bottom: 12px;
}

.promissoria-doc .doc-row {
    display: flex;
    margin-bottom: 6px;
    font-size: 0.85rem;
}

.promissoria-doc .doc-label {
    font-weight: 600;
    min-width: 140px;
    color: #333;
}

.promissoria-doc .doc-value {
    color: #1a1a1a;
}

.promissoria-doc .doc-amount-box {
    text-align: center;
    padding: 20px;
    background: #f5f5f5;
    border: 2px solid #333;
    border-radius: 8px;
    margin: 20px 0;
}

.promissoria-doc .doc-amount {
    font-size: 1.6rem;
    font-weight: 800;
    color: #1a1a1a;
}

.promissoria-doc .doc-amount-label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

.promissoria-doc .doc-body-text {
    text-align: justify;
    margin: 20px 0;
    font-size: 0.88rem;
    line-height: 1.8;
    color: #222;
}

.promissoria-doc .doc-parcelas-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 0.8rem;
}

.promissoria-doc .doc-parcelas-table th {
    background: #eee;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    border: 1px solid #ccc;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.promissoria-doc .doc-parcelas-table td {
    padding: 8px 12px;
    border: 1px solid #ddd;
}

.promissoria-doc .doc-signatures {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    margin-top: 60px;
    padding-top: 20px;
}

.promissoria-doc .doc-sig-block {
    text-align: center;
}

.promissoria-doc .doc-sig-line {
    border-top: 1px solid #333;
    padding-top: 8px;
    font-size: 0.8rem;
    color: #555;
}

.promissoria-doc .doc-sig-name {
    font-weight: 600;
    color: #1a1a1a;
    font-size: 0.85rem;
}

.promissoria-doc .doc-footer {
    margin-top: 30px;
    text-align: center;
    font-size: 0.75rem;
    color: #999;
    border-top: 1px solid #eee;
    padding-top: 16px;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 900px) {
    .calculator-grid,
    .promissoria-grid {
        grid-template-columns: 1fr;
    }

    .card-result {
        position: static;
    }
}

@media (max-width: 700px) {
    .calculator-grid,
    .promissoria-grid,
    .form-row {
        grid-template-columns: 1fr;
    }

    .header-content {
        flex-direction: column;
        height: auto;
        padding: 12px 16px;
        gap: 12px;
    }

    .header-right {
        width: 100%;
        justify-content: flex-end;
        border-top: 1px solid rgba(255,255,255,0.05);
        padding-top: 10px;
    }

    .user-badge {
        margin-right: auto;
    }

    .btn-logout {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .nav-tabs {
        width: 100%;
        overflow-x: auto;
    }

    .nav-tab {
        flex: 1;
        justify-content: center;
        padding: 8px 10px;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .main {
        padding: 20px 16px 40px;
    }

    .radio-group {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .result-stats {
        grid-template-columns: 1fr;
    }

    .promissoria-doc {
        padding: 20px;
    }

    .promissoria-doc .doc-signatures {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .modal {
        max-height: 95vh;
    }
}

/* ============================================
   Print Styles — Single Page
   ============================================ */
@media print {
    body {
        background: white !important;
        color: black !important;
    }

    body::before {
        display: none;
    }

    .header,
    .modal-header,
    .modal-overlay {
        display: none !important;
    }

    .promissoria-doc {
        box-shadow: none;
        border-radius: 0;
        padding: 12px 16px;
        max-width: 100%;
        font-size: 0.72rem;
        line-height: 1.4;
    }

    .promissoria-doc .doc-header {
        padding-bottom: 8px;
        margin-bottom: 12px;
    }

    .promissoria-doc .doc-title {
        font-size: 1.1rem;
        margin-bottom: 2px;
    }

    .promissoria-doc .doc-subtitle {
        font-size: 0.65rem;
    }

    .promissoria-doc .doc-number {
        font-size: 0.7rem;
        margin-top: 4px;
    }

    .promissoria-doc .doc-amount-box {
        padding: 10px;
        margin: 10px 0;
    }

    .promissoria-doc .doc-amount {
        font-size: 1.1rem;
    }

    .promissoria-doc .doc-amount-label {
        font-size: 0.6rem;
    }

    .promissoria-doc .doc-section {
        margin-bottom: 10px;
    }

    .promissoria-doc .doc-section-title {
        font-size: 0.65rem;
        padding-bottom: 3px;
        margin-bottom: 6px;
    }

    .promissoria-doc .doc-row {
        margin-bottom: 2px;
        font-size: 0.7rem;
    }

    .promissoria-doc .doc-label {
        min-width: 100px;
    }

    .promissoria-doc .doc-body-text {
        font-size: 0.7rem;
        line-height: 1.5;
        margin: 10px 0;
    }

    .promissoria-doc .doc-parcelas-table {
        font-size: 0.65rem;
        margin: 8px 0;
    }

    .promissoria-doc .doc-parcelas-table th,
    .promissoria-doc .doc-parcelas-table td {
        padding: 4px 8px;
    }

    .promissoria-doc .doc-parcelas-table th {
        font-size: 0.6rem;
    }

    .promissoria-doc .doc-signatures {
        margin-top: 30px;
        padding-top: 10px;
        gap: 30px;
    }

    .promissoria-doc .doc-sig-line {
        font-size: 0.65rem;
    }

    .promissoria-doc .doc-sig-name {
        font-size: 0.7rem;
    }

    .promissoria-doc .doc-footer {
        margin-top: 15px;
        font-size: 0.6rem;
        padding-top: 8px;
    }

    /* Show only the promissória content */
    body > *:not(#printArea) {
        display: none !important;
    }

    #printArea {
        display: block !important;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
    }

    #printArea .promissoria-doc {
        display: block !important;
    }

    @page {
        margin: 10mm;
        size: A4;
    }
}

/* ============================================
   Animations
   ============================================ */
.card {
    animation: cardIn 0.5s ease forwards;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.btn-primary {
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.btn-primary:active::after {
    width: 300px;
    height: 300px;
}

/* Toast / Notification */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    animation: toastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.success {
    border-color: rgba(16, 185, 129, 0.4);
}

.toast svg {
    color: var(--success);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Login Page
   ============================================ */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    padding: 24px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 40px 36px;
    box-shadow: var(--shadow-lg), 0 0 80px rgba(59, 130, 246, 0.05);
    transition: transform 0.4s ease, opacity 0.3s ease;
    animation: cardIn 0.6s ease;
}

.login-card.flip {
    animation: loginFlip 0.5s ease;
}

@keyframes loginFlip {
    0%   { transform: perspective(600px) rotateY(0deg); opacity: 1; }
    50%  { transform: perspective(600px) rotateY(8deg); opacity: 0.7; }
    100% { transform: perspective(600px) rotateY(0deg); opacity: 1; }
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-bottom: 32px;
}

.login-logo .logo-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-bottom: 28px;
    line-height: 1.5;
}

.login-field {
    margin-bottom: 20px;
}

.login-field label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.login-field label svg {
    color: var(--accent-light);
    flex-shrink: 0;
}

.login-field input {
    width: 100%;
    padding: 13px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    outline: none;
}

.login-field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 48px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.toggle-password:hover {
    color: var(--accent-light);
}

.login-btn {
    margin-top: 8px;
    padding: 14px 24px;
    font-size: 0.95rem;
}

.login-error {
    color: var(--danger);
    font-size: 0.82rem;
    font-weight: 500;
    text-align: center;
    margin-top: 14px;
    min-height: 20px;
    animation: fadeInUp 0.3s ease;
}

.login-switch {
    text-align: center;
    margin-top: 24px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.login-switch a {
    color: var(--accent-light);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.login-switch a:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* Floating particles */
.login-particles {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.15;
    animation: particleFloat linear infinite;
}

.particle:nth-child(1) { left: 10%; animation-duration: 18s; animation-delay: 0s; width: 8px; height: 8px; }
.particle:nth-child(2) { left: 30%; animation-duration: 22s; animation-delay: 3s; }
.particle:nth-child(3) { left: 55%; animation-duration: 16s; animation-delay: 1s; width: 10px; height: 10px; }
.particle:nth-child(4) { left: 75%; animation-duration: 20s; animation-delay: 5s; }
.particle:nth-child(5) { left: 90%; animation-duration: 24s; animation-delay: 2s; width: 7px; height: 7px; }

@keyframes particleFloat {
    0%   { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10%  { opacity: 0.15; }
    90%  { opacity: 0.15; }
    100% { transform: translateY(-10vh) rotate(360deg); opacity: 0; }
}

/* ============================================
   Logout Button
   ============================================ */
.btn-logout {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-sm);
    color: #f87171;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--accent-light);
}

.user-badge svg {
    flex-shrink: 0;
}

/* ============================================
   Calendar
   ============================================ */
.calendar-container {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
}

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.calendar-nav h2 {
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: capitalize;
}

.calendar-nav-buttons {
    display: flex;
    gap: 8px;
}

.btn-cal-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.03);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cal-nav:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: var(--accent-light);
}

.calendar-grid-wrapper {
    user-select: none;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 6px;
}

.calendar-weekday {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 8px 0;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    position: relative;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.02);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.calendar-day:hover {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.2);
}

.calendar-day.today {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--accent);
    color: var(--accent-light);
    font-weight: 700;
}

.calendar-day.other-month {
    color: var(--text-muted);
    opacity: 0.35;
}

.calendar-day.selected {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

.calendar-day.has-due {
    font-weight: 700;
}

.calendar-dots {
    display: flex;
    gap: 3px;
    position: absolute;
    bottom: 4px;
}

.calendar-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
}

.calendar-dot.overdue {
    background: var(--danger);
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.4);
}

.calendar-dot.upcoming {
    background: var(--warning);
    box-shadow: 0 0 4px rgba(245, 158, 11, 0.4);
}

.calendar-dot.paid {
    background: var(--success);
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.4);
}

/* Calendar Detail Panel */
.calendar-detail {
    position: sticky;
    top: 88px;
    align-self: start;
}

.calendar-detail-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.calendar-detail-header h3 {
    font-size: 1rem;
    font-weight: 700;
}

.calendar-detail-date {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

.due-item {
    padding: 14px 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    transition: all 0.2s;
}

.due-item:hover {
    border-color: rgba(99, 102, 115, 0.35);
    background: rgba(255,255,255,0.05);
}

.due-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.due-item-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.due-item-value {
    font-weight: 700;
    font-size: 0.9rem;
}

.due-item-detail {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.due-item.is-overdue {
    border-left: 3px solid var(--danger);
}

.due-item.is-upcoming {
    border-left: 3px solid var(--warning);
}

.due-item.is-paid {
    border-left: 3px solid var(--success);
}

.calendar-legend {
    display: flex;
    gap: 16px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-dot.overdue { background: var(--danger); }
.legend-dot.upcoming { background: var(--warning); }
.legend-dot.paid { background: var(--success); }

.calendar-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.calendar-empty svg {
    display: block;
    margin: 0 auto 12px;
    color: var(--text-muted);
    opacity: 0.4;
}

/* Calendar responsive */
@media (max-width: 900px) {
    .calendar-container {
        grid-template-columns: 1fr;
    }

    .calendar-detail {
        position: static;
    }
}

@media (max-width: 700px) {
    .calendar-day {
        font-size: 0.75rem;
    }

    .calendar-dots {
        bottom: 2px;
    }

    .calendar-dot {
        width: 4px;
        height: 4px;
    }

    .header-right {
        gap: 8px;
    }

    .user-badge {
        display: none;
    }
}

/* ============================================
   Telegram Button
   ============================================ */
.btn-telegram {
    background: linear-gradient(135deg, #0088cc 0%, #229ED9 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 136, 204, 0.3);
}

.btn-telegram:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 136, 204, 0.4);
}

.btn-telegram:active {
    transform: translateY(0);
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

/* ============================================
   Info Box
   ============================================ */
.info-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

.info-box svg {
    color: var(--accent-light);
    flex-shrink: 0;
    margin-top: 2px;
}

/* ============================================
   Profile
   ============================================ */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 900px) {
    .profile-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Toggle Option
   ============================================ */
.toggle-option {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    transition: background 0.2s;
    user-select: none;
}

.toggle-option:hover {
    background: rgba(255, 255, 255, 0.06);
}

.toggle-option input[type="checkbox"] {
    display: none;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--border-color);
    border-radius: 12px;
    flex-shrink: 0;
    transition: background 0.3s;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-option input:checked + .toggle-switch {
    background: var(--accent);
}

.toggle-option input:checked + .toggle-switch::after {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ============================================
   RESPONSIVE — Tablet (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {
    /* Header — compact */
    .header-content {
        padding: 0 12px;
        height: 56px;
    }

    .logo {
        font-size: 1rem;
        gap: 8px;
    }

    .logo-icon {
        width: 32px;
        height: 32px;
    }

    .logo-icon svg {
        width: 20px;
        height: 20px;
    }

    /* Nav — bottom bar on mobile */
    .nav-tabs {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 200;
        display: flex;
        justify-content: space-around;
        gap: 0;
        background: rgba(10, 14, 23, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--border);
        padding: 6px 4px;
        padding-bottom: max(6px, env(safe-area-inset-bottom));
    }

    .nav-tab {
        flex-direction: column;
        gap: 3px;
        padding: 6px 8px;
        font-size: 0.65rem;
        border-radius: var(--radius-sm);
        min-width: 0;
        flex: 1;
        text-align: center;
        justify-content: center;
    }

    .nav-tab svg {
        width: 20px;
        height: 20px;
    }

    /* Header right - hide text on mobile */
    .header-right {
        gap: 8px;
    }

    .user-badge span {
        display: none;
    }

    .btn-logout {
        font-size: 0;
        padding: 8px;
        min-width: 36px;
    }

    .btn-logout svg {
        margin: 0;
    }

    /* Main content */
    .main {
        padding: 16px 12px 100px;
    }

    .section-header {
        margin-bottom: 20px;
    }

    .section-header h1 {
        font-size: 1.35rem;
    }

    .section-header p {
        font-size: 0.85rem;
    }

    /* Grids — single column */
    .calculator-grid,
    .promissoria-grid,
    .profile-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .card-result {
        position: static;
    }

    /* Cards — less padding */
    .card-header {
        padding: 16px 16px 0;
    }

    .card-body {
        padding: 16px;
    }

    .card-header h2 {
        font-size: 0.95rem;
    }

    /* Form rows — single column */
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Buttons — full width and touch-friendly */
    .btn {
        min-height: 44px;
        font-size: 0.9rem;
    }

    .btn-block {
        width: 100%;
    }

    /* Result values */
    .result-amount {
        font-size: 1.75rem;
    }

    /* Radio cards */
    .radio-group {
        flex-direction: column;
        gap: 8px;
    }

    .radio-card {
        padding: 12px;
    }

    /* Parcelas table */
    .parcelas-list {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Calendar */
    .calendar-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .cal-day {
        font-size: 0.75rem;
        min-height: 36px;
    }

    /* Modal */
    .modal-content {
        width: 95vw;
        max-height: 90vh;
        margin: 5vh auto;
    }

    /* Historico */
    .historico-item {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .historico-actions {
        width: 100%;
        display: flex;
        gap: 8px;
    }

    .historico-actions .btn {
        flex: 1;
    }

    /* Slider — bigger thumb for touch */
    .slider::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
    }

    .slider::-moz-range-thumb {
        width: 28px;
        height: 28px;
    }

    /* Toast */
    .toast {
        left: 12px;
        right: 12px;
        max-width: none;
        bottom: 80px;
    }

    /* Promissória document */
    .promissoria-doc {
        padding: 16px;
        font-size: 0.8rem;
    }

    .doc-header .doc-title {
        font-size: 1.1rem;
    }

    .doc-amount {
        font-size: 1.3rem;
    }

    /* Info box */
    .info-box {
        font-size: 0.8rem;
        padding: 10px 14px;
    }

    /* Telegram button */
    .btn-telegram {
        width: 100%;
    }

    /* Toggle option */
    .toggle-option {
        padding: 10px 12px;
    }

    .toggle-label {
        font-size: 0.8rem;
    }
}

/* ============================================
   RESPONSIVE — Small Phone (max-width: 480px)
   ============================================ */
@media (max-width: 480px) {
    .header-content {
        height: 50px;
        padding: 0 10px;
    }

    .logo {
        font-size: 0.9rem;
    }

    .nav-tab {
        font-size: 0.6rem;
        padding: 5px 4px;
    }

    .nav-tab svg {
        width: 18px;
        height: 18px;
    }

    .main {
        padding: 12px 10px 100px;
    }

    .section-header h1 {
        font-size: 1.15rem;
    }

    .card-header {
        padding: 12px 12px 0;
    }

    .card-body {
        padding: 12px;
    }

    input[type="text"],
    input[type="number"],
    input[type="date"] {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    .result-amount {
        font-size: 1.4rem;
    }

    .result-label {
        font-size: 0.7rem;
    }

    .parcela-item {
        padding: 10px;
        font-size: 0.8rem;
    }

    /* Calendar smaller */
    .cal-day {
        font-size: 0.65rem;
        min-height: 32px;
        padding: 2px;
    }

    .cal-badge {
        font-size: 0.55rem;
    }

    /* Day detail */
    .day-detail {
        padding: 12px;
    }

    .day-detail h3 {
        font-size: 0.95rem;
    }

    /* Profile grid */
    .profile-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   RESPONSIVE — Tiny Phone (max-width: 360px)
   ============================================ */
@media (max-width: 360px) {
    .logo-icon {
        display: none;
    }

    .logo {
        font-size: 0.85rem;
    }

    .nav-tab {
        font-size: 0;
        padding: 8px;
    }

    .nav-tab svg {
        width: 22px;
        height: 22px;
    }

    .main {
        padding: 10px 8px 100px;
    }

    .section-header h1 {
        font-size: 1.05rem;
    }

    .card-body {
        padding: 10px;
    }

    .btn {
        font-size: 0.85rem;
        padding: 10px 14px;
    }
}

/* ============================================
   Login page responsive
   ============================================ */
@media (max-width: 768px) {
    .login-card {
        margin: 16px;
        padding: 28px 20px;
        max-width: none;
        width: calc(100% - 32px);
    }

    .login-logo h1 {
        font-size: 1.5rem;
    }

    .login-field label {
        font-size: 0.8rem;
    }

    .login-field input {
        padding: 12px 14px;
    }

    .login-btn {
        min-height: 48px;
        font-size: 1rem;
    }
}
