/* Vida Compta — mobile-first, bleu sobre. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f4f6f8;
    color: #1a2733;
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

/* --- Screens --- */
.screen { display: none; min-height: 100vh; min-height: 100dvh; }
.screen.active { display: block; }

/* --- Login --- */
#screen-login.active { display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.login-card {
    background: white; border-radius: 16px; padding: 2rem 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08); width: 100%; max-width: 360px;
    text-align: center;
}
.login-card .logo { font-size: 1.8rem; margin: 0 0 .25rem; color: #1e3a5f; }
.login-card .tagline { color: #6b7a87; margin: 0 0 2rem; font-size: .95rem; }
.login-card form { display: flex; flex-direction: column; gap: 1rem; }
.login-card input {
    padding: 0.85rem 1rem; border: 1px solid #d4dbe2; border-radius: 10px;
    font-size: 1rem; -webkit-appearance: none;
}
.login-card input:focus { outline: none; border-color: #1e3a5f; }
.error-msg { color: #c53030; margin: 0; font-size: .9rem; min-height: 1.2rem; }

/* --- App header --- */
.app-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 1rem; background: white;
    border-bottom: 1px solid #e2e8ed; position: sticky; top: 0; z-index: 10;
}
.app-header h2 { margin: 0; font-size: 1.1rem; color: #1e3a5f; flex: 1; text-align: center; }

/* --- Buttons --- */
.btn-primary {
    background: #1e3a5f; color: white; border: none; border-radius: 10px;
    padding: 0.85rem 1rem; font-size: 1rem; font-weight: 600; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.btn-primary:active { background: #16294a; }
.btn-secondary {
    background: white; color: #1e3a5f; border: 1.5px solid #1e3a5f; border-radius: 10px;
    padding: 0.75rem 1rem; font-size: 1rem; font-weight: 500; cursor: pointer;
    margin: 1rem; display: block; width: calc(100% - 2rem); text-align: center;
}
.btn-secondary:active { background: #f0f4f9; }
.icon-btn {
    background: transparent; border: none; font-size: 1.4rem; cursor: pointer;
    padding: 0.3rem 0.6rem; color: #1e3a5f; -webkit-tap-highlight-color: transparent;
    min-width: 2.5rem;
}
.danger { color: #c53030 !important; border-color: #c53030 !important; }

/* --- Entity picker --- */
.entity-list { padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.entity-card {
    background: white; border-radius: 12px; padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); cursor: pointer;
    border: 2px solid transparent;
}
.entity-card:active { border-color: #1e3a5f; }
.entity-card .name { font-weight: 600; font-size: 1.1rem; }
.entity-card .meta { color: #6b7a87; font-size: .85rem; margin-top: 0.25rem; }

/* --- Mes sociétés (manage) --- */
.entities-manage-list { padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.entity-manage-card {
    background: white; border-radius: 12px; padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.entity-manage-card.inactive { opacity: 0.55; }
.entity-manage-card .header-row {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem;
}
.entity-manage-card .name { font-weight: 600; font-size: 1.05rem; }
.entity-manage-card .siret { color: #6b7a87; font-size: .8rem; margin-bottom: 0.75rem; }
.entity-manage-card .accounts-section {
    border-top: 1px solid #e2e8ed; padding-top: 0.75rem; margin-top: 0.75rem;
}
.entity-manage-card .accounts-title {
    font-size: .85rem; color: #6b7a87; text-transform: uppercase; letter-spacing: 0.05em;
    margin-bottom: 0.5rem; display: flex; justify-content: space-between; align-items: center;
}
.account-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.5rem 0; border-bottom: 1px dashed #eef2f5;
}
.account-row:last-child { border-bottom: none; }
.account-row .name { font-weight: 500; font-size: .95rem; }
.account-row .type { color: #6b7a87; font-size: .8rem; }
.account-row.inactive { opacity: 0.5; }

/* --- Dashboard placeholder --- */
.dashboard-placeholder { padding: 2rem 1rem; text-align: center; color: #6b7a87; }

/* --- Modal --- */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    display: none; align-items: flex-end; justify-content: center;
    z-index: 100; padding: 0;
}
.modal-backdrop.active { display: flex; }
.modal-content {
    background: white; border-radius: 16px 16px 0 0; padding: 1.25rem;
    width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto;
}
.modal-content h3 { margin: 0 0 1rem; color: #1e3a5f; }
.modal-content form { display: flex; flex-direction: column; gap: 0.85rem; }
.modal-content label { font-size: .85rem; color: #6b7a87; display: block; margin-bottom: 0.25rem; }
.modal-content input, .modal-content select {
    padding: 0.7rem 0.85rem; border: 1px solid #d4dbe2; border-radius: 8px;
    font-size: 1rem; width: 100%; -webkit-appearance: none;
}
.modal-content input:focus, .modal-content select:focus { outline: none; border-color: #1e3a5f; }
.modal-content .button-row { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.modal-content .button-row button { flex: 1; }
.modal-content .btn-cancel {
    background: transparent; color: #6b7a87; border: 1px solid #d4dbe2;
    border-radius: 10px; padding: 0.85rem; font-size: 1rem; cursor: pointer;
}

/* --- Toast --- */
.toast {
    position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(120%);
    background: #1e3a5f; color: white; padding: 0.85rem 1.25rem; border-radius: 10px;
    transition: transform 0.25s ease; z-index: 200; max-width: 90%;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* --- Tablet/desktop --- */
@media (min-width: 768px) {
    .screen.active { max-width: 600px; margin: 0 auto; }
    .modal-backdrop.active { align-items: center; }
    .modal-content { border-radius: 16px; }
}
