/* Wakdo Admin — Design System
 * Palette neutre 90% + accent Wakdo yellow 10%
 * System font stack, no external dependencies
 * Desktop-first, optimise 1280px+
 */

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Neutrals */
    --color-white:       #FFFFFF;
    --color-page:        #F5F5F5;
    --color-border:      #E5E5E5;
    --color-border-dark: #D1D5DB;
    --color-text:        #1A1A1A;
    --color-text-sec:    #4A4A4A;
    --color-text-muted:  #6B7280;
    --color-surface:     #F9FAFB;

    /* Accent Wakdo — parcimonieux */
    --color-yellow:      #FFC72C;
    --color-yellow-bg:   #FFFBEB;
    --color-yellow-dark: #B8900B;

    /* Status */
    --color-success:     #10B981;
    --color-success-bg:  #D1FAE5;
    --color-success-text:#065F46;
    --color-warning:     #F59E0B;
    --color-warning-bg:  #FEF3C7;
    --color-warning-text:#92400E;
    --color-danger:      #EF4444;
    --color-danger-bg:   #FEE2E2;
    --color-danger-text: #991B1B;
    --color-neutral:     #9CA3AF;
    --color-neutral-bg:  #F3F4F6;
    --color-neutral-text:#374151;
    --color-info:        #3B82F6;
    --color-info-bg:     #DBEAFE;
    --color-info-text:   #1E40AF;

    /* Layout */
    --sidebar-width: 264px;
    --topbar-height: 72px;

    /* Typography */
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* Spacing */
    --radius-sm:  4px;
    --radius-md:  6px;
    --radius-lg:  8px;
    --radius-xl:  14px;
    --radius-card: 20px;

    /* Accent doux + ombres douces (direction A+C) */
    --color-yellow-soft: #FFF3D1;
    --color-yellow-ink:  #C8920A;
    --shadow-card:       0 1px 3px rgba(26,26,26,0.04), 0 6px 20px rgba(26,26,26,0.06);
    --shadow-card-hover: 0 2px 6px rgba(26,26,26,0.06), 0 12px 30px rgba(26,26,26,0.10);
}

html, body {
    height: 100%;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-page);
    -webkit-font-smoothing: antialiased;
}

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

button {
    font-family: var(--font);
    cursor: pointer;
}

/* Utilitaire lecteur d'ecran : retire du flux visuel, lu par les technologies
   d'assistance (regions live discretes type #pos-announce). */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* Message d'erreur de formulaire (global admin : erreurs de validation / serveur). */
.form-error {
    color: var(--color-danger-text);
    background: var(--color-danger-bg);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    margin: 6px 0;
    font-size: 14px;
}

/* Etat vide d'une liste / d'un catalogue (global admin). */
.admin-empty {
    color: var(--color-text-muted);
    padding: 16px 0;
}

/* --- Layout Shell --- */
.admin-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--topbar-height) 1fr;
    grid-template-areas:
        "sidebar topbar"
        "sidebar content";
    height: 100vh;
    overflow: hidden;
}

/* --- Topbar --- */
.topbar {
    grid-area: topbar;
    height: var(--topbar-height);
    background: var(--color-white);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    padding: 0 32px;
    gap: 16px;
    position: relative;
    z-index: 100;
}

.topbar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    width: calc(var(--sidebar-width) - 20px);
}

.topbar-logo img {
    height: 28px;
    width: auto;
}

.topbar-logo-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.02em;
}

.topbar-logo-sub {
    font-size: 11px;
    font-weight: 400;
    color: var(--color-text-muted);
    display: block;
    line-height: 1;
}

.topbar-search {
    flex: 1;
    max-width: 360px;
    position: relative;
}

.topbar-search input {
    width: 100%;
    height: 32px;
    padding: 0 12px 0 34px;
    border: 1px solid var(--color-border-dark);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-family: var(--font);
    color: var(--color-text);
    background: var(--color-page);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.topbar-search input:focus {
    border-color: var(--color-yellow);
    box-shadow: 0 0 0 2px rgba(255, 199, 44, 0.25);
    background: var(--color-white);
}

.topbar-search svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-user {
    position: relative;
}

.topbar-user-btn {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 6px 8px 6px 12px;
    border: none;
    border-radius: 999px;
    background: transparent;
    font-size: 14px;
    color: var(--color-text);
    cursor: pointer;
    transition: background 0.15s;
}

.topbar-user-btn:hover {
    background: var(--color-surface);
}

.topbar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.3px;
    color: var(--color-yellow);
    flex-shrink: 0;
}

