/* Styles globaux: base commune, layout, composants et notifications. */


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

/* Variables: couleurs, espacements et valeurs reutilisees. */
:root {
    --clr-bg: #f2f2f2;
    --clr-white: #ffffff;
    --clr-border: #e0e0e0;
    --clr-text: #1a1a2e;
    --clr-text-muted: #6b7280;
    --clr-accent: #2c3e7a;
    /* deep navy – brand colour */
    --clr-accent-link: #2563eb;
    /* blue links */
    --clr-btn-login: #5a6472;
    /* slate button */
    --clr-btn-login-h: #414a57;
    --clr-card-hover: #f8f8f8;
    --clr-shadow: rgba(0, 0, 0, .07);

    --radius-card: 12px;
    --radius-input: 8px;
    --radius-btn: 8px;

    --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --transition: 150ms ease;
}

/* Base: dimensions et comportement general de la page. */
html,
/* Base: dimensions et comportement general de la page. */
body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: var(--font-sans);
    background: var(--clr-bg);
    color: var(--clr-text);
    -webkit-font-smoothing: antialiased;
}

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

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
    gap: 0;
}

.login-back-link {
    position: fixed;
    top: 24px;
    left: 24px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--clr-text-muted);
    font-size: .88rem;
    font-weight: 600;
    transition: color var(--transition);
}

.login-back-link:hover {
    color: var(--clr-btn-login);
}

/* --- Header --- */
.login-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
}

.login-logo-card {
    width: 116px;
    height: 76px;
    background: var(--clr-white);
    border: 1px solid var(--clr-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 2px 8px var(--clr-shadow);
}

.login-logo {
    display: block;
    width: 96px;
    height: 60px;
    object-fit: contain;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--clr-accent);
    color: var(--clr-white);
    font-weight: 800;
    letter-spacing: 0;
}

.brand-mark--large {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    font-size: 1rem;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--clr-text);
    letter-spacing: -.3px;
}

.login-subtitle {
    font-size: .93rem;
    color: var(--clr-text-muted);
}

/* --- Card --- */
.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--clr-white);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-card);
    padding: 32px 28px;
    box-shadow: 0 2px 16px var(--clr-shadow);
}

.auth-card {
    display: flex;
    flex-direction: column;
}

.auth-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--clr-text);
    margin-bottom: 12px;
}

.auth-copy {
    color: var(--clr-text-muted);
    font-size: .92rem;
    line-height: 1.55;
    margin-bottom: 20px;
}

.auth-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.auth-secondary-link {
    display: inline-flex;
    justify-content: center;
    color: var(--clr-accent-link);
    font-size: .88rem;
    font-weight: 600;
}

.auth-secondary-link:hover {
    text-decoration: underline;
}

/* --- Alert --- */
.alert {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: .88rem;
    margin-bottom: 20px;
}

.alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.alert-icon {
    font-size: 1rem;
}

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

.form-label {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    color: var(--clr-text);
    margin-bottom: 6px;
}

.form-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.forgot-link {
    font-size: .82rem;
    color: var(--clr-accent-link);
    font-weight: 500;
    transition: opacity var(--transition);
}

.forgot-link:hover {
    opacity: .75;
}

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

.input-icon {
    position: absolute;
    left: 12px;
    color: var(--clr-text-muted);
    display: flex;
    pointer-events: none;
}

.form-input {
    width: 100%;
    padding: 11px 44px;
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-input);
    font-size: .93rem;
    color: var(--clr-text);
    background: var(--clr-white);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input::placeholder {
    color: #b0b7c0;
}

.form-input:focus {
    border-color: var(--clr-accent);
    box-shadow: 0 0 0 3px rgba(44, 62, 122, .1);
}

.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--clr-text-muted);
    display: flex;
    padding: 0;
    transition: color var(--transition);
}

.toggle-password:hover {
    color: var(--clr-text);
}

/* --- Button --- */
.btn-login {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--clr-btn-login);
    color: var(--clr-white);
    border: none;
    border-radius: var(--radius-btn);
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
    margin-top: 4px;
}

