/* ============================================================
   Atelier — Patterns

   Application-level layout patterns: shell, sidebar nav, top bar,
   panel page (the recurring "list / table screen"), empty state,
   record detail layout.
   ============================================================ */

/* components.css est chargé séparément par index.html — pas besoin de l'importer ici. */

/* ============================================================
   APP SHELL — sidebar + topbar + main
   ============================================================ */

.a-shell {
    display: grid;
    grid-template-columns: var(--nav-w) 1fr;
    grid-template-rows: var(--topbar-h) 1fr;
    height: 100vh;
    background: var(--paper);
    overflow: hidden;
}

.a-shell-topbar {
    grid-column: 1 / -1;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0 var(--space-3);
    background: var(--surface);
    border-bottom: 1px solid var(--rule);
}
.a-shell-topbar .a-brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0 var(--space-2);
    height: 28px;
    font-weight: var(--weight-semibold);
    font-size: var(--fs-md);
    color: var(--ink);
    letter-spacing: -0.005em;
}
.a-shell-topbar .a-spacer { flex: 1; }

.a-shell-nav {
    grid-column: 1;
    grid-row: 2;
    background: var(--paper);
    border-right: 1px solid var(--rule);
    padding: var(--space-3) var(--space-2);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}
.a-shell-main {
    grid-column: 2;
    grid-row: 2;
    background: var(--paper);
    overflow-y: auto;
    padding: var(--space-5) var(--space-6);
}

/* ============================================================
   NAV ITEM — row in the sidebar
   ============================================================ */

.a-nav-section {
    display: block;
    padding: var(--space-3) var(--space-2) var(--space-1);
    font-size: var(--fs-2xs);
    font-weight: var(--weight-medium);
    color: var(--ink-4);
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
}

.a-nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    height: 30px;
    padding: 0 var(--space-2_5, 10px);
    border-radius: var(--radius-sm);
    color: var(--ink-2);
    font-size: var(--fs-md);
    font-weight: var(--weight-regular);
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.a-nav-item:hover { background: var(--surface-hover); color: var(--ink); }
.a-nav-item svg { width: 16px; height: 16px; color: var(--ink-3); flex-shrink: 0; stroke-width: 1.6; }
.a-nav-item:hover svg { color: var(--ink-2); }
.a-nav-item-active {
    background: var(--primary-soft);
    color: var(--primary-deep);
    font-weight: var(--weight-medium);
}
.a-nav-item-active svg { color: var(--primary); }
.a-nav-item-active:hover { background: var(--primary-tint); color: var(--primary-deep); }
.a-nav-item-active:hover svg { color: var(--primary); }

.a-nav-item .a-count {
    margin-left: auto;
    color: var(--ink-4);
}
.a-nav-item-active .a-count { color: var(--primary); }

/* ============================================================
   PAGE — content within .a-shell-main
   ============================================================ */

.a-page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}
.a-page-head .a-page-title {
    font-size: var(--fs-2xl);
    font-weight: var(--weight-semibold);
    line-height: var(--lh-tight);
    letter-spacing: var(--tracking-h);
    color: var(--ink);
}
.a-page-head .a-page-sub {
    font-size: var(--fs-md);
    color: var(--ink-3);
    margin-top: 4px;
}
.a-page-head .a-page-actions {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

/* ============================================================
   PANEL PAGE — toolbar + filters + table; the recurring screen
   ============================================================ */

.a-panel {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-1);
    overflow: hidden;
}
.a-panel-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    height: var(--toolbar-h);
    padding: 0 var(--space-3);
    background: var(--surface);
    border-bottom: 1px solid var(--rule);
}
.a-panel-toolbar .a-spacer { flex: 1; }
.a-panel-toolbar .a-divider-v {
    width: 1px;
    height: 16px;
    background: var(--rule);
    margin: 0 4px;
}
.a-panel-body { /* the table or content sits here */ }

/* ============================================================
   BREADCRUMB — for record detail screens
   ============================================================ */

.a-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--fs-sm);
    color: var(--ink-3);
    margin-bottom: var(--space-2);
}
.a-breadcrumb a {
    color: var(--ink-3);
    text-decoration: none;
    transition: color var(--dur-fast) var(--ease);
}
.a-breadcrumb a:hover { color: var(--ink); }
.a-breadcrumb-sep { color: var(--ink-5); }

/* ============================================================
   FORM — record detail / fiche layout
   Two-column: label on left (compact), value on right (wide).
   ============================================================ */

.a-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.a-form-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: var(--space-4);
    align-items: baseline;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--rule-soft);
}
.a-form-row:last-child { border-bottom: 0; }
.a-form-row > .a-form-label {
    font-size: var(--fs-sm);
    color: var(--ink-3);
    font-weight: var(--weight-regular);
    padding-top: 6px;
}
.a-form-row > .a-form-value {
    font-size: var(--fs-base);
    color: var(--ink);
}

/* ============================================================
   EMPTY STATE — the most important UX moment of a data tool.
   Personable, not jolly. Tells you the next move.
   ============================================================ */

.a-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-12) var(--space-6);
    text-align: center;
    color: var(--ink-3);
}
.a-empty-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-soft);
    border-radius: var(--radius-md);
    color: var(--ink-4);
}
.a-empty-icon svg { width: 24px; height: 24px; stroke-width: 1.5; }
.a-empty-title {
    font-size: var(--fs-lg);
    font-weight: var(--weight-semibold);
    color: var(--ink);
}
.a-empty-text {
    font-size: var(--fs-md);
    color: var(--ink-3);
    max-width: 36ch;
    line-height: var(--lh-base);
}
.a-empty-actions {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

/* ============================================================
   KPI — small dashboard stat block
   Uses display type for the number, tabular nums.
   ============================================================ */

.a-kpi {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--space-4);
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius-md);
}
.a-kpi-label {
    font-size: var(--fs-2xs);
    font-weight: var(--weight-medium);
    color: var(--ink-3);
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
}
.a-kpi-value {
    font-size: var(--fs-3xl);
    font-weight: var(--weight-semibold);
    line-height: var(--lh-tight);
    letter-spacing: var(--tracking-tight);
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.a-kpi-delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--fs-xs);
    color: var(--ink-3);
    margin-top: 2px;
}
.a-kpi-delta-up   { color: var(--success); }
.a-kpi-delta-down { color: var(--danger); }