.topbar-user-name {
    font-size: 14px;
    font-weight: 700;
}

.topbar-user-role {
    font-size: 11px;
    color: var(--color-text-muted);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    min-width: 180px;
    z-index: 200;
    display: none;
}

.dropdown-menu.open {
    display: block;
}

.dropdown-menu a,
.dropdown-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    font-size: 13px;
    color: var(--color-text);
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    transition: background 0.1s;
}

.dropdown-menu a:hover,
.dropdown-menu button:hover {
    background: var(--color-surface);
}

.dropdown-menu .divider {
    height: 1px;
    background: var(--color-border);
    margin: 4px 0;
}

.dropdown-menu .danger {
    color: var(--color-danger);
}

/* --- Sidebar --- */
.sidebar {
    grid-area: sidebar;
    width: var(--sidebar-width);
    background: var(--color-white);
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 14px 18px;
}

/* Marque en tete de sidebar (logo Wakdo) */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 10px 14px;
}

.sidebar-brand-logo {
    height: 34px;
    width: auto;
    flex-shrink: 0;
}

.sidebar-brand-name {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--color-text);
}

.sidebar-brand-name span {
    color: var(--color-yellow-ink);
}

.sidebar-section {
    padding: 12px 0 2px;
}

.sidebar-section-label {
    padding: 0 12px 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 44px;
    padding: 0 14px;
    margin: 2px 0;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-sec);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}

.sidebar-item:hover {
    background: var(--color-surface);
    color: var(--color-text);
}

.sidebar-item.active {
    background: var(--color-yellow-soft);
    color: var(--color-text);
    box-shadow: inset 3px 0 0 var(--color-yellow);
}

.sidebar-item svg {
    flex-shrink: 0;
    color: inherit;
}

.sidebar-item-sub {
    padding-left: 40px;
    font-weight: 500;
}

/* --- Content Area --- */
.content {
    grid-area: content;
    overflow-y: auto;
    padding: 24px;
}

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

.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
}

.page-subtitle {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: var(--color-yellow);
    color: var(--color-text);
    border-color: var(--color-yellow);
}

.btn-primary:hover {
    background: #f0b800;
    border-color: #f0b800;
}

.btn-secondary {
    background: var(--color-white);
    color: var(--color-text-sec);
    border-color: var(--color-border-dark);
}

.btn-secondary:hover {
    background: var(--color-surface);
    color: var(--color-text);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-sec);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--color-surface);
    color: var(--color-text);
}

.btn-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger-text);
    border-color: #FECACA;
}

.btn-danger:hover {
    background: #FECACA;
}

.btn-sm {
    height: 28px;
    padding: 0 10px;
    font-size: 12px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* --- KPI Cards --- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    padding: 24px;
    box-shadow: var(--shadow-card);
}

.kpi-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1;
    margin-bottom: 6px;
}

.kpi-delta {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    font-weight: 500;
}

.kpi-delta.up {
    color: var(--color-success);
}

.kpi-delta.down {
    color: var(--color-danger);
}

.kpi-delta.neutral {
    color: var(--color-text-muted);
}

.kpi-delta-sub {
    font-size: 11px;
    color: var(--color-text-muted);
    font-weight: 400;
    margin-left: 4px;
}

/* --- Toolbar / Filters --- */
.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-field {
    position: relative;
}

.search-field input {
    height: 32px;
    padding: 0 12px 0 32px;
    border: 1px solid var(--color-border-dark);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-family: var(--font);
    color: var(--color-text);
    background: var(--color-white);
    outline: none;
    width: 220px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.search-field input:focus {
    border-color: var(--color-yellow);
    box-shadow: 0 0 0 2px rgba(255, 199, 44, 0.25);
}

.search-field svg {
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
}

.filter-select {
    height: 32px;
    padding: 0 28px 0 10px;
    border: 1px solid var(--color-border-dark);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-family: var(--font);
    color: var(--color-text);
    background: var(--color-white);
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: border-color 0.15s;
}

.filter-select:focus {
    border-color: var(--color-yellow);
    box-shadow: 0 0 0 2px rgba(255, 199, 44, 0.25);
}

/* --- Data Table --- */
.table-container {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead th {
    background: var(--color-surface);
    padding: 10px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
    user-select: none;
}

thead th.sortable {
    cursor: pointer;
}

thead th.sortable:hover {
    background: var(--color-border);
    color: var(--color-text-sec);
}

thead th .sort-icon {
    display: inline-flex;
    flex-direction: column;
    margin-left: 4px;
    vertical-align: middle;
    opacity: 0.4;
}

thead th.sort-asc .sort-icon,
thead th.sort-desc .sort-icon {
    opacity: 1;
    color: var(--color-yellow-dark);
}

tbody tr {
    border-bottom: 1px solid var(--color-border);
    transition: background 0.1s;
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--color-surface);
}

tbody td {
    padding: 10px 14px;
    color: var(--color-text);
    vertical-align: middle;
}

tbody td.muted {
    color: var(--color-text-muted);
}

tbody td.mono {
    font-family: "SF Mono", "Cascadia Mono", "Consolas", monospace;
    font-size: 12px;
}

/* --- Status Pill --- */
.pill {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.pill-success {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.pill-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
}

.pill-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger-text);
}