.btn-login:hover {
    background: var(--clr-btn-login-h);
}

.btn-login:active {
    transform: scale(.99);
}

/* --- Footer --- */
.login-footer {
    margin-top: 32px;
    text-align: center;
    color: var(--clr-text-muted);
    font-size: .80rem;
    line-height: 1.6;
}


/* ============================================================
   HOME / DASHBOARD PAGE
   ============================================================ */

.app-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--clr-bg);
}

.app-wrapper > main,
.app-wrapper > .container,
.app-wrapper > .login-wrapper,
.app-wrapper > .error-main {
    flex: 1;
}

/* --- Navbar --- */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    height: 64px;
    background: var(--clr-white);
}

.navbar-divider {
    height: 1px;
    background: var(--clr-border);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
}

.navbar-logo {
    display: block;
    width: 76px;
    height: 48px;
    object-fit: contain;
    flex: 0 0 auto;
}

.navbar-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--clr-text);
    letter-spacing: -.2px;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.navbar-user {
    font-size: .88rem;
    color: var(--clr-text-muted);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .88rem;
    color: var(--clr-text);
    font-weight: 500;
    transition: color var(--transition);
}

.btn-logout:hover {
    color: var(--clr-btn-login);
}

/* --- Main grid --- */
.home-main {
    flex: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px clamp(16px, 4vw, 48px);
}

.dashboard-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    max-width: 1280px;
    margin: 0 auto;
}

/* --- Dashboard card --- */
.dash-card {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 28px 24px;

    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);

    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-card);

    cursor: pointer;
    text-decoration: none;
    color: inherit;

    min-height: 150px;
    height: 100%;

    transition: all 0.25s ease;
}

.dash-card:hover {
    box-shadow: 0 4px 18px var(--clr-shadow);
    background: var(--clr-card-hover);
}

.dash-card:active {
    transform: scale(.99);
}

.dash-card--active {
    box-shadow: 0 4px 18px var(--clr-shadow);
    background: var(--clr-white);
}

.dash-card-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--clr-bg);
    border-radius: 10px;
    color: var(--clr-text-muted);
}

.dash-card:hover .dash-card-icon {
    color: var(--clr-accent);
    background: #eef0f8;
}

.dash-card-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.dash-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--clr-text);
}

.dash-card-desc {
    font-size: .88rem;
    color: var(--clr-text-muted);
    line-height: 1.4;
}

/* ============================================================
   LIST PAGES
   ============================================================ */

.page-main {
    flex: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 40px clamp(16px, 4vw, 48px);
}

.page-shell {
    width: 100%;
    max-width: 1080px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.page-title {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--clr-text);
}

.page-description {
    margin-top: 4px;
    font-size: .9rem;
    color: var(--clr-text-muted);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 16px;
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-btn);
    background: var(--clr-white);
    color: var(--clr-text);
    font-size: .88rem;
    font-weight: 600;
    transition: background var(--transition), border-color var(--transition);
}

.btn-secondary:hover {
    background: var(--clr-card-hover);
    border-color: #cfd4dc;
}

.list-panel {
    width: 100%;
    overflow: hidden;
    background: var(--clr-white);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-card);
    box-shadow: 0 2px 12px var(--clr-shadow);
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 15px 18px;
    text-align: left;
    border-bottom: 1px solid var(--clr-border);
}

.data-table th {
    background: #f7f8fb;
    color: var(--clr-text);
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
}

.data-table td {
    color: var(--clr-text-muted);
    font-size: .9rem;
}

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

.empty-state {
    min-height: 220px;
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    color: var(--clr-text-muted);
}

.empty-state strong {
    color: var(--clr-text);
    font-size: .98rem;
}

.empty-state-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--clr-bg);
    color: var(--clr-text-muted);
    font-size: 1.45rem;
    line-height: 1;
}

/* ============================================================
   APP SCREENS FROM MOBILE MOCKUPS
   ============================================================ */

button,
input,
select {
    font: inherit;
}

button {
    border: none;
}

.mobile-screen,
.spreadsheet-screen {
    min-height: 100vh;
    background: #f5f6f8;
    color: #151827;
}

