:root {
    --black: #1b1b1b;
    --yellow: #f2e944;
    --yellow-dark: #d7ce24;
    --white: #ffffff;
    --text: #1f2933;
    --muted: #6b7280;
    --light: #f6f7f9;
    --border: #e6e8ec;
    --danger: #b42318;
    --success: #027a48;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.10);
    --radius: 24px;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: linear-gradient(180deg, var(--black) 0%, var(--black) 220px, var(--light) 220px, var(--light) 100%);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
    min-height: 100vh;
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(14px + env(safe-area-inset-top)) 18px 14px;
    background: rgba(27, 27, 27, 0.96);
    backdrop-filter: blur(14px);
    color: var(--white);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 15px;
    background: var(--yellow);
    color: var(--black);
    font-weight: 900;
    letter-spacing: -0.5px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
}

.brand-text strong {
    font-size: 18px;
}

.brand-text small {
    color: var(--yellow);
    font-size: 13px;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lang-switch {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 4px;
}

.lang-switch a {
    min-width: 40px;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: var(--white);
    font-weight: 800;
    font-size: 13px;
}

.lang-switch a.active {
    background: var(--yellow);
    color: var(--black);
}

.app-main {
    padding: 18px;
}

.hero-card,
.card,
.dashboard-hero,
.menu-card {
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.hero-card {
    background: radial-gradient(circle at top right, rgba(242, 233, 68, 0.34), transparent 36%), #242424;
    color: var(--white);
    padding: 28px 22px;
    margin: 10px 0 18px;
    overflow: hidden;
}

.hero-badge {
    display: inline-flex;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--yellow);
    color: var(--black);
    font-weight: 900;
    font-size: 12px;
    margin-bottom: 16px;
}

.hero-card h1,
.dashboard-hero h1,
.card h1,
.card h2 {
    margin: 0;
    letter-spacing: -0.8px;
}

.hero-card h1 {
    max-width: 620px;
    font-size: clamp(28px, 7vw, 46px);
    line-height: 1.04;
}

.hero-card p {
    margin: 14px 0 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: 16px;
    line-height: 1.55;
}

.card {
    background: var(--white);
    padding: 22px;
    margin-bottom: 18px;
}

.auth-card h2,
.card h1 {
    font-size: 25px;
    margin-bottom: 8px;
}

.muted {
    color: var(--muted);
    line-height: 1.5;
    margin-top: 0;
}

.form-grid {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

label {
    display: grid;
    gap: 7px;
    font-weight: 800;
    font-size: 14px;
}

label span {
    color: #2b3038;
}

input,
textarea,
select {
    width: 100%;
    min-height: 52px;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 15px;
    font: inherit;
    color: var(--text);
    background: #fbfcfd;
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

textarea {
    resize: vertical;
    min-height: 150px;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--yellow-dark);
    box-shadow: 0 0 0 4px rgba(242, 233, 68, 0.32);
    background: var(--white);
}

.two-cols {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.compact-cols {
    grid-template-columns: 0.8fr 1.2fr;
}

.segmented-control {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    background: #f1f2f4;
    padding: 7px;
    border-radius: 18px;
}

.segmented-control label {
    display: block;
    cursor: pointer;
}

.segmented-control input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented-control span {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    text-align: center;
    color: var(--muted);
    font-weight: 900;
}

.segmented-control input:checked + span {
    background: var(--black);
    color: var(--yellow);
}

.company-fields {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px dashed #d6d8df;
    border-radius: 18px;
    background: #fafafa;
}

.is-hidden {
    display: none !important;
}

.btn {
    min-height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 16px;
    padding: 14px 18px;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.btn:active {
    transform: scale(0.985);
}

.btn-primary {
    background: var(--yellow);
    color: var(--black);
    box-shadow: 0 12px 24px rgba(242, 233, 68, 0.25);
}

.btn-full {
    width: 100%;
}

.auth-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
    color: var(--muted);
    font-weight: 700;
}

.link-strong {
    color: var(--black);
    background: rgba(242, 233, 68, 0.55);
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 900;
}

.alert {
    margin: 0 0 14px;
    padding: 14px 16px;
    border-radius: 16px;
    font-weight: 800;
    line-height: 1.35;
}

.alert-error {
    color: var(--danger);
    background: #fff2f0;
    border: 1px solid #ffccc7;
}

.alert-success {
    color: var(--success);
    background: #ecfdf3;
    border: 1px solid #abefc6;
}

.dashboard-hero {
    background: radial-gradient(circle at top right, rgba(242, 233, 68, 0.42), transparent 36%), #242424;
    color: var(--white);
    padding: 24px;
    margin: 10px 0 18px;
}

.dashboard-hero p,
.dashboard-hero span {
    margin: 0;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 700;
}

.dashboard-hero h1 {
    font-size: clamp(28px, 7vw, 42px);
    line-height: 1.05;
    margin: 8px 0 10px;
}

.menu-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.menu-card {
    display: grid;
    gap: 8px;
    background: var(--white);
    padding: 20px;
    border: 1px solid var(--border);
    min-height: 138px;
    position: relative;
    overflow: hidden;
}

.menu-card::after {
    content: '';
    position: absolute;
    right: -35px;
    top: -35px;
    width: 110px;
    height: 110px;
    border-radius: 999px;
    background: rgba(242, 233, 68, 0.28);
}

.menu-card.highlight {
    background: var(--yellow);
    border-color: var(--yellow-dark);
}

.menu-card.danger {
    background: #fff8f7;
}

.menu-icon,
.page-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    background: var(--black);
    color: var(--yellow);
    font-size: 25px;
    font-weight: 900;
    z-index: 1;
}

.menu-card strong {
    font-size: 18px;
    letter-spacing: -0.2px;
    z-index: 1;
}

.menu-card small {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.4;
    z-index: 1;
}

.menu-card.highlight small {
    color: rgba(27, 27, 27, 0.74);
}

.placeholder-card {
    text-align: center;
    padding: 32px 22px;
}

.placeholder-card .page-icon {
    margin: 0 auto 16px;
}

.placeholder-card p {
    color: var(--muted);
    line-height: 1.55;
}

.success-card {
    text-align: center;
}

.success-icon {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    border-radius: 24px;
    background: var(--yellow);
    color: var(--black);
    font-size: 38px;
    font-weight: 900;
}

.access-box {
    display: grid;
    gap: 12px;
    margin: 20px 0;
    text-align: left;
}

.access-box > div {
    padding: 16px;
    border-radius: 18px;
    background: #f8f9fb;
    border: 1px solid var(--border);
}

.access-box span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 6px;
}

.access-box strong {
    display: block;
    font-size: 22px;
    overflow-wrap: anywhere;
}

.note-warning {
    text-align: left;
    padding: 14px;
    border-radius: 16px;
    background: #fffbea;
    border: 1px solid #fff085;
    margin-bottom: 18px;
    line-height: 1.45;
}

.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    z-index: 60;
    width: 100%;
    max-width: 980px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
    background: rgba(27, 27, 27, 0.96);
    backdrop-filter: blur(14px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.bottom-nav a {
    min-height: 58px;
    display: grid;
    place-items: center;
    gap: 2px;
    border-radius: 16px;
    color: rgba(255, 255, 255, 0.72);
    font-weight: 800;
}

.bottom-nav a span {
    font-size: 24px;
    line-height: 1;
}

.bottom-nav a small {
    font-size: 11px;
}

.bottom-nav a.active {
    background: var(--yellow);
    color: var(--black);
}

@media (min-width: 700px) {
    .app-main {
        padding: 28px;
    }

    .two-cols {
        grid-template-columns: 1fr 1fr;
    }

    .menu-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .card,
    .hero-card,
    .dashboard-hero {
        padding: 30px;
    }

    .auth-card {
        max-width: 560px;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (min-width: 980px) {
    body {
        background: linear-gradient(180deg, var(--black) 0%, var(--black) 280px, var(--light) 280px, var(--light) 100%);
    }

    .menu-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.form-section-title {
    margin: 12px 0 0;
    font-size: 18px;
    letter-spacing: -0.3px;
}

.checkbox-line {
    display: flex;
    grid-template-columns: auto 1fr;
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: 16px;
}

.checkbox-line input {
    width: 20px;
    min-height: 20px;
    margin-top: 2px;
}

.summary-list {
    display: grid;
    gap: 12px;
    margin: 20px 0;
}

.summary-list > div {
    display: grid;
    gap: 6px;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fbfcfd;
}

.summary-list span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.summary-list strong {
    font-size: 17px;
    line-height: 1.35;
}

.summary-list small {
    color: var(--muted);
    font-size: 14px;
}

.btn-secondary,
.btn-light {
    background: #f1f2f4;
    color: var(--black);
    border: 1px solid var(--border);
}

.payment-grid {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.payment-card {
    padding: 18px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: #fbfcfd;
}

.payment-card h2 {
    font-size: 20px;
    margin: 0 0 8px;
}

.payment-card p {
    margin: 0 0 14px;
    color: var(--muted);
    line-height: 1.5;
}

.highlighted-payment {
    background: rgba(242, 233, 68, 0.18);
    border-color: rgba(215, 206, 36, 0.75);
}

.dashboard-return {
    margin-top: 16px;
}

.danger-icon,
.danger-bg {
    background: #fff2f0 !important;
    color: var(--danger) !important;
}

.empty-state {
    display: grid;
    gap: 10px;
    padding: 20px;
    border: 1px dashed #d6d8df;
    border-radius: 20px;
    background: #fafafa;
    text-align: center;
}

.empty-state p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.history-list {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.history-card {
    border: 1px solid var(--border);
    border-radius: 20px;
    background: #fbfcfd;
    padding: 16px;
}

.history-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.history-card-head strong {
    font-size: 18px;
}

.history-card-head span {
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--yellow);
    color: var(--black);
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.history-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.history-meta div {
    padding: 10px;
    border-radius: 14px;
    background: var(--white);
    border: 1px solid var(--border);
}

.history-meta span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.history-address {
    margin: 12px 0 6px;
    color: var(--text);
    line-height: 1.45;
}

.history-ref {
    color: var(--muted);
    font-weight: 800;
}

@media (min-width: 700px) {
    .payment-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .summary-list {
        grid-template-columns: repeat(2, 1fr);
    }
}


.history-filter-form {
    display: grid;
    gap: 14px;
    margin: 18px 0 20px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: #fbfcfd;
}

.history-search-field input {
    font-weight: 700;
}

.filter-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.history-result-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 8px 0 14px;
    color: var(--muted);
    font-weight: 900;
    font-size: 13px;
}

.history-result-line span {
    color: var(--danger);
    font-size: 12px;
}

.history-card-head > div {
    display: grid;
    gap: 4px;
}

.history-card-head small {
    color: var(--muted);
    font-weight: 900;
}

.status-pill.is-waiting {
    background: #fffbea;
    color: #7a5b00;
}

.status-pill.is-deposited {
    background: #ecfdf3;
    color: var(--success);
}

.status-pill.is-removed {
    background: #eef4ff;
    color: #1849a9;
}

.status-pill.is-unknown {
    background: #f1f2f4;
    color: var(--muted);
}

.history-meta-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.payment-label {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 13px;
}

.payment-label.is-paid {
    background: #ecfdf3;
    color: var(--success);
}

.payment-label.is-unpaid {
    background: #fff2f0;
    color: var(--danger);
}

@media (min-width: 700px) {
    .filter-actions {
        grid-template-columns: 1fr 1fr;
    }
}

.invoice-list {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.invoice-card {
    border: 1px solid var(--border);
    border-radius: 20px;
    background: #fbfcfd;
    padding: 16px;
}

.invoice-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.invoice-card-head > div {
    display: grid;
    gap: 4px;
}

.invoice-card-head strong {
    font-size: 19px;
    letter-spacing: -0.2px;
}

.invoice-card-head small,
.invoice-subtitle {
    color: var(--muted);
    font-weight: 800;
}

.invoice-subtitle {
    margin: 4px 0 10px;
}

.invoice-meta {
    margin-top: 12px;
}

.invoice-actions {
    margin-top: 14px;
}

.pagination {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 18px;
    align-items: center;
}

.pagination-current {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-weight: 900;
}

.btn.disabled {
    opacity: 0.45;
    pointer-events: none;
}

@media (min-width: 700px) {
    .pagination {
        grid-template-columns: 1fr auto 1fr;
    }
}

.bottom-nav {
    grid-template-columns: repeat(5, 1fr);
}

.bottom-nav a small {
    font-size: 10px;
}

/* Correctif mobile: empêcher le menu du bas et les boutons de créer un scroll horizontal */
html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.app-shell,
.app-main,
.card,
.hero-card,
.dashboard-hero,
.menu-card,
.form-grid,
.two-cols,
.compact-cols,
.summary-list,
.invoice-list,
.invoice-card,
.history-list,
.history-card {
    min-width: 0;
    max-width: 100%;
}

.btn,
.btn-full,
button,
a.btn {
    max-width: 100%;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
}

.bottom-nav {
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    overflow: hidden;
}

.bottom-nav a {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    padding: 6px 2px;
}

.bottom-nav a span,
.bottom-nav a small {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 380px) {
    .bottom-nav {
        gap: 2px;
        padding-left: 6px;
        padding-right: 6px;
    }

    .bottom-nav a {
        min-height: 54px;
        border-radius: 13px;
    }

    .bottom-nav a span {
        font-size: 21px;
    }

    .bottom-nav a small {
        font-size: 9px;
    }
}