.pill-neutral {
    background: var(--color-neutral-bg);
    color: var(--color-neutral-text);
}

.pill-info {
    background: var(--color-info-bg);
    color: var(--color-info-text);
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--color-border);
    font-size: 13px;
    color: var(--color-text-muted);
}

.pagination-info {
    font-size: 12px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-btn {
    height: 28px;
    min-width: 28px;
    padding: 0 8px;
    border: 1px solid var(--color-border-dark);
    border-radius: var(--radius-sm);
    background: var(--color-white);
    font-size: 12px;
    font-family: var(--font);
    color: var(--color-text-sec);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s, border-color 0.1s;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--color-surface);
    border-color: var(--color-text-muted);
}

.pagination-btn.active {
    background: var(--color-yellow);
    border-color: var(--color-yellow);
    color: var(--color-text);
    font-weight: 600;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* --- Action Menu (kebab) --- */
.action-menu {
    position: relative;
    display: inline-block;
}

.action-menu-btn {
    width: 28px;
    height: 28px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: background 0.1s, border-color 0.1s;
}

.action-menu-btn:hover,
.action-menu-btn.open {
    background: var(--color-surface);
    border-color: var(--color-border-dark);
    color: var(--color-text);
}

.action-menu-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    width: 160px;
    z-index: 150;
    display: none;
}

.action-menu-dropdown.open {
    display: block;
}

.action-menu-dropdown a,
.action-menu-dropdown button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--color-text);
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: var(--font);
    transition: background 0.1s;
}

.action-menu-dropdown a:hover,
.action-menu-dropdown button:hover {
    background: var(--color-surface);
}

.action-menu-dropdown .danger {
    color: var(--color-danger);
}

.action-menu-dropdown .divider {
    height: 1px;
    background: var(--color-border);
    margin: 3px 0;
}

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

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-sec);
    margin-bottom: 5px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border-dark);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-family: var(--font);
    color: var(--color-text);
    background: var(--color-white);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--color-yellow);
    box-shadow: 0 0 0 2px rgba(255, 199, 44, 0.25);
}

.form-helper {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
    cursor: pointer;
}

/* --- Cards --- */
.card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.card-body {
    padding: 20px;
}

/* --- Tabs --- */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 20px;
}

.tab-btn {
    height: 38px;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
    font-family: var(--font);
}

.tab-btn:hover {
    color: var(--color-text);
}

.tab-btn.active {
    color: var(--color-text);
    font-weight: 600;
    border-bottom-color: var(--color-yellow);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* --- Product thumbnail --- */
.thumb {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    object-fit: cover;
    flex-shrink: 0;
}

.thumb-placeholder {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* --- Kitchen Cards --- */
.kitchen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.kitchen-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.kitchen-card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--color-surface);
}

.kitchen-order-num {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
}

.kitchen-order-time {
    font-size: 12px;
    color: var(--color-text-muted);
}

.kitchen-card-body {
    padding: 12px 16px;
}

.kitchen-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--color-border);
}

.kitchen-line:last-child {
    border-bottom: none;
}

.kitchen-qty {
    font-weight: 600;
    color: var(--color-text-muted);
    margin-right: 8px;
    min-width: 20px;
}

.kitchen-card-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* --- KDS : detail des articles --- */
.kds-items {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
}

.kds-item {
    font-size: 13px;
    line-height: 1.35;
    padding: 4px 0;
    border-top: 1px solid var(--color-border);
    color: var(--color-text);
}

.kds-item:first-child {
    border-top: none;
}

/* --- KDS : bande SLA (now - paid_at), calculee cote serveur --- */
/* Bande couleur a gauche de la carte : vert < 5 min, ambre 5-10 min, rouge > 10 min. */
.kds-order--fresh {
    border-left: 4px solid var(--color-success);
}

