:root {
  --bg: #f3f5ef;
  --bg2: #e7ecdf;
  --card: #ffffff;
  --ink: #1f2a1c;
  --muted: #5f6d59;
  --brand: #1d6f42;
  --brand-strong: #0e4b2a;
  --accent: #ef8f42;
  --error: #c13b2f;
  --ok: #196f3d;
  --border: #d7decd;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Space Grotesk", sans-serif;
  min-height: 100vh;
}

.page-bg {
  display: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
}

.brand {
  font-size: 1.05rem;
  font-weight: 700;
}

.nav-links {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
}

.nav-links a {
  text-decoration: none;
  color: var(--brand-strong);
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f8faf5;
  white-space: nowrap;
}

.nav-links a:hover {
  background: #eef4e8;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem;
  display: block;
  gap: 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: none;
  margin-bottom: 0.8rem;
}

.narrow {
  max-width: 480px;
  margin: 8vh auto;
}

h1, h2, h3 {
  margin: 0 0 0.65rem;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.9rem;
  margin: 0.25rem 0;
}

.stack {
  display: grid;
  gap: 0.9rem;
}

.grid {
  display: grid;
  gap: 0.7rem;
}

.two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-cols {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.six-cols {
  grid-template-columns: 1.1fr 0.7fr 0.8fr 0.4fr 0.5fr 0.5fr;
}

.full-width {
  grid-column: 1 / -1;
}

label {
  font-size: 1rem;
  display: grid;
  gap: 0.45rem;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  min-height: 48px;
}

button {
  cursor: pointer;
}

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.7rem 0.95rem;
  min-height: 46px;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-strong);
}

.btn-secondary {
  background: #f8faf5;
  border-color: var(--border);
  color: var(--ink);
}

.btn-table {
  min-height: 34px;
  padding: 0.38rem 0.72rem;
  border-radius: 10px;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn.big {
  font-size: 1.2rem;
  min-height: 60px;
}

.flash-wrap {
  display: grid;
  gap: 0.6rem;
}

.flash {
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  background: #f8fbf4;
}

.flash-success {
  border-color: #b9e2c5;
  background: #ebf8ef;
  color: var(--ok);
}

.flash-error {
  border-color: #e9bdb8;
  background: #fff2f0;
  color: var(--error);
}

.role-tag {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.6rem;
  background: #f7f9f4;
}

.logout-form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  justify-content: flex-end;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.lang-flag-btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 0.25rem 0.35rem;
  min-height: 38px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lang-flag-btn.active {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
  background: #eef7f0;
}

.flag-icon {
  display: inline-block;
  width: 22px;
  height: 14px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  position: relative;
  overflow: hidden;
}

.flag-vn {
  background: #da251d;
}

.flag-vn::before {
  content: "\2605";
  color: #ffdf00;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  line-height: 1;
}

.flag-uk {
  background:
    linear-gradient(26deg, transparent 44%, #ffffff 44%, #ffffff 56%, transparent 56%),
    linear-gradient(-26deg, transparent 44%, #ffffff 44%, #ffffff 56%, transparent 56%),
    linear-gradient(26deg, transparent 47%, #c8102e 47%, #c8102e 53%, transparent 53%),
    linear-gradient(-26deg, transparent 47%, #c8102e 47%, #c8102e 53%, transparent 53%),
    linear-gradient(90deg, transparent 40%, #ffffff 40%, #ffffff 60%, transparent 60%),
    linear-gradient(transparent 40%, #ffffff 40%, #ffffff 60%, transparent 60%),
    linear-gradient(90deg, transparent 45%, #c8102e 45%, #c8102e 55%, transparent 55%),
    linear-gradient(transparent 45%, #c8102e 45%, #c8102e 55%, transparent 55%),
    #012169;
}

.reception-card {
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
}

.big-label input {
  font-size: 1.15rem;
}

.quick-add {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  align-items: end;
}

.quick-add > label {
  min-width: 0;
}

.typeahead-wrap {
  position: relative;
}

.suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(33, 41, 29, 0.12);
  max-height: 260px;
  overflow-y: auto;
  z-index: 25;
}

.suggestion-item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: #fff;
  text-align: left;
  padding: 0.7rem 0.8rem;
  min-height: 54px;
}

.suggestion-item:last-child {
  border-bottom: 0;
}

.suggestion-item:hover {
  background: #f2f7ed;
}

.suggestion-item-title {
  font-weight: 600;
}

.suggestion-item-meta {
  font-size: 0.86rem;
  color: var(--muted);
}

.btn-touch {
  min-width: 110px;
  min-height: 52px;
}

.selected-items {
  display: grid;
  gap: 0.55rem;
}

.selected-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  background: #fcfef9;
}

.selected-item > div:first-child {
  min-width: 0;
}

.selected-item-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selected-item-meta {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selected-item-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.selected-item-actions .btn {
  min-height: 38px;
  min-width: 38px;
  padding: 0.3rem 0.55rem;
  border-radius: 10px;
}

.qty-badge {
  min-width: 30px;
  text-align: center;
  font-size: 1rem;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.menu-item,
.queue-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  background: #fbfdf9;
}

.queue-item {
  align-items: flex-start;
}

.queue-item > div:first-child {
  min-width: 0;
  flex: 1;
}

.queue-item > div:last-child {
  flex-shrink: 0;
  align-self: center;
}

.queue-item h3 {
  margin: 0 0 0.35rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item .muted,
.queue-item .small {
  margin: 0.15rem 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.completed-section {
  background: #f6f7f5;
}

.queue-item-muted {
  opacity: 0.74;
  background: #f1f3ee;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.qty-input {
  width: 64px;
  text-align: center;
  font-size: 1.05rem;
}

.qty-btn {
  width: 34px;
  height: 34px;
  padding: 0;
}

.chip {
  display: inline-block;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  padding: 0.15rem 0.5rem;
  background: #f3f8ee;
}

.chip-kitchen {
  color: #7e3802;
  border-color: #f4bf90;
  background: #fff3e8;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 0.45rem;
  white-space: nowrap;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.inline-form {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex-wrap: wrap;
}

.tabs-filter {
  min-width: 220px;
}

.button-end {
  display: flex;
  align-items: end;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.7rem;
}

.stat {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem;
  background: #fcfef9;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.stat strong {
  font-size: 1.2rem;
}

.row-form {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.inline-check input {
  width: auto;
}

.spaced-top {
  margin-top: 0.8rem;
}

.fade-in {
  animation: fadeInUp 0.24s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .nav-links {
    order: 2;
  }

  .two-cols,
  .three-cols,
  .six-cols {
    grid-template-columns: 1fr;
  }

  .quick-add {
    grid-template-columns: 1fr;
  }

  .btn-touch {
    width: 100%;
  }

  .logout-form {
    justify-content: start;
  }

  .topbar-right {
    justify-content: start;
  }
}
