:root {
  --navy: #16264a;
  --navy-dark: #0d1830;
  --red: #c3122e;
  --red-dark: #8f0d22;
  --cream: #f3e9dd;
  --cream-dark: #e7d9c6;
  --ink: #201a14;
  --white: #ffffff;
  --radius: 14px;
  --shadow: 0 6px 18px rgba(13, 24, 48, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Segoe UI", "Trebuchet MS", Arial, sans-serif;
  background: var(--cream);
  color: var(--ink);
}

.app-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: linear-gradient(90deg, var(--navy) 0%, var(--navy-dark) 55%, var(--red-dark) 100%);
  color: var(--white);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-header .logo {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.app-header h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0.5px;
}

.app-header .subtitle {
  margin: 0;
  font-size: 0.8rem;
  opacity: 0.85;
}

.app-header .header-spacer { flex: 1; }

.badge {
  background: var(--red);
  color: white;
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 700;
  font-size: 0.85rem;
}

a.nav-link {
  color: var(--white);
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  transition: background 0.15s ease;
}
a.nav-link:hover { background: rgba(255,255,255,0.15); }

button {
  font-family: inherit;
  cursor: pointer;
}

.tricolor-bar {
  height: 6px;
  background: linear-gradient(90deg, var(--navy) 0 33%, var(--white) 33% 66%, var(--red) 66% 100%);
}

/* ---------- Home page ---------- */
.home-wrap {
  max-width: 720px;
  margin: 8vh auto;
  padding: 0 20px;
  text-align: center;
}
.home-wrap h2 { font-size: 1.6rem; margin-bottom: 8px; }
.home-wrap p.lede { color: #4a4237; margin-bottom: 36px; }
.role-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
@media (max-width: 800px) {
  .role-cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .role-cards { grid-template-columns: 1fr; }
}
.role-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 20px;
  text-decoration: none;
  color: var(--ink);
  border: 2px solid transparent;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.role-card:hover { transform: translateY(-3px); border-color: var(--red); }
.role-card .icon { font-size: 2.6rem; margin-bottom: 10px; }
.role-card h3 { margin: 0 0 6px; color: var(--navy); }
.role-card p { margin: 0; font-size: 0.9rem; color: #5b5344; }

/* ---------- Commande layout ---------- */
.commande-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 0;
  height: calc(100vh - 64px);
}
@media (max-width: 900px) {
  .commande-layout { grid-template-columns: 1fr; height: auto; }
}

.menu-pane {
  overflow-y: auto;
  padding: 18px 20px 90px;
}

.category-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 16px;
  position: sticky;
  top: 0;
  background: var(--cream);
  z-index: 5;
}
.category-nav button {
  border: none;
  background: var(--white);
  border: 1px solid var(--cream-dark);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
}
.category-nav button.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

.category-section { margin-bottom: 30px; }
.category-section h2 {
  color: var(--navy);
  border-bottom: 3px solid var(--red);
  display: inline-block;
  padding-bottom: 4px;
  margin: 0 0 14px;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.item-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 2px solid transparent;
}
.item-card h4 { margin: 0; color: var(--ink); font-size: 1.02rem; }
.item-card p.desc { margin: 0; font-size: 0.8rem; color: #6b6152; min-height: 2.2em; }
.item-card .price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}
.item-card .price { font-weight: 800; color: var(--red); font-size: 1.05rem; }
.item-card button.add-btn {
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 0.85rem;
}
.item-card button.add-btn:hover { background: var(--red); }

/* ---------- Cart sidebar ---------- */
.cart-pane {
  background: var(--white);
  border-left: 3px solid var(--cream-dark);
  display: flex;
  flex-direction: column;
  height: 100%;
}
.cart-header {
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--cream-dark);
}
.cart-header h3 { margin: 0; color: var(--navy); }
.customer-fields {
  padding: 10px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--cream-dark);
}
.customer-fields input, .customer-fields select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--cream-dark);
  font-size: 0.9rem;
}
.cart-lines {
  flex: 1;
  overflow-y: auto;
  padding: 10px 18px;
}
.cart-line {
  border-bottom: 1px dashed var(--cream-dark);
  padding: 10px 0;
}
.cart-line .cl-top {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
}
.cart-line .cl-opts {
  font-size: 0.78rem;
  color: #6b6152;
  margin: 4px 0;
}
.cart-line .cl-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
}
.qty-control button {
  width: 24px; height: 24px;
  border-radius: 6px;
  border: 1px solid var(--cream-dark);
  background: var(--cream);
}
.remove-line {
  color: var(--red);
  font-size: 0.78rem;
  background: none;
  border: none;
  text-decoration: underline;
}
.cart-footer {
  padding: 14px 18px 18px;
  border-top: 2px solid var(--cream-dark);
}
.total-row {
  display: flex;
  justify-content: space-between;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 12px;
}
.total-row .amount { color: var(--red); }
.submit-btn {
  width: 100%;
  padding: 14px;
  background: var(--red);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.3px;
}
.submit-btn:disabled { background: #c9beae; cursor: not-allowed; }
.submit-btn:not(:disabled):hover { background: var(--red-dark); }
.empty-cart {
  color: #9c9280;
  text-align: center;
  padding: 30px 10px;
  font-size: 0.9rem;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(13,24,48,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal {
  background: var(--white);
  border-radius: var(--radius);
  max-width: 520px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 22px 24px;
}
.modal h3 { margin: 0 0 4px; color: var(--navy); }
.modal p.desc { color: #6b6152; margin: 0 0 16px; font-size: 0.88rem; }
.option-group { margin-bottom: 16px; }
.option-group .og-label {
  font-weight: 700;
  color: var(--navy);
  font-size: 0.9rem;
  margin-bottom: 8px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.og-required { color: var(--red); font-size: 0.75rem; font-weight: 700; }
.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.choice-pill {
  border: 1.5px solid var(--cream-dark);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.85rem;
  background: var(--cream);
  color: var(--ink);
}
.choice-pill.selected {
  background: var(--navy);
  border-color: var(--navy);
  color: white;
}
.choice-pill .cp-price {
  opacity: 0.75;
  font-size: 0.78rem;
  margin-left: 4px;
}
.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--cream-dark);
}
.modal-footer .modal-total { font-weight: 800; font-size: 1.15rem; color: var(--red); }
.modal-actions { display: flex; gap: 10px; }
.btn-secondary {
  background: var(--cream);
  border: 1px solid var(--cream-dark);
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
}
.btn-primary {
  background: var(--navy);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 700;
}
.btn-primary:hover { background: var(--red); }

/* ---------- Confirmation ---------- */
.confirm-wrap {
  max-width: 480px;
  margin: 10vh auto;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 28px;
  text-align: center;
}
.confirm-wrap .big-check { font-size: 3rem; }
.confirm-wrap h2 { color: var(--navy); margin: 6px 0; }
.confirm-wrap .order-id { color: #6b6152; margin-bottom: 18px; }
.confirm-wrap .amount-due {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--red);
  margin: 10px 0 24px;
}
.confirm-wrap .pay-note {
  background: var(--cream);
  border-radius: 10px;
  padding: 14px;
  font-size: 0.9rem;
  color: #4a4237;
  margin-bottom: 22px;
}

/* ---------- Kitchen screen ---------- */
.kitchen-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 18px;
  height: calc(100vh - 76px);
}
@media (max-width: 1000px) {
  .kitchen-board { grid-template-columns: 1fr; height: auto; }
}
.kitchen-col {
  background: rgba(255,255,255,0.6);
  border-radius: var(--radius);
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.kitchen-col h2 {
  margin: 0 0 4px;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--navy);
  display: flex;
  justify-content: space-between;
}
.col-nouveau { border-top: 5px solid var(--red); }
.col-preparation { border-top: 5px solid #c98a12; }
.col-pret { border-top: 5px solid #1c8a4a; }

.ticket {
  background: white;
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  border-left: 6px solid var(--navy);
  animation: pop-in 0.25s ease;
}
@keyframes pop-in {
  from { transform: scale(0.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.ticket.nouveau { border-left-color: var(--red); }
.ticket.en_preparation { border-left-color: #c98a12; }
.ticket.pret { border-left-color: #1c8a4a; }

.ticket .t-top {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  color: var(--navy);
}
.ticket .t-meta {
  font-size: 0.75rem;
  color: #8a8070;
  margin-bottom: 8px;
}
.ticket .t-line { font-size: 0.88rem; margin-bottom: 6px; }
.ticket .t-line .qty { font-weight: 800; color: var(--red); margin-right: 4px; }
.ticket .t-line .opts { font-size: 0.76rem; color: #6b6152; margin-left: 18px; }
.ticket .t-actions { display: flex; gap: 8px; margin-top: 10px; }
.ticket .t-actions button {
  flex: 1;
  border: none;
  border-radius: 8px;
  padding: 8px;
  font-weight: 700;
  font-size: 0.8rem;
}
.ticket .t-actions .btn-advance { background: var(--navy); color: white; }
.ticket .t-actions .btn-advance:hover { background: var(--red); }
.ticket .t-actions .btn-cancel { background: transparent; color: #b5473d; text-decoration: underline; font-weight: 600; }
.empty-col { color: #9c9280; font-size: 0.85rem; text-align: center; padding: 20px 6px; }
.conn-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #59d67a;
  display: inline-block;
  margin-right: 6px;
}
.conn-dot.off { background: #d65959; }