.kds-order--warn {
    border-left: 4px solid var(--color-warning);
    background: var(--color-warning-bg);
}

.kds-order--late {
    border-left: 4px solid var(--color-danger);
    background: var(--color-danger-bg);
}

.kitchen-clock {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
}

/* --- Login page --- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-page);
    padding: 24px;
}

.login-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-top: 3px solid var(--color-yellow);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.04);
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 28px;
}

.login-logo img {
    height: 48px;
    width: auto;
    margin-bottom: 10px;
}

.login-logo-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
}

.login-logo-sub {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.login-card .btn-primary {
    width: 100%;
    height: 40px;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

.login-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.login-footer a {
    color: var(--color-text-sec);
    text-decoration: underline;
}

/* Alertes (formulaires auth : login, mot de passe oublie, reinitialisation) */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    margin-bottom: 16px;
}

.alert-error {
    background: var(--color-danger-bg);
    color: var(--color-danger-text);
    border: 1px solid #FECACA;
}

.alert-info {
    background: var(--color-info-bg);
    color: var(--color-info-text);
    border: 1px solid #BFDBFE;
}

/* --- Misc utilities --- */
.text-muted {
    color: var(--color-text-muted);
}

.text-sm {
    font-size: 12px;
}

.text-right {
    text-align: right;
}

.font-mono {
    font-family: "SF Mono", "Cascadia Mono", "Consolas", monospace;
    font-size: 12px;
}

.fw-600 {
    font-weight: 600;
}

.d-flex {
    display: flex;
}

.align-center {
    align-items: center;
}

.gap-8 {
    gap: 8px;
}

.mt-16 {
    margin-top: 16px;
}

.mb-16 {
    margin-bottom: 16px;
}

.w-full {
    width: 100%;
}

.section-block {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
}

.section-block .card-header {
    background: var(--color-surface);
}

/* --- Scrollbar (webkit) --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--color-border-dark);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* ============================================================
   Statistiques — cartes KPI (tableau de bord stats.read)
   ============================================================ */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
}

.stat-card__value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.1;
}

.stat-card__label {
    font-weight: 600;
    color: var(--color-text);
    margin-top: 0.25rem;
}

.stat-card__sub {
    font-size: 0.875rem;
    margin-top: 0.125rem;
}

/* --- Dashboard (direction A+C) : tuiles + feed d'activite --- */
.dash-tiles {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 22px;
    margin-bottom: 28px;
}

.tile {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    padding: 24px;
    box-shadow: var(--shadow-card);
    transition: box-shadow 0.2s, transform 0.2s;
}
.tile:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-3px); }

.tile-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }

.tile-ico {
    width: 54px; height: 54px;
    border-radius: 15px;
    background: var(--color-yellow);
    color: var(--color-text);
    display: flex; align-items: center; justify-content: center;
}
.tile.alert .tile-ico { background: var(--color-danger); color: #fff; }

.tile-tag {
    font-size: 12px; font-weight: 700;
    color: var(--color-success-text);
    background: var(--color-success-bg);
    padding: 5px 11px;
    border-radius: 999px;
}
.tile.alert .tile-tag { color: var(--color-danger-text); background: var(--color-danger-bg); }

.tile-value { font-size: 40px; font-weight: 800; letter-spacing: -1.5px; line-height: 1; }
.tile.alert .tile-value { color: var(--color-danger); }

.tile-label { font-size: 15px; font-weight: 600; color: var(--color-text-sec); margin-top: 8px; }

.feed-panel {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}
.feed-head {
    padding: 22px 26px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--color-border);
}
.feed-title { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; }
.feed-hint { font-size: 13px; color: var(--color-text-muted); margin-top: 2px; }
.feed-link {
    font-size: 14px; font-weight: 700; color: var(--color-text);
    text-decoration: none; background: var(--color-page);
    padding: 9px 16px; border-radius: 10px; transition: background 0.18s;
}
.feed-link:hover { background: var(--color-yellow-soft); }

.feed-list { list-style: none; }
.feed-item {
    display: flex; align-items: center; gap: 18px;
    padding: 18px 26px;
    border-top: 1px solid var(--color-border);
}
.feed-item:first-child { border-top: none; }
.feed-item:hover { background: var(--color-surface); }