.mobile-screen {
    padding: 18px clamp(10px, 3vw, 28px) 34px;
}

.mobile-shell {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
}

.form-shell {
    max-width: 720px;
}

.client-shell {
    max-width: 1180px;
}

.measure-form-shell {
    max-width: 980px;
}

.list-shell,
.measures-shell {
    max-width: 1180px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #5f6673;
    font-size: .88rem;
    font-weight: 600;
    margin-bottom: 22px;
}

.back-link span {
    font-size: 1.55rem;
    line-height: .8;
}

.screen-title {
    font-size: clamp(1.35rem, 2vw, 2rem);
    line-height: 1.2;
    font-weight: 700;
    margin-bottom: 22px;
}

.screen-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.screen-heading-row .screen-title {
    margin-bottom: 0;
}

.count-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: #e9eef8;
    color: var(--clr-accent);
    font-weight: 700;
    font-size: .83rem;
}

.form-card,
.entity-card,
.measure-card,
.summary-card,
.accordion-card,
.list-panel {
    background: white;


}

.form-card {
    padding: clamp(18px, 3vw, 30px);
}

/* Sections de formulaire: separe les groupes de champs. */
.form-section {
    padding-bottom: 28px;
    margin-bottom: 30px;
    border-bottom: 1px solid #eceff3;
}

.form-section:last-of-type {
    margin-bottom: 18px;
}

.section-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 18px;
}

.field-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    color: #2e3441;
    font-size: .84rem;
    font-weight: 700;
}

.field-label span {
    color: #687385;
    font-size: .72rem;
    font-weight: 600;
}

.app-input,
.sheet-select {
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid #dfe3e9;
    border-radius: 8px;
    background: var(--clr-white);
    color: #1e2430;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.app-input {
    margin-bottom: 16px;
}

.app-input:focus,
.sheet-select:focus {
    border-color: var(--clr-accent);
    box-shadow: 0 0 0 3px rgba(44, 62, 122, .12);
}

.input-muted {
    background: #e7e7ea;
    color: #111827;
}

.input-center {
    text-align: center;
    font-weight: 700;
}

.btn-primary,
.btn-muted,
.btn-danger,
.btn-success,
.btn-danger-soft,
.export-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border-radius: 7px;
    cursor: pointer;
    font-size: .88rem;
    font-weight: 700;
    text-align: center;
    transition: transform var(--transition), opacity var(--transition), box-shadow var(--transition);
}

/* Boutons: taille, alignement et etat visuel des actions. */
.btn-primary {
    width: 100%;
    background: #101828;
    color: var(--clr-white);
}

.btn-primary:hover,
.btn-muted:hover,
.btn-danger:hover,
.btn-success:hover,
.btn-danger-soft:hover,
.export-btn:hover {
    opacity: .9;
}

.btn-primary:active,
.btn-muted:active,
.btn-danger:active,
.btn-success:active,
.btn-danger-soft:active,
.export-btn:active {
    transform: scale(.99);
}

.btn-compact {
    width: 100%;
    min-height: 38px;
    padding: 0 14px;
    font-size: .8rem;
}

.btn-small {
    min-height: 36px;
    padding: 0 12px;
    font-size: .76rem;
}

.btn-muted {
    background: #f4f5f7;
    color: #293241;
}

.btn-danger {
    background: #d81f2a;
    color: var(--clr-white);
}

.btn-success {
    background: #effdf2;
    color: #31814a;
}

.btn-danger-soft {
    background: #fff1f1;
    color: #db1f2a;
}

.upload-zone {
    min-height: 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px 16px;
    border: 2px dashed #d8dce4;
    border-radius: 10px;
    color: #6b7280;
    text-align: center;
    cursor: pointer;
}

.upload-zone input {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    opacity: 0;
    pointer-events: none;
}

.upload-zone--small {
    min-height: 112px;
    margin: 12px 0 20px;
}

.toolbar-stack {
    display: grid;
    gap: 10px;
    margin: 18px 0 14px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 12px;
    background: var(--clr-white);
    border: 1px solid #dfe3e9;
    border-radius: 8px;
    color: #7b8494;
}

