/* Chrome applicatif post-connexion (sidebar, nav, motifs de page) — reprend les
   tokens --hermes-* définis dans wwwroot/css/auth.css pour une identité visuelle
   continue avec l'écran de connexion. Voir docs/DECISIONS.md. */

.app-shell {
    display: flex;
    min-height: 100vh;
    background: var(--hermes-bg);
    font-family: 'Public Sans', system-ui, -apple-system, sans-serif;
    color: var(--hermes-ink);
}

/* -- Barre latérale ------------------------------------------------------ */

.app-sidebar {
    width: 200px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    box-sizing: border-box;
    background: linear-gradient(160deg, #34190A 0%, var(--hermes-panel-dark) 45%, var(--hermes-panel-dark-2) 100%);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 28px;
}

.app-brand span {
    font-family: 'Sora', system-ui, sans-serif;
    font-weight: 700;
    font-size: 17px;
    color: var(--hermes-panel-ink);
    letter-spacing: 0.01em;
}

.app-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.app-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    color: var(--hermes-panel-ink-soft);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.app-nav a svg {
    flex-shrink: 0;
    opacity: 0.85;
}

.app-nav a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--hermes-panel-ink);
}

.app-nav a.active {
    background: rgba(228, 98, 13, 0.18);
    color: var(--hermes-panel-ink);
    border-left-color: var(--hermes-accent);
}

.app-nav a.active svg {
    opacity: 1;
    color: var(--hermes-accent);
}

.app-user {
    padding-top: 16px;
    margin-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--hermes-accent-soft);
    color: var(--hermes-accent-on-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.app-user-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.app-user-info strong {
    font-size: 13px;
    font-weight: 600;
    color: var(--hermes-panel-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-user-info a {
    font-size: 12px;
    color: var(--hermes-panel-ink-soft);
    text-decoration: none;
}

.app-user-info a:hover {
    color: var(--hermes-accent);
    text-decoration: underline;
}

/* -- Zone de contenu ------------------------------------------------------ */

.app-content {
    flex: 1;
    min-width: 0;
    padding: 48px clamp(24px, 4vw, 56px);
}

/* -- Motifs de page (utilisés par les pages une fois connecté) ----------- */

.page-head {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 32px;
}

/* Variante avec un badge de statut aligné à droite (ex. "Inactif" sur la
   fiche article) — le .page-head imbriqué perd sa marge, portée par la barre. */
.page-head-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 32px;
}

.page-head-bar .page-head {
    margin-bottom: 0;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-action-btn {
    height: 34px;
    padding: 0 14px;
    border-radius: 6px;
    border: 1px solid var(--hermes-border);
    background: var(--hermes-surface);
    color: var(--hermes-accent-dark);
    font-family: 'Public Sans', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.page-action-btn:hover {
    background: var(--hermes-accent-soft);
    border-color: var(--hermes-accent);
}

.page-action-btn.is-active {
    background: var(--hermes-accent);
    border-color: var(--hermes-accent);
    color: #fff;
}

.page-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    background: none;
    border: none;
    padding: 0;
    font-family: 'Public Sans', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--hermes-accent-dark);
    text-decoration: none;
    cursor: pointer;
    margin-bottom: 16px;
}

.page-back-link:hover {
    color: var(--hermes-accent);
    text-decoration: underline;
}

.page-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--hermes-accent-soft);
    color: var(--hermes-accent-on-soft);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.page-head h1 {
    font-family: 'Sora', system-ui, sans-serif;
    font-size: 30px;
    font-weight: 600;
    color: var(--hermes-ink);
    margin: 0;
}

.page-lead {
    font-size: 15px;
    color: var(--hermes-ink-soft);
    margin: 0;
    max-width: 60ch;
}

.status-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    max-width: 560px;
    padding: 20px;
    background: var(--hermes-surface);
    border: 1px solid var(--hermes-accent-soft);
    border-radius: 10px;
}

.status-card svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.status-card h2 {
    font-family: 'Sora', system-ui, sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--hermes-ink);
    margin: 0 0 6px;
}

.status-card p {
    font-size: 13.5px;
    color: var(--hermes-ink-soft);
    line-height: 1.55;
    margin: 0;
}

.status-card code {
    font-size: 12px;
    background: var(--hermes-accent-soft);
    color: var(--hermes-accent-on-soft);
    padding: 1px 5px;
    border-radius: 4px;
}

/* -- Combobox de recherche (fiche article, réutilisable ailleurs) -------- */

.article-search {
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 28px;
}

.article-search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.article-search-box > svg:first-child {
    position: absolute;
    left: 14px;
    color: var(--hermes-ink-soft);
    pointer-events: none;
}

.article-search-input {
    width: 100%;
    height: 48px;
    padding: 0 42px;
    border-radius: 8px;
    border: 1px solid var(--hermes-border);
    background: var(--hermes-surface);
    color: var(--hermes-ink);
    font-family: 'Public Sans', system-ui, sans-serif;
    font-size: 15px;
    box-sizing: border-box;
}

.article-search-input:focus {
    outline: none;
    border-color: var(--hermes-accent);
    box-shadow: 0 0 0 3px var(--hermes-accent-soft);
}

.article-search-spinner {
    position: absolute;
    right: 14px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--hermes-accent-soft);
    border-top-color: var(--hermes-accent);
    animation: article-spin 0.7s linear infinite;
}

@keyframes article-spin {
    to {
        transform: rotate(360deg);
    }
}

.article-search-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--hermes-ink-soft);
    cursor: pointer;
    width: fit-content;
}