.feed-ico {
    width: 44px; height: 44px;
    border-radius: 13px;
    background: var(--color-yellow-soft);
    color: var(--color-yellow-ink);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.feed-ico.red { background: var(--color-danger-bg); color: var(--color-danger); }
.feed-ico.green { background: var(--color-success-bg); color: var(--color-success-text); }

.feed-body { flex: 1; }
.feed-text { font-size: 15px; font-weight: 600; color: var(--color-text); }
.feed-text b { font-weight: 800; }
.feed-meta { font-size: 13px; color: var(--color-text-muted); margin-top: 2px; }
.feed-time { font-size: 13px; color: var(--color-text-muted); font-weight: 600; white-space: nowrap; }

/* --- Modal PIN (re-autorisation au moment de l'action sensible) --- */
.pin-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 26, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}
.pin-modal-overlay.open { display: flex; }

.pin-modal {
    background: var(--color-white);
    border-radius: var(--radius-card);
    border-top: 3px solid var(--color-yellow);
    box-shadow: var(--shadow-card-hover);
    width: 100%;
    max-width: 400px;
    padding: 28px;
}
.pin-modal-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
.pin-modal-ico {
    width: 44px; height: 44px; flex-shrink: 0;
    border-radius: 13px;
    background: var(--color-yellow-soft);
    color: var(--color-yellow-ink);
    display: flex; align-items: center; justify-content: center;
}
.pin-modal-title { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; }
.pin-modal-sub { font-size: 13px; color: var(--color-text-muted); margin-top: 3px; }
.pin-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* --- Matrice de droits d'acces groupee (formulaire Roles humanise) --- */
.perm-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-top: 10px;
}
.perm-group {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    background: var(--color-surface);
}
.perm-group-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--color-text);
}
.perm-opt {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--color-text-sec);
    margin: 3px 14px 3px 0;
}
@media (max-width: 700px) {
    .perm-grid { grid-template-columns: 1fr; }
}

/* Fieldsets de formulaire : pas de bordure native ; la legende = titre de section. */
.form-card fieldset {
    border: none;
    padding: 0;
    margin: 0;
}
.form-card legend {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
    padding: 0;
    margin-bottom: 4px;
}

/* =============================================================================
   POS tactile a tuiles comptoir/drive (counter-order.js + admin/counter/new.php)
   Ecran de caisse facon borne : onglets categories, grille de tuiles, panneau
   commande persistant (lignes + stepper + total), modale de composition.
   Cibles tactiles superieures ou egales a 44px (usage tablette).
   ============================================================================= */

/* Mode de service fige (drive) : affichage non editable a la place du select. */
.form-static {
    font-weight: 700;
    color: var(--color-text);
    padding: 8px 0;
    margin: 0;
}

/* Disposition POS : catalogue a gauche (flex 1), panneau commande a droite (fixe). */
.pos { margin: 0; }
.pos__main {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}
.pos__catalogue {
    flex: 1 1 auto;
    min-width: 0;
}

/* Onglets categories : bandeau scrollable horizontal (un onglet par categorie). */
.pos__tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
    -webkit-overflow-scrolling: touch;
}
.pos__tab {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 10px 18px;
    border: 2px solid var(--color-border-dark);
    border-radius: var(--radius-pill, 9999px);
    background: var(--color-white);
    color: var(--color-text-sec);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.pos__tab:hover,
.pos__tab:focus-visible {
    border-color: var(--color-yellow);
    color: var(--color-text);
    outline: none;
}
.pos__tab.is-active {
    border-color: var(--color-yellow);
    background: var(--color-yellow);
    color: var(--color-text);
}

/* Grille de tuiles produits/menus : auto-fit, grandes cibles tactiles. */
.pos__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}
.pos__nojs {
    grid-column: 1 / -1;
    color: var(--color-text-muted);
    padding: 16px 0;
}

/* Tuile : image/pastille + nom + prix. Bouton plein (tap = ajout ou modale). */
.pos-tile {
    display: flex;
    flex-direction: column;
    min-height: 44px;
    padding: 0;
    background: var(--color-white);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    cursor: pointer;
    text-align: left;
    position: relative;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}
.pos-tile:hover,
.pos-tile:focus-visible {
    border-color: var(--color-yellow);
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
    outline: none;
}
.pos-tile:active { transform: translateY(0); box-shadow: var(--shadow-card); }