.search-box input {
    width: 100%;
    border: 0;
    outline: 0;
    color: #1e2430;
    background: transparent;
}

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

.entity-card {
    padding: 14px;
}

.entity-main {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.entity-main strong {
    color: #202535;
    font-size: .94rem;
}

.entity-main span,
.entity-main small {
    color: #687385;
    overflow-wrap: anywhere;
}

.entity-main span {
    font-size: .78rem;
}

.entity-main small {
    font-size: .76rem;
}

.entity-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}

.entity-actions .btn-muted,
.entity-actions .btn-danger {
    min-height: 34px;
    font-size: .76rem;
}

.accordion-card {
    padding: 0;
    margin-bottom: 12px;
    overflow: hidden;
}

.accordion-card summary {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    cursor: pointer;
    font-weight: 700;
    list-style: none;
}

.accordion-card summary::-webkit-details-marker {
    display: none;
}

.accordion-card summary::after {
    content: "⌄";
    color: #7b8494;
}

.accordion-card[open] summary::after {
    transform: rotate(180deg);
}

.filter-grid {
    display: grid;
    gap: 12px;
    padding: 0 18px 18px;
}

.filter-grid label,
.muted-copy {
    color: #687385;
    font-size: .84rem;
}

.muted-copy {
    padding: 0 18px 18px;
    line-height: 1.5;
}

.measure-list {
    display: grid;
    gap: 14px;
    margin-top: 16px;
}

.measure-card {
    padding: 16px;
}

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

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 800;
}

.status-badge--green {
    background: #e8f9ec;
    color: #308044;
}

.status-badge--blue {
    background: #e8efff;
    color: #4260c8;
}

.measure-details {
    display: grid;
    gap: 4px;
    font-size: .8rem;
}

.measure-details div {
    display: flex;
    gap: 4px;
}

.measure-details dt {
    font-weight: 800;
    color: #303746;
}

.measure-details dd {
    color: #3f4757;
}

.measure-divider {
    height: 1px;
    background: #e7eaf0;
    margin: 14px 0;
}

.measure-block,
.measure-totals {
    display: grid;
    gap: 4px;
    color: #3f4757;
    font-size: .8rem;
}

.measure-block strong,
.measure-totals strong {
    color: #252b38;
}

.measure-actions {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.recap-section {
    margin-top: 26px;
}

.recap-section h2 {
    font-size: 1.2rem;
    margin-bottom: 12px;
}

.export-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 18px;
}

.export-btn {
    min-height: 42px;
    padding: 0 12px;
    color: var(--clr-white);
    font-size: .8rem;
}

.export-btn--green {
    background: #25a85b;
}

.export-btn--purple {
    background: #7d26d9;
}

.export-btn--red {
    background: #d43131;
}

.export-btn--blue {
    background: #4e74d9;
}

.summary-card {
    overflow: hidden;
    margin-bottom: 18px;
}

.summary-card h3 {
    padding: 16px;
    border-bottom: 1px solid #e7eaf0;
    font-size: .98rem;
}

.stat-grid {
    display: grid;
    gap: 12px;
    padding: 16px;
}

.stat-grid div {
    display: grid;
    gap: 6px;
    padding: 14px;
    background: #f9fafc;
    border: 1px solid #f0f2f5;
}

.stat-grid span {
    color: #7b8494;
    font-size: .78rem;
}

.stat-grid strong {
    color: #101828;
    font-size: 1.2rem;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .78rem;
}

.summary-table th,
.summary-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #e7eaf0;
    text-align: left;
}

.summary-table th {
    color: #7b8494;
    font-size: .7rem;
    text-transform: uppercase;
}

.summary-table tr:last-child {
    background: #f2f3f6;
}

.nested-panel {
    padding: 14px;
    margin: 12px 0 16px;
    background: #fbfcfd;
    border: 1px solid #eef1f5;
    border-radius: 8px;
}

.dual-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(100px, .7fr);
    gap: 10px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    color: #4b5565;
    font-size: .84rem;
}