.article-results,
.article-results-empty {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 6px;
    background: var(--hermes-surface);
    border: 1px solid var(--hermes-border);
    border-radius: 10px;
    box-shadow: 0 12px 24px -12px rgba(27, 22, 17, 0.25);
    z-index: 20;
}

.article-results {
    max-height: 320px;
    overflow-y: auto;
    list-style: none;
    margin: 6px 0 0;
    padding: 6px;
}

.article-results li {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 6px;
    cursor: pointer;
}

.article-results li.highlighted,
.article-results li:hover {
    background: var(--hermes-accent-soft);
}

.article-code {
    font-family: 'Sora', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--hermes-ink);
    flex-shrink: 0;
}

.article-name {
    font-size: 13px;
    color: var(--hermes-ink-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.article-inactive-tag {
    margin-left: auto;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--hermes-danger);
    background: var(--hermes-danger-soft);
    padding: 2px 6px;
    border-radius: 999px;
    flex-shrink: 0;
}

.article-results-empty {
    padding: 14px;
    font-size: 13px;
    color: var(--hermes-ink-soft);
    text-align: center;
}

.article-search-error {
    font-size: 13px;
    color: var(--hermes-danger);
    margin: 0;
}

/* -- Panneau de stock (fiche article) ------------------------------------ */

.stock-panel {
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stock-panel-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stock-panel-head h2 {
    font-family: 'Sora', system-ui, sans-serif;
    font-size: 17px;
    font-weight: 600;
    color: var(--hermes-ink);
    margin: 0;
}

.stock-loading,
.stock-empty {
    font-size: 13.5px;
    color: var(--hermes-ink-soft);
    margin: 0;
}

.stock-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--hermes-border);
    border-radius: 10px;
}

.stock-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.stock-table th,
.stock-table td {
    padding: 10px 14px;
    text-align: left;
    white-space: nowrap;
}

.stock-table th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--hermes-ink-soft);
    background: var(--hermes-bg);
    border-bottom: 1px solid var(--hermes-border);
}

.stock-table td {
    color: var(--hermes-ink);
    border-bottom: 1px solid var(--hermes-border);
    font-variant-numeric: tabular-nums;
}

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

.stock-table tfoot td {
    border-top: 2px solid var(--hermes-border);
    border-bottom: none;
    font-weight: 700;
}

.stock-subtotal-row td {
    background: var(--hermes-accent-soft);
    color: var(--hermes-accent-dark);
    font-weight: 700;
    border-top: 1px solid var(--hermes-border);
    border-bottom: 1px solid var(--hermes-border);
}

.stock-table th.num,
.stock-table td.num {
    text-align: right;
}

.stock-table td.stock-disponible {
    font-weight: 700;
    color: var(--hermes-accent-dark);
}

.emplacement-link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--hermes-accent-dark);
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: transparent;
}

.emplacement-link:hover {
    color: var(--hermes-accent);
    text-decoration-color: currentColor;
}

.stock-detail {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--hermes-border);
}

.stock-detail-title {
    font-family: 'Sora', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--hermes-ink);
    margin: 0;
}

.stock-detail-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stock-detail-block h4 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--hermes-ink-soft);
    margin: 0;
}

/* -- Graphique "Évolution du stock" --------------------------------------- */

.chart-wrap {
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chart-legend {
    display: flex;
    gap: 20px;
    font-size: 12.5px;
    color: var(--hermes-ink-soft);
}

.chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.chart-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.chart-swatch-stock {
    background: var(--hermes-ink);
}

.chart-swatch-reception {
    background: var(--hermes-accent);
}

.chart-swatch-expedition {
    background: #5B84A8;
}

.chart-svg {
    width: 100%;
    height: auto;
    overflow: visible;
}

.chart-gridline {
    stroke: var(--hermes-border);
    stroke-width: 1;
}

.chart-zero-line {
    stroke: var(--hermes-ink-soft);
    stroke-width: 1;
}

.chart-axis-label {
    font-size: 10.5px;
    fill: var(--hermes-ink-soft);
    font-family: 'Public Sans', system-ui, sans-serif;
}

.chart-axis-label-y {
    text-anchor: end;
    dominant-baseline: middle;
}

.chart-axis-label-x {
    text-anchor: middle;
}

.chart-line {
    fill: none;
    stroke-width: 2;
}

.chart-line-stock {
    stroke: var(--hermes-ink);
}

.chart-line-reception {
    stroke: var(--hermes-accent);
}

.chart-line-expedition {
    stroke: #5B84A8;
}

.chart-dot {
    stroke: var(--hermes-surface);
    stroke-width: 1.5;
}

.chart-dot-stock {
    fill: var(--hermes-ink);
}

.chart-dot-reception {
    fill: var(--hermes-accent);
}

.chart-dot-expedition {
    fill: #5B84A8;
}

.chart-value-label {
    font-size: 9.5px;
    text-anchor: middle;
    font-family: 'Public Sans', system-ui, sans-serif;
}

.chart-value-label-stock {
    fill: var(--hermes-ink);
    font-weight: 600;
}

.chart-value-label-reception {
    fill: var(--hermes-accent-dark);
}

.chart-value-label-expedition {
    fill: #4A6C8C;
}

@media (max-width: 900px) {
    .app-shell {
        flex-direction: column;
    }

    .app-sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        padding: 16px 20px;
    }

    .app-brand {
        padding: 0 12px 0 0;
    }

    .app-nav {
        flex-direction: row;
        flex: none;
    }

    .app-user {
        margin: 0 0 0 auto;
        padding: 0;
        border: none;
    }
}