.pos-tile__media {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.pos-tile__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
    background: var(--color-surface);
}
/* Pastille de repli (initiale) quand aucune image n'est disponible cote back-office. */
.pos-tile__pastille {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-yellow-soft, #FFF3D1);
    color: var(--color-yellow-ink, #C8920A);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
}
.pos-tile__body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px 12px;
    flex: 1;
}
.pos-tile__name {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.25;
}
.pos-tile__price {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-sec);
    font-variant-numeric: tabular-nums;
}
/* Badge "Menu" / "A composer" sur une tuile qui ouvre la modale au tap. */
.pos-tile__badge {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    background: var(--color-text);
    color: var(--color-white);
    font-size: 11px;
    font-weight: 700;
}

/* Rupture de stock (RG-T21, parite borne product-card--unavailable) : tuile visible
   mais non commandable. Grisee, curseur interdit, sans effet de survol (l'etat ne
   ment pas) ; le tap est neutralise cote JS (return precoce). */
.pos-tile--unavailable {
    opacity: 0.55;
    filter: grayscale(0.6);
    cursor: not-allowed;
}
.pos-tile--unavailable:hover,
.pos-tile--unavailable:focus-visible {
    border-color: var(--color-border);
    box-shadow: var(--shadow-card);
    transform: none;
}
/* Badge "Indisponible" : pose en haut a gauche pour ne pas chevaucher le badge
   "Menu"/"A composer" (top-right) sur une tuile menu en rupture. */
.pos-tile__badge--unavailable {
    right: auto;
    left: 8px;
    background: var(--color-brand-dark, var(--color-text));
}

/* Panneau commande persistant a droite (facon caisse). */
.pos__panel {
    flex: 0 0 340px;
    position: sticky;
    top: 16px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 32px);
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}
.pos__panel-head {
    padding: 16px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.pos__panel-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--color-text);
}
.pos__service {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pos__service-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text-sec);
    min-width: 48px;
}
.pos__service .form-input { flex: 1; min-height: 44px; }

/* Lignes du panier (corps scrollable du panneau). */
.order-cart {
    list-style: none;
    padding: 0 16px;
    margin: 0;
    overflow-y: auto;
    flex: 1 1 auto;
}
.order-cart__empty { color: var(--color-text-muted); padding: 16px 0; }
.order-cart__line {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}
.order-cart__main {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}
.order-cart__label { font-weight: 600; flex: 1; }
.order-cart__price { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.order-cart__controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.order-cart__qty {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.order-cart__qty-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    border: 2px solid var(--color-border-dark);
    background: var(--color-white);
    font-size: 20px;
    font-weight: 800;
    color: var(--color-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.12s ease, background 0.12s ease;
}
.order-cart__qty-btn:hover,
.order-cart__qty-btn:focus-visible {
    border-color: var(--color-yellow);
    background: var(--color-yellow-bg);
    outline: none;
}
.order-cart__qty-value {
    min-width: 32px;
    text-align: center;
    font-size: 16px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* Pied du panneau : total indicatif + bouton d'encaissement (pleine largeur). */
.pos__panel-foot {
    padding: 16px;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
}
.order-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    font-size: 18px;
    font-weight: 800;
    margin: 0 0 12px;
}
.order-total span { font-variant-numeric: tabular-nums; }
.pos__pay {
    width: 100%;
    min-height: 52px;
    font-size: 17px;
}

/* Tablette etroite / portrait : le panneau passe sous le catalogue. */
@media (max-width: 860px) {
    .pos__main { flex-direction: column; }
    .pos__panel {
        flex-basis: auto;
        width: 100%;
        position: static;
        max-height: none;
    }
    .order-cart { max-height: 320px; }
}

/* Modale de composition : overlay + panneau centre. */
.menu-composer__overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 26, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}
.menu-composer {
    background: var(--color-white);
    border-radius: var(--radius-card);
    border-top: 3px solid var(--color-yellow);
    box-shadow: var(--shadow-card-hover);
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
}
.menu-composer__title { font-size: 18px; font-weight: 800; margin-bottom: 14px; }
.menu-composer__legend { font-weight: 600; margin: 12px 0 4px; }
.menu-composer__slot, .menu-composer__format, .menu-composer__modifiers { margin-bottom: 10px; }
.menu-composer__radio, .menu-composer__modifier {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 3px 14px 3px 0;
}
.menu-composer__error {
    color: var(--color-danger-text);
    background: var(--color-danger-bg);
    border-radius: var(--radius-md);
    padding: 8px 10px;
    margin: 10px 0;
    font-size: 14px;
}
/* Le <p role=alert> reste dans le DOM en permanence (annonce lecteur d'ecran) ;
   tant qu'il est vide, on l'efface visuellement pour ne pas afficher un bloc vide. */
.menu-composer__error:empty {
    display: none;
}
.menu-composer__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

/* --- Stock dashboard (page d'accueil ingredients) --- */
.stock-explainer {
    background: var(--color-yellow-bg);
    border: 1px solid var(--color-yellow-soft);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-text-sec);
    margin-bottom: 20px;
}