.check-row--wrap {
    align-items: flex-start;
    margin-top: 12px;
}

.port-row--arrival {
    background: #edfff1;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 14px;
}

.draft-table {
    display: grid;
    gap: 14px;
}

.draft-table table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: var(--clr-white);
}

.draft-table th,
.draft-table td {
    padding: 10px 8px;
    border: 1px solid #e2e6ed;
    text-align: center;
    font-size: .76rem;
}

.mini-input {
    width: 100%;
    min-height: 36px;
    padding: 0 8px;
    border: 1px solid #e2e6ed;
    border-radius: 6px;
    text-align: center;
}

.calculation-panel,
.result-panel {
    padding: 14px;
    border-radius: 8px;
}

.draft-table--blue .calculation-panel {
    background: #f0f7ff;
    border: 1px solid #dcecff;
}

.draft-table--green .calculation-panel {
    background: #f1fff4;
    border: 1px solid #d9f6df;
}

.result-panel {
    background: #fffce9;
    border: 1px solid #fff0a6;
}

.help-text {
    display: block;
    color: #7b8494;
    font-size: .72rem;
    line-height: 1.4;
    margin-left: 24px;
}

.form-footer-actions {
    display: grid;
    gap: 10px;
}

.client-form {
    margin-top: 18px;
}

.client-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.client-form-grid .app-input {
    margin-bottom: 0;
}

.grid-wide {
    grid-column: 1 / -1;
}

.client-check {
    margin: 4px 0 16px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #edf0f4;
    border-radius: 8px;
}

.logo-upload {
    display: grid;
    gap: 12px;
}

.logo-preview {
    width: 96px;
    height: 96px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: #101828;
    background-position: center;
    background-size: cover;
    color: var(--clr-white);
    font-size: .86rem;
    font-weight: 800;
    text-transform: uppercase;
}

.upload-zone--client {
    min-height: 96px;
    align-items: flex-start;
    text-align: left;
}

.upload-zone--client span {
    color: #1f2633;
    font-weight: 800;
}

.upload-zone--client small {
    color: #7b8494;
}

.client-tariff-row {
    padding: 14px;
    margin-bottom: 14px;
    background: #fbfcfd;
    border: 1px solid #e8ecf2;
    border-radius: 10px;
}

.client-tariff-row .btn-danger-soft {
    margin-top: 12px;
}

.client-list-section {
    margin-top: 30px;
}

.client-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.client-card {
    display: grid;
    gap: 14px;
    padding: 16px;
    background: var(--clr-white);
    border: 1px solid #dde1e7;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(17, 24, 39, .04);
}

.client-logo-chip {
    width: 54px;
    height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #e9eef8;
    color: var(--clr-accent);
    font-size: .76rem;
    font-weight: 900;
}

.client-logo-chip--image {
    background-position: center;
    background-size: cover;
}

.client-card-main {
    display: grid;
    gap: 4px;
}

.client-card-main strong {
    color: #1f2633;
}

.client-card-main span,
.client-card-main small {
    color: #687385;
    overflow-wrap: anywhere;
}

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

.client-meta div {
    padding: 10px;
    background: #f8fafc;
    border: 1px solid #edf0f4;
    border-radius: 8px;
}

