/* G_Restaurant : plan de salle, prise de commande, ecran cuisine, additions. */
:root {
  --resto-libre: #16a34a;
  --resto-occupee: #dc2626;
  --resto-addition: #d97706;
  --resto-nettoyer: #64748b;
  --resto-reservee: #2563eb;
  --resto-card: #ffffff;
  --resto-muted: #f1f5f9;
  --resto-border: #e2e8f0;
  --resto-text: #0f172a;
  --resto-soft-text: #475569;
}
body.theme-dark {
  --resto-card: #1e293b;
  --resto-muted: #0f172a;
  --resto-border: #334155;
  --resto-text: #e2e8f0;
  --resto-soft-text: #94a3b8;
}

.resto-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.resto-toolbar .form-select, .resto-toolbar .form-control { width: auto; }
.resto-legend { display: flex; flex-wrap: wrap; gap: .75rem; font-size: .85rem; color: var(--resto-soft-text); }
.resto-legend span::before { content: ""; display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .3rem; vertical-align: -1px; background: var(--dot); }

/* Plan de salle */
.resto-zone { margin-bottom: 1.5rem; }
.resto-zone h3 { font-size: 1rem; font-weight: 600; color: var(--resto-soft-text); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .6rem; }
.resto-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.resto-table {
  position: relative; display: flex; flex-direction: column; gap: .2rem; min-height: 120px; width: 100%;
  padding: .75rem; border-radius: .75rem; border: 2px solid var(--etat); background: var(--resto-card);
  color: var(--resto-text); text-align: left; text-decoration: none; cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06); transition: transform .1s ease, box-shadow .1s ease;
}
.resto-table:hover, .resto-table:focus-visible { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(15, 23, 42, .12); }
.resto-table.is-ronde { border-radius: 2rem; }
.resto-table[disabled], .resto-table.is-locked { cursor: not-allowed; opacity: .7; }
.resto-table-num { font-size: 1.35rem; font-weight: 700; line-height: 1.1; }
.resto-table-etat { font-size: .75rem; font-weight: 600; color: #fff; background: var(--etat); border-radius: 999px; padding: .05rem .5rem; align-self: flex-start; }
.resto-table-meta { font-size: .8rem; color: var(--resto-soft-text); }
.resto-table-total { margin-top: auto; font-weight: 700; }
.resto-table-badge { position: absolute; top: .5rem; right: .5rem; }
.etat-libre { --etat: var(--resto-libre); }
.etat-occupee { --etat: var(--resto-occupee); }
.etat-addition { --etat: var(--resto-addition); }
.etat-nettoyer { --etat: var(--resto-nettoyer); }
.etat-reservee { --etat: var(--resto-reservee); }
.resto-counters { display: flex; flex-wrap: wrap; gap: .5rem; }
.resto-counter { border-radius: .6rem; padding: .35rem .75rem; background: var(--resto-muted); border-left: 4px solid var(--etat); font-size: .85rem; }
.resto-counter strong { font-size: 1.1rem; margin-right: .25rem; }

/* Prise de commande */
.resto-order { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: 1rem; align-items: start; }
@media (max-width: 991.98px) { .resto-order { grid-template-columns: 1fr; } }
.resto-panel { background: var(--resto-card); border: 1px solid var(--resto-border); border-radius: .75rem; padding: 1rem; color: var(--resto-text); }
.resto-ticket { position: sticky; top: 70px; display: flex; flex-direction: column; max-height: calc(100vh - 90px); }
.resto-ticket-lines { overflow-y: auto; flex: 1 1 auto; margin: .5rem -1rem; padding: 0 1rem; }
.resto-cats { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .4rem; margin-bottom: .6rem; }
.resto-cats .btn { white-space: nowrap; }
.resto-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .6rem; max-height: calc(100vh - 260px); overflow-y: auto; }
.resto-product {
  display: flex; flex-direction: column; justify-content: space-between; min-height: 92px; padding: .6rem; text-align: left;
  border: 1px solid var(--resto-border); border-radius: .6rem; background: var(--resto-muted); color: var(--resto-text);
}
.resto-product:hover, .resto-product:focus-visible { border-color: #2563eb; outline: none; box-shadow: 0 0 0 .15rem rgba(37, 99, 235, .25); }
.resto-product img { width: 100%; height: 64px; object-fit: cover; border-radius: .4rem; margin-bottom: .35rem; }
.resto-product-name { font-weight: 600; font-size: .9rem; line-height: 1.2; }
.resto-product-price { font-size: .85rem; color: var(--resto-soft-text); margin-top: .25rem; }
.resto-line { border-bottom: 1px dashed var(--resto-border); padding: .45rem 0; }
.resto-line:last-child { border-bottom: 0; }
.resto-line-head { display: flex; gap: .5rem; align-items: baseline; }
.resto-line-name { flex: 1 1 auto; font-weight: 600; }
.resto-line-name.is-cancelled { text-decoration: line-through; color: var(--resto-soft-text); }
.resto-line-sub { font-size: .78rem; color: var(--resto-soft-text); display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.resto-line-actions { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .3rem; }
.resto-line-actions .btn { padding: .1rem .45rem; font-size: .78rem; }
.resto-qty { display: inline-flex; align-items: center; gap: .25rem; }
.resto-qty .btn { width: 1.9rem; height: 1.9rem; padding: 0; }
.resto-pill { display: inline-block; font-size: .7rem; font-weight: 600; border-radius: 999px; padding: .05rem .45rem; background: var(--resto-muted); border: 1px solid var(--resto-border); }
.resto-pill.st-EN_ATTENTE { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.resto-pill.st-ENVOYEE, .resto-pill.st-EN_PREPARATION { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.resto-pill.st-PRETE { background: #dcfce7; color: #166534; border-color: #86efac; }
.resto-pill.st-SERVIE { background: #e2e8f0; color: #334155; }
.resto-pill.st-ANNULEE { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.resto-course-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--resto-soft-text); margin-top: .4rem; }
.resto-total { display: flex; justify-content: space-between; font-size: 1.25rem; font-weight: 700; border-top: 2px solid var(--resto-border); padding-top: .5rem; }
.resto-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; margin-top: .6rem; }
.resto-actions .btn-lg { grid-column: 1 / -1; }

/* Ecran cuisine (KDS) */
.kds-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .9rem; }
.kds-bon { background: var(--resto-card); color: var(--resto-text); border-radius: .75rem; border-top: 8px solid var(--kds); box-shadow: 0 2px 6px rgba(15, 23, 42, .12); display: flex; flex-direction: column; }
.kds-bon.st-A_FAIRE { --kds: #2563eb; }
.kds-bon.st-EN_COURS { --kds: #d97706; }
.kds-bon.st-PRET { --kds: #16a34a; }
.kds-bon.st-SERVI { --kds: #94a3b8; opacity: .65; }
.kds-bon.is-late { box-shadow: 0 0 0 3px #dc2626; }
.kds-bon.type-ANNULATION { --kds: #dc2626; background: #fef2f2; color: #7f1d1d; }
.kds-head { padding: .6rem .8rem; border-bottom: 1px solid var(--resto-border); }
.kds-dest { font-size: 1.3rem; font-weight: 700; }
.kds-meta { font-size: .8rem; color: var(--resto-soft-text); display: flex; justify-content: space-between; gap: .5rem; }
.kds-lines { list-style: none; margin: 0; padding: .6rem .8rem; flex: 1 1 auto; }
.kds-lines li { font-size: 1.1rem; font-weight: 600; padding: .15rem 0; }
.kds-lines li.is-cancelled { text-decoration: line-through; color: #dc2626; }
.kds-lines .kds-note { display: block; font-size: .85rem; font-weight: 700; color: #b45309; }
.kds-foot { display: flex; gap: .4rem; padding: .6rem .8rem; border-top: 1px solid var(--resto-border); }
.kds-foot .btn { flex: 1 1 auto; }
.kds-timer { font-variant-numeric: tabular-nums; font-weight: 700; }
.kds-fullscreen .sidebar, .kds-fullscreen #header { display: none !important; }
.kds-fullscreen #main { margin-left: 0 !important; margin-top: 0 !important; padding-top: 1rem; }

/* Additions */
.resto-additions { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.resto-addition.is-paid { opacity: .75; }
.resto-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.resto-kpi { background: var(--resto-card); border: 1px solid var(--resto-border); border-radius: .75rem; padding: .75rem 1rem; color: var(--resto-text); }
.resto-kpi-label { font-size: .78rem; color: var(--resto-soft-text); text-transform: uppercase; letter-spacing: .03em; }
.resto-kpi-value { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.resto-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.resto-bar { height: .45rem; border-radius: 999px; background: #2563eb; min-width: 2px; }
.resto-config-section { scroll-margin-top: 80px; }
