/* Emplacement : public/assets/css/app.css — servi sous /assets/css/app.css */

/* Couleurs de marque et règles communes à toute l’interface. */
:root {
    color-scheme: light;
    --brand-navy: #082b5c;
    --brand-blue: #0866ed;
    --brand-blue-bright: #1478ff;
    --brand-ink: #10233f;
    --text-primary: #16243a;
    --text-muted: #64748b;
    --surface: #ffffff;
    --surface-soft: #f4f7fc;
    --border: #e3eaf3;
    --focus: #3b82f6;
    --radius-sm: 0.75rem;
    --radius-md: 1.125rem;
    --radius-lg: 1.625rem;
    --shadow-soft: 0 20px 60px rgba(8, 43, 92, 0.09);
    --content-width: 70rem;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    min-height: 100%;
    background: var(--surface-soft);
    -webkit-text-size-adjust: 100%;
}

body {
    min-width: 320px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    color: var(--text-primary);
    background:
    radial-gradient(ellipse at 82% 12%, rgba(20, 120, 255, 0.09), transparent 32rem),
    linear-gradient(145deg, #f8faff 0%, #f2f6fc 54%, #edf3fb 100%);
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
    font: inherit;
}

button, a {
    -webkit-tap-highlight-color: transparent;
}

img {
    display: block;
    max-width: 100%;
}

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.setup-screen {
    display: grid;
    min-height: 100vh;
    min-height: 100dvh;
    align-content: center;
    justify-items: center;
    gap: clamp(1.5rem, 5vw, 3rem);
    padding: max(2rem, env(safe-area-inset-top)) 1.25rem max(2rem, env(safe-area-inset-bottom));
}

.brand-logo {
    width: min(100%, 26rem);
    max-height: 14rem;
    object-fit: contain;
    filter: drop-shadow(0 10px 22px rgba(8, 43, 92, 0.06));
}

.setup-panel {
    width: min(100%, 39rem);
    padding: clamp(1.5rem, 5vw, 3rem);
    border: 1px solid rgba(227, 234, 243, 0.9);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow-soft);
    text-align: center;
    backdrop-filter: blur(12px);
}

.eyebrow {
    margin: 0 0 0.8rem;
    color: var(--brand-blue);
    font-size: 0.75rem;
    font-weight: 750;
    letter-spacing: 0.15em;
    line-height: 1.4;
    text-transform: uppercase;
}

h1 {
    max-width: 17ch;
    margin: 0 auto;
    color: var(--brand-navy);
    font-size: clamp(1.8rem, 5vw, 2.7rem);
    font-weight: 750;
    letter-spacing: -0.045em;
    line-height: 1.08;
}

.setup-panel > p:not(.eyebrow) {
    max-width: 52ch;
    margin: 1.2rem auto 0;
    color: var(--text-muted);
    font-size: clamp(1rem, 2vw, 1.1rem);
    line-height: 1.7;
}

.setup-panel .setup-note {
    margin-top: 1.7rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--border);
    color: var(--brand-ink);
    font-size: 0.9rem;
    font-weight: 600;
}

@media (max-width: 480px) {
    .setup-screen {
        gap: 1.25rem;
        padding-inline: 1rem;
    }

    .brand-logo {
        width: min(84vw, 20rem);
        max-height: 10rem;
    }

    .setup-panel {
        border-radius: var(--radius-md);
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
    }
}

/* Système de composants partagé pour les prochains écrans métier. */
:root {
    --space-1: .25rem;
    --space-2: .5rem;
    --space-3: .75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --success: #16834b;
    --success-soft: #e9f7ef;
    --warning: #a65b00;
    --warning-soft: #fff4df;
    --danger: #bb3042;
    --danger-soft: #fff0f1;
    --info-soft: #eaf3ff;
    --control-height: 2.875rem;
}

.app-shell {
    min-height: 100dvh;
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    display: flex;
    width: 17rem;
    flex-direction: column;
    padding: 1.25rem;
    border-right: 1px solid var(--border);
    background: var(--surface);
}

.app-main {
    min-width: 0;
    margin-left: 17rem;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    min-height: 4.25rem;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: .75rem clamp(1rem, 3vw, 2.5rem);
    border-bottom: 1px solid rgba(227, 234, 243, .9);
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(16px);
}