.client-meta dt {
    color: #7b8494;
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.client-meta dd {
    margin-top: 4px;
    color: #1f2633;
    font-size: .84rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.client-tariff-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.client-tariff-summary span {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: #f0f7ff;
    color: #335a9d;
    font-size: .76rem;
    font-weight: 800;
}

.spreadsheet-screen {
    overflow-x: hidden;
}

.sheet-topbar {
    min-height: 86px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 0 clamp(16px, 4vw, 40px);
    background: var(--clr-white);
    border-bottom: 1px solid #dfe3e9;
}

.sheet-topbar h1 {
    font-size: clamp(1.35rem, 3vw, 2rem);
    font-weight: 800;
}

.icon-back,
.excel-link {
    display: inline-flex;
    align-items: center;
    color: #343b49;
}

.excel-link {
    gap: 12px;
    font-size: clamp(.92rem, 2vw, 1.25rem);
    white-space: nowrap;
}

.sheet-controls {
    padding: 28px clamp(16px, 4vw, 40px);
    background: var(--clr-white);
    border-bottom: 1px solid #dfe3e9;
}

.sheet-controls label {
    display: block;
    margin-bottom: 14px;
    color: #343b49;
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 800;
}

.sheet-select {
    max-width: 680px;
    min-height: 54px;
    background: #ebebee;
    font-size: clamp(1rem, 2vw, 1.3rem);
}

.sheet-frame {
    width: min(100%, 1120px);
    margin: 36px auto;
    padding: 0 clamp(10px, 3vw, 24px);
    overflow-x: auto;
}

.sheet-table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
    background: #f8f9fb;
    box-shadow: 0 1px 0 #d7dbe2 inset;
}

.sheet-table th {
    padding: 14px 18px;
    border: 1px solid #d7dbe2;
    background: #fbfcff;
    color: #242b39;
    font-size: clamp(.92rem, 2vw, 1.15rem);
    text-align: left;
    white-space: nowrap;
}

.sheet-table td {
    height: 56px;
    padding: 0 20px;
    border: 1px solid #d7dbe2;
    color: #606873;
    font-size: clamp(.95rem, 2vw, 1.14rem);
    font-weight: 700;
    text-align: center;
}

.sheet-gap td {
    height: 96px;
    background: #fbfcfd;
}

.recueil-sheet-screen {
    min-height: calc(100vh - 150px);
    background: #f5f6f8;
    color: #111827;
}

.recueil-sheet-topbar {
    min-height: 78px;
    display: grid;
    grid-template-columns: 36px 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 0 clamp(14px, 8vw, 192px);
    background: #ffffff;
    border-bottom: 1px solid #dfe3e9;
}

.recueil-sheet-back,
.recueil-excel-link {
    color: #334155;
    text-decoration: none;
}

.recueil-sheet-back {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 1.45rem;
}

.recueil-sheet-back:hover,
.recueil-excel-link:hover {
    background: #f1f5f9;
}

.recueil-sheet-topbar h1 {
    margin: 0;
    color: #111827;
    font-size: clamp(1.35rem, 1.7vw, 1.85rem);
    font-weight: 800;
}

.recueil-excel-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: .92rem;
    font-weight: 600;
    white-space: nowrap;
}

.recueil-sheet-controls {
    padding: 14px clamp(14px, 8vw, 192px) 18px;
    background: #ffffff;
    border-bottom: 1px solid #dfe3e9;
    margin: 0;
}

.recueil-sheet-controls label {
    display: block;
    margin-bottom: 6px;
    color: #475569;
    font-size: .8rem;
    font-weight: 800;
}

.recueil-sheet-select {
    min-width: 118px;
    min-height: 30px;
    padding: 0 8px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: #ffffff;
    color: #111827;
    font-size: .88rem;
}

.recueil-sheet-frame {
    padding: 14px;
    overflow: auto;
}

.recueil-sheet-table {
    width: 100%;
    min-width: 1180px;
    border-collapse: collapse;
    table-layout: fixed;
    background: #ffffff;
    box-shadow: 0 0 0 1px #d6d9de;
}

.recueil-sheet-table--detail {
    min-width: 1880px;
}

.recueil-sheet-table th,
.recueil-sheet-table td {
    border: 1px solid #d9d9d9;
    line-height: 1.25;
}

.recueil-sheet-table th {
    height: 28px;
    padding: 0 8px;
    background: #f2f3f5;
    color: #232831;
    font-size: .72rem;
    font-weight: 800;
    text-align: left;
    white-space: nowrap;
}

.recueil-sheet-table th:first-child,
.recueil-sheet-table td:first-child {
    width: 52%;
}

.recueil-sheet-table th:nth-child(2),
.recueil-sheet-table td:nth-child(2) {
    width: 11%;
}

.recueil-sheet-table th:nth-child(3),
.recueil-sheet-table td:nth-child(3) {
    width: 14%;
}