/* Variante d'alerte du meme bandeau (rappel de revue allergenes, F11b) : le jaune de
   fond est deja celui de l'explication de la page, on ne le distingue que par la
   bordure et la couleur du texte. */
.stock-explainer--warning {
    background: var(--color-warning-bg);
    border-color: var(--color-warning);
    color: var(--color-warning-text);
}

.stock-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.stock-summary__item {
    display: flex;
    align-items: baseline;
    gap: 10px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-left-width: 4px;
    border-radius: var(--radius-card);
    padding: 18px 22px;
    box-shadow: var(--shadow-card);
}

.stock-summary__item--danger  { border-left-color: var(--color-danger); }
.stock-summary__item--warning { border-left-color: var(--color-warning); }
.stock-summary__item--success { border-left-color: var(--color-success); }

.stock-summary__count {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    color: var(--color-text);
}

.stock-summary__item--danger  .stock-summary__count { color: var(--color-danger-text); }
.stock-summary__item--warning .stock-summary__count { color: var(--color-warning-text); }
.stock-summary__item--success .stock-summary__count { color: var(--color-success-text); }

.stock-summary__label {
    font-size: 13px;
    color: var(--color-text-muted);
}

.stock-section {
    margin-bottom: 32px;
}

.stock-section__title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 14px;
}

.stock-empty {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    font-size: 14px;
    color: var(--color-text-muted);
}

.stock-empty--ok {
    background: var(--color-success-bg);
    border-color: var(--color-success-bg);
    color: var(--color-success-text);
}

/* Barre de niveau : conteneur gris + portion remplie coloree selon la bande. */
.stock-bar {
    height: 8px;
    background: var(--color-neutral-bg);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.stock-bar__fill {
    display: block;
    height: 100%;
    border-radius: var(--radius-sm);
}

.stock-bar--critical { background: var(--color-danger); }
.stock-bar--low      { background: var(--color-warning); }
.stock-bar--normal   { background: var(--color-success); }

.stock-bar__meta {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 12px;
}

.stock-bar__pct { font-weight: 600; color: var(--color-text); }
.stock-bar__qty { color: var(--color-text-muted); }

/* Section "A reapprovisionner" : cartes mises en avant. */
.stock-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
    gap: 16px;
}

.stock-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-top-width: 3px;
    border-radius: var(--radius-card);
    padding: 16px 18px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stock-card--critical { border-top-color: var(--color-danger); }
.stock-card--low      { border-top-color: var(--color-warning); }

.stock-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.stock-card__name {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
}

.stock-card__unit {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-left: 6px;
}

.stock-card__action {
    height: 44px;
    justify-content: center;
    width: 100%;
}

/* Section "Tous les ingredients" : liste calme, actions secondaires discretes. */
.stock-list {
    list-style: none;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.stock-list__row {
    display: grid;
    grid-template-columns: 1fr 200px auto;
    align-items: center;
    gap: 20px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--color-border);
}

.stock-list__row:last-child {
    border-bottom: none;
}

.stock-list__main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.stock-list__name {
    font-weight: 600;
    color: var(--color-text);
}

.stock-list__unit {
    font-size: 12px;
    color: var(--color-text-muted);
}

.stock-list__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.stock-list__crud {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding-left: 6px;
    margin-left: 2px;
    border-left: 1px solid var(--color-border);
}

.stock-list__inline-form {
    display: inline;
}

@media (max-width: 900px) {
    .stock-summary {
        grid-template-columns: 1fr;
    }
    .stock-list__row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .stock-list__actions {
        justify-content: flex-start;
    }
}

/* Bandeau de confirmation (flash succes, pose par setFlash apres redirection) et sa
   variante erreur (re-rendu 422 du reglage rapide de seuils, F13). */
.flash {
    color: var(--color-success-text);
    background: var(--color-success-bg);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 14px;
}
.flash-error {
    color: var(--color-danger-text);
    background: var(--color-danger-bg);
}

/* Aide sous un champ de formulaire (texte explicatif, pas une erreur). */
.form-hint {
    color: var(--color-text-muted);
    font-size: 12px;
    margin-top: 4px;
}

/* Zone d'actions d'une carte a reapprovisionner : reappro + reglage des seuils empiles. */
.stock-card__actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.stock-card__actions .btn-sm {
    width: 100%;
    justify-content: center;
}