.page-content {
    width: min(100%, var(--content-width));
    margin-inline: auto;
    padding: clamp(1rem, 3vw, 2.5rem);
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

.page-heading h1 {
    max-width: none;
    margin: 0;
    text-align: left;
    font-size: clamp(1.6rem, 3vw, 2.25rem);
}

.page-heading p {
    margin: .5rem 0 0;
    color: var(--text-muted);
    line-height: 1.55;
}

.card {
    min-width: 0;
    padding: clamp(1rem, 2.5vw, 1.5rem);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: 0 6px 24px rgba(8, 43, 92, .045);
}

.card-title {
    margin: 0;
    color: var(--brand-navy);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -.015em;
}

.card-description {
    margin: .35rem 0 0;
    color: var(--text-muted);
    font-size: .9rem;
    line-height: 1.5;
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.button {
    display: inline-flex;
    min-height: var(--control-height);
    align-items: center;
    justify-content: center;
    gap: .55rem;
    padding: .65rem 1rem;
    border: 1px solid transparent;
    border-radius: .8rem;
    cursor: pointer;
    font-size: .92rem;
    font-weight: 650;
    line-height: 1.2;
    text-decoration: none;
    transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.button:active {
    transform: translateY(1px);
}

.button:disabled, .button[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: .55;
    transform: none;
}

.button-primary {
    color: #fff;
    background: var(--brand-blue);
    box-shadow: 0 5px 14px rgba(8, 102, 237, .2);
}

.button-primary:hover {
    background: #0758cc;
}

.button-secondary {
    color: var(--brand-navy);
    border-color: var(--border);
    background: #fff;
}

.button-secondary:hover {
    border-color: #c3d4eb;
    background: #f8fbff;
}

.button-quiet {
    color: var(--brand-navy);
    background: transparent;
}

.button-quiet:hover {
    background: var(--surface-soft);
}

.button-danger {
    color: #fff;
    background: var(--danger);
}

.button-icon {
    width: var(--control-height);
    min-width: var(--control-height);
    padding: .5rem;
}

.field {
    display: grid;
    gap: .45rem;
    min-width: 0;
}

.field-label {
    color: var(--brand-ink);
    font-size: .88rem;
    font-weight: 650;
}

.field-hint {
    color: var(--text-muted);
    font-size: .82rem;
    line-height: 1.45;
}

.control {
    width: 100%;
    min-height: var(--control-height);
    padding: .7rem .85rem;
    border: 1px solid #ccd7e5;
    border-radius: .75rem;
    color: var(--text-primary);
    background: var(--surface);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.control::placeholder {
    color: #94a3b8;
}

.control:hover {
    border-color: #9eb3cc;
}

.control:focus {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px rgba(8, 102, 237, .13);
}

.control[aria-invalid="true"] {
    border-color: var(--danger);
}

.field-error {
    color: var(--danger);
    font-size: .82rem;
}

textarea.control {
    min-height: 7rem;
    resize: vertical;
}

.stack {
    display: grid;
    gap: var(--space-4);
}

.cluster {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
}

.grid {
    display: grid;
    gap: var(--space-5);
}

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

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

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

.metric-value {
    display: block;
    margin-top: .7rem;
    color: var(--brand-navy);
    font-size: clamp(1.5rem, 3vw, 2.1rem);
    font-weight: 750;
    letter-spacing: -.04em;
    font-variant-numeric: tabular-nums;
}

.metric-caption {
    color: var(--text-muted);
    font-size: .85rem;
}

.table-wrap {
    width: 100%;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th, .data-table td {
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table th {
    color: #52647d;
    background: #f7f9fc;
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .045em;
    text-transform: uppercase;
    white-space: nowrap;
}

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

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

.data-table tbody tr:hover {
    background: #f9fbfe;
}

.numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.badge {
    display: inline-flex;
    min-height: 1.65rem;
    align-items: center;
    gap: .35rem;
    padding: .2rem .6rem;
    border-radius: 999px;
    color: var(--brand-navy);
    background: var(--info-soft);
    font-size: .76rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge-success {
    color: var(--success);
    background: var(--success-soft);
}

.badge-warning {
    color: var(--warning);
    background: var(--warning-soft);
}

.badge-danger {
    color: var(--danger);
    background: var(--danger-soft);
}

.empty-state {
    display: grid;
    justify-items: center;
    gap: .7rem;
    padding: clamp(2rem, 6vw, 4rem) 1.25rem;
    text-align: center;
}

.empty-state h2 {
    margin: 0;
    color: var(--brand-navy);
    font-size: 1.1rem;
}

.empty-state p {
    max-width: 44ch;
    margin: 0;
    color: var(--text-muted);
    line-height: 1.55;
}

.mobile-nav {
    display: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 1024px) {
    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .app-sidebar {
        width: 15rem;
    }

    .app-main {
        margin-left: 15rem;
    }
}

@media (max-width: 760px) {
    .app-sidebar {
        display: none;
    }

    .app-main {
        margin-left: 0;
        padding-bottom: calc(5.25rem + env(safe-area-inset-bottom));
    }

    .app-topbar {
        min-height: 3.75rem;
        padding-inline: 1rem;
    }

    .page-content {
        padding: 1.1rem 1rem 1.5rem;
    }

    .page-heading {
        display: grid;
        gap: 1rem;
        margin-bottom: 1.25rem;
    }

    .page-heading h1 {
        font-size: 1.75rem;
    }

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

    .mobile-nav {
        position: fixed;
        inset: auto 0 0;
        z-index: 30;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        padding: .45rem .35rem max(.45rem, env(safe-area-inset-bottom));
        border-top: 1px solid var(--border);
        background: rgba(255, 255, 255, .97);
        box-shadow: 0 -8px 28px rgba(8, 43, 92, .07);
        backdrop-filter: blur(18px);
    }

    .mobile-nav a {
        display: grid;
        min-height: 3.5rem;
        place-content: center;
        gap: .2rem;
        border-radius: .75rem;
        color: #64748b;
        font-size: .68rem;
        font-weight: 650;
        text-align: center;
        text-decoration: none;
    }

    .mobile-nav a[aria-current="page"] {
        color: var(--brand-blue);
        background: #eff6ff;
    }
}

@media (max-width: 480px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: minmax(0, 1fr);
    }

    .card {
        padding: 1rem;
    }

    .cluster > .button {
        flex: 1 1 auto;
    }

    .data-table th, .data-table td {
        padding: .75rem .7rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
}

@media print {
    body {
        background: #fff;
    }

    .app-sidebar, .app-topbar, .mobile-nav, .no-print {
        display: none !important;
    }

    .app-main {
        margin: 0;
    }

    .page-content {
        width: 100%;
        max-width: none;
        padding: 0;
    }

    .card {
        box-shadow: none;
        break-inside: avoid;
    }
}
