:root {
    --primary: #1E3A7B;
    --primary-hover: #162d62;
    --primary-light: #EEF2FA;
    --accent: #F5A800;
    --background: #F8F9FA;
    --surface: #FFFFFF;
    --text-primary: #3D3D3D;
    --text-secondary: #6B7280;
    --border: #E4E7EE;
    --error: #C0392B;
    --error-bg: #FDECEA;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow-md: 0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
    --radius-md: 6px;
    --radius-lg: 8px;
    --font: 'Plus Jakarta Sans', sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Header Mercante ── */
.mb-header {
    position: sticky; top: 0; z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; height: 64px;
}
.mb-logo img { height: 44px; width: auto; object-fit: contain; }
.mb-app-name {
    position: absolute; left: 50%; transform: translateX(-50%);
    font-size: 17px; font-weight: 700; color: var(--primary);
    white-space: nowrap;
}

/* ── Layout ── */
.app-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 32px 16px 48px;
    min-height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
}

/* ── Cards ── */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 24px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

/* ── Form ── */
.input-row { display: flex; gap: 16px; }
.input-row .input-group { flex: 1; }
.input-group { margin-bottom: 18px; }

.input-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
    margin-bottom: 5px;
}

.input-group input {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}
.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30,58,123,.1);
}
.input-group input::placeholder { color: #B0B8C8; }

/* ── Buttons ── */
.btn-primary {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--primary);
    color: #fff;
    font-family: var(--font);
    font-weight: 600;
    font-size: 14px;
    padding: 12px 18px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background .15s, transform .1s;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: translateY(1px); }

/* ── Result ── */
.result-container {
    display: none;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .3s, transform .3s;
}
.result-container.show { display: block; opacity: 1; transform: translateY(0); }

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.result-header h2 { font-size: 14px; font-weight: 700; color: var(--text-primary); }

.badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.result-item { display: flex; flex-direction: column; margin-bottom: 10px; }
.result-item .label { font-size: 12px; color: var(--text-secondary); margin-bottom: 2px; }
.result-item .value { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.text-highlight { color: var(--primary) !important; }

.divider { border: none; border-top: 1px dashed var(--border); margin: 12px 0; }

.result-total {
    display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    margin-top: 6px;
}
.result-total .label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.result-total .value.large { font-size: 24px; font-weight: 800; color: var(--primary); }

/* ── Error ── */
.hidden { display: none !important; }
.error-message {
    display: flex; align-items: center; gap: 8px;
    background: var(--error-bg); color: var(--error);
    padding: 11px 12px; border-radius: var(--radius-md);
    font-size: 13px; font-weight: 500;
    margin-bottom: 16px;
    border: 1px solid rgba(192,57,43,.2);
}

/* ── Toast ── */
.toast {
    position: fixed; bottom: 20px; left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: #1E293B; color: #fff;
    padding: 10px 22px; border-radius: 100px;
    font-size: 13px; font-weight: 500; opacity: 0;
    transition: all .3s cubic-bezier(.68,-.55,.27,1.55);
    z-index: 1000; box-shadow: var(--shadow-md);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

@media (max-width: 480px) {
    .app-container { padding: 20px 16px 40px; }
}