.recueil-sheet-table th:nth-child(4),
.recueil-sheet-table td:nth-child(4) {
    width: 12%;
}

.recueil-sheet-table th:nth-child(5),
.recueil-sheet-table td:nth-child(5) {
    width: 11%;
}

.recueil-sheet-table--detail th,
.recueil-sheet-table--detail td {
    width: 82px;
}

.recueil-sheet-table--detail th:first-child,
.recueil-sheet-table--detail td:first-child {
    width: 160px;
}

.recueil-sheet-table--detail th:nth-child(2),
.recueil-sheet-table--detail td:nth-child(2) {
    width: 260px;
}

.recueil-sheet-table--detail th:nth-child(3),
.recueil-sheet-table--detail td:nth-child(3) {
    width: 100px;
}

.recueil-sheet-table--detail th:nth-child(4),
.recueil-sheet-table--detail td:nth-child(4) {
    width: 185px;
}

.recueil-sheet-table--detail th:nth-child(5),
.recueil-sheet-table--detail td:nth-child(5) {
    width: 185px;
}

.recueil-sheet-table td {
    height: 28px;
    padding: 0 8px;
    color: #0f172a;
    font-size: .72rem;
    font-weight: 600;
    vertical-align: middle;
}

.recueil-sheet-table td:first-child {
    color: #4b5563;
    text-align: center;
}

.recueil-sheet-table tbody tr:nth-child(even) td {
    background: #f8f8f8;
}

.recueil-sheet-table tbody tr.recueil-sheet-gap td,
.recueil-sheet-table tbody tr:nth-child(11) td,
.recueil-sheet-table tbody tr:nth-child(18) td,
.recueil-sheet-table tbody tr:nth-child(30) td,
.recueil-sheet-table tbody tr:nth-child(39) td {
    background: #ececec;
}

/* Responsive: adapte l interface aux tailles d ecran. */
@media (min-width: 760px) {
    .client-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .logo-upload {
        grid-template-columns: 112px 1fr;
        align-items: center;
    }

    .client-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .toolbar-stack {
        grid-template-columns: minmax(260px, 1fr) 220px;
        align-items: center;
    }

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

    .entity-card {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
    }

    .entity-actions {
        width: 220px;
        margin-top: 0;
    }

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

    .measure-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: start;
    }

    .measure-actions {
        grid-template-columns: 1fr;
    }

    .export-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

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

    .draft-table {
        grid-template-columns: minmax(0, 1.2fr) minmax(240px, .8fr);
        align-items: start;
    }

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

/* Responsive: adapte l interface aux tailles d ecran. */
@media (min-width: 1100px) {
    .client-form {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0 28px;
    }

    .client-form .form-section:last-of-type,
    .client-form > .btn-primary {
        grid-column: 1 / -1;
    }

    .client-card-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

    .entity-card {
        display: block;
    }

    .entity-actions {
        width: auto;
        margin-top: 14px;
    }
}

/* ============================================================
   ERROR PAGES
   ============================================================ */

.error-main {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(32px, 6vw, 72px) clamp(16px, 4vw, 48px);
}

.error-panel {
    width: 100%;
    max-width: 560px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: clamp(28px, 5vw, 46px);
    text-align: center;
    background: var(--clr-white);
    border: 1px solid var(--clr-border);
    border-radius: 8px;
    box-shadow: 0 2px 16px var(--clr-shadow);
}

.error-code {
    color: var(--clr-accent);
    font-size: clamp(3.4rem, 10vw, 6rem);
    font-weight: 800;
    line-height: .9;
}

.error-label {
    color: var(--clr-text-muted);
    font-size: .84rem;
    font-weight: 700;
    text-transform: uppercase;
}

.error-title {
    color: var(--clr-text);
    font-size: clamp(1.45rem, 3vw, 2rem);
    font-weight: 750;
    line-height: 1.15;
}

.error-message {
    max-width: 430px;
    color: var(--clr-text-muted);
    font-size: .96rem;
    line-height: 1.6;
}