/* Mini-graphe CA du tableau de bord (SVG inline genere serveur, CSP-safe). */
.dash-chart {
    display: block;
    width: 100%;
    height: auto;
    max-width: 720px;
    margin: 4px 0 8px;
}
.dash-chart .dash-bar {
    fill: var(--color-yellow);
}
.dash-chart .dash-axis {
    stroke: var(--color-border-dark);
    stroke-width: 1;
}
.dash-chart .dash-label {
    fill: var(--color-text-muted);
    font-size: 13px;
}

/* Badge d'etat de preparation sur les cartes du KDS (retour oral #8). */
.kitchen-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--color-neutral-bg);
    color: var(--color-neutral-text);
}
.kitchen-status--preparing {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
}
.kitchen-status--ready {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

/* --- Produits par categorie (vue groupee back-office, F20) ------------------
   Bloc dedie plutot que reemploi des classes stock-* : ces noms designent la page
   Stock, les recycler ici rendrait la feuille illisible. Aucun selecteur existant
   n'est modifie. */
.catalogue-explainer {
    background: var(--color-yellow-bg);
    border-left: 4px solid var(--color-yellow);
    border-radius: var(--radius-card, 8px);
    padding: 14px 16px;
    margin-bottom: 20px;
    color: var(--color-text-sec);
    font-size: 14px;
    line-height: 1.5;
}

.catalogue-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.catalogue-summary__item {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-neutral);
    border-radius: var(--radius-card, 8px);
    box-shadow: var(--shadow-card, 0 1px 2px rgba(0, 0, 0, 0.05));
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.catalogue-summary__item--success {
    border-left-color: var(--color-success);
}
.catalogue-summary__item--warning {
    border-left-color: var(--color-warning);
}
.catalogue-summary__count {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.1;
}
.catalogue-summary__label {
    font-size: 13px;
    color: var(--color-text-muted);
}

.catalogue-group {
    margin-bottom: 28px;
}
.catalogue-group__head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
}
.catalogue-group__title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}
.catalogue-group__count {
    font-size: 13px;
    color: var(--color-text-muted);
}
/* Une categorie desactivee reste lisible mais visiblement en retrait : son contenu
   n'atteint pas la borne, le contraste attenue double le message textuel. */
.catalogue-group--hidden .catalogue-group__title,
.catalogue-group--hidden .catalogue-card__name {
    color: var(--color-text-muted);
}
.catalogue-group__note {
    background: var(--color-surface);
    border-left: 4px solid var(--color-neutral);
    border-radius: var(--radius-card, 8px);
    padding: 10px 14px;
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--color-text-sec);
    line-height: 1.5;
}

.catalogue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
    gap: 14px;
}
.catalogue-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card, 8px);
    box-shadow: var(--shadow-card, 0 1px 2px rgba(0, 0, 0, 0.05));
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.catalogue-card__name {
    font-weight: 600;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.catalogue-card__price {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
}
.catalogue-card__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
}
.catalogue-card__actions {
    margin-top: 4px;
}

.catalogue-empty {
    background: var(--color-surface);
    border: 1px dashed var(--color-border-dark);
    border-radius: var(--radius-card, 8px);
    padding: 16px;
    color: var(--color-text-muted);
    font-size: 14px;
}

@media (max-width: 720px) {
    .catalogue-summary {
        grid-template-columns: 1fr;
    }
    .catalogue-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Revue des allergenes d'un ingredient (F11b)
   ==========================================================================
   Deux blocs : l'etat de revue (bandeau) et la matrice des 14 cases. Le bandeau
   "jamais revu" est volontairement voyant : c'est la difference entre "aucun
   allergene" et "personne n'a verifie", et l'equipier doit la voir sans la
   chercher. */

.allergen-review {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: var(--color-surface);
    border-left: 4px solid var(--color-border-dark);
    color: var(--color-text-sec);
    margin-bottom: 16px;
}

.allergen-review--none {
    background: var(--color-warning-bg);
    border-left-color: var(--color-warning);
    color: var(--color-warning-text);
}

.allergen-matrix {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 8px 20px;
}

.allergen-matrix li {
    padding: 8px 10px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.allergen-matrix .form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    cursor: pointer;
}

.allergen-matrix small {
    display: block;
    margin-top: 4px;
    color: var(--color-text-muted);
}

@media (max-width: 640px) {
    .allergen-matrix {
        grid-template-columns: 1fr;
    }
}