.error-action {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    padding: 0 18px;
    color: var(--clr-white);
    background: #101828;
    border-radius: 7px;
    font-size: .9rem;
    font-weight: 700;
    transition: opacity var(--transition), transform var(--transition);
}

.error-action:hover {
    opacity: .9;
}

.error-action:active {
    transform: scale(.99);
}

/* ============================================================
   TOASTS
   ============================================================ */

.toast-root {
    position: fixed;
    top: 88px;
    right: 20px;
    z-index: 1000;
    display: grid;
    gap: 10px;
    width: min(360px, calc(100vw - 32px));
    pointer-events: none;
}

.app-toast {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    gap: 12px;
    align-items: start;
    padding: 14px 14px 14px 12px;
    border: 1px solid #dfe3e9;
    border-left-width: 4px;
    border-radius: 8px;
    background: var(--clr-white);
    color: var(--clr-text);
    box-shadow: 0 12px 30px rgba(15, 23, 42, .14);
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 180ms ease, transform 180ms ease;
    pointer-events: auto;
}

.app-toast--visible {
    opacity: 1;
    transform: translateY(0);
}

.app-toast--leaving {
    opacity: 0;
    transform: translateY(-8px);
}

.app-toast--success {
    border-left-color: #16803c;
}

.app-toast--error {
    border-left-color: #d92d20;
}

.app-toast__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 800;
}

.app-toast--success .app-toast__icon {
    background: #eaf7ef;
    color: #16803c;
}

.app-toast--error .app-toast__icon {
    background: #fff0ef;
    color: #d92d20;
}

.app-toast__content {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.app-toast__content strong {
    font-size: .9rem;
    line-height: 1.25;
}

.app-toast__content span {
    color: var(--clr-text-muted);
    font-size: .84rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.app-toast__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: transparent;
    color: #667085;
    cursor: pointer;
    font-size: .82rem;
    font-weight: 800;
}

.app-toast__close:hover {
    background: #f2f4f7;
    color: #1f2937;
}

button.is-loading {
    cursor: progress;
    opacity: .72;
}

/* --- Footer --- */
.home-footer {
    padding: 20px;
    text-align: center;
    font-size: .80rem;
    color: var(--clr-text-muted);
    border-top: 1px solid var(--clr-border);
    background: var(--clr-white);
}


/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Responsive: adapte l interface aux tailles d ecran. */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .navbar {
        padding: 0 20px;
    }

    .navbar-actions {
        gap: 12px;
    }

    .btn-logout {
        font-size: .82rem;
    }

    .home-main {
        padding: 24px 20px;
    }

    .page-main {
        padding: 24px 20px;
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .data-table {
        min-width: 100%;
    }

    .data-table th,
    .data-table td {
        padding: 12px 10px;
    }

    .navbar-user {
        display: none;
    }
}

/* Responsive: adapte l interface aux tailles d ecran. */
@media (max-width: 480px) {
    /* Notifications: positionne les messages temporaires. */
    .toast-root {
        top: 74px;
        right: 12px;
        left: 12px;
        width: auto;
    }

    .navbar {
        padding: 0 16px;
    }

    .navbar-name {
        display: none;
    }

    .login-back-link {
        top: 16px;
        left: 16px;
    }

    .mobile-screen {
        padding-inline: 9px;
    }

    .client-meta {
        grid-template-columns: 1fr;
    }

    .form-card {
        padding: 16px 14px;
    }

    .screen-title {
        font-size: 1.2rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dash-card {
        min-height: 112px;
    }

    .login-card {
        padding: 24px 18px;
    }

    .data-table th,
    .data-table td {
        font-size: .72rem;
    }

    .sheet-topbar {
        grid-template-columns: auto 1fr;
        row-gap: 8px;
        padding-block: 14px;
    }

    .excel-link {
        grid-column: 2;
        font-size: .86rem;
    }

    .sheet-table {
        min-width: 100%;
        table-layout: fixed;
    }

    .sheet-table th {
        overflow: hidden;
        text-overflow: clip;
    }

    .sheet-table td {
        padding: 0 10px;
    }
}
