* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #fff7ec;
  color: #3a2a1a;
}

.app-title {
  font-weight: 700;
  font-size: 1.1rem;
  margin-right: 0.75rem;
}

.role-pill {
  padding: 0.25rem 0.6rem;
  background: #ffe0b8;
  border-radius: 999px;
  font-size: 0.8rem;
}

/* Login */

.login-screen {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, #ffe4c2 0, #fff7ec 60%);
}

.login-card {
  background: #ffffff;
  padding: 2rem 2.5rem;
  border-radius: 1rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.08);
  min-width: 280px;
}

.login-card h1 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: #c16115;
}

.login-card label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.login-card select,
.login-card input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #f2c597;
  margin-bottom: 0.9rem;
  font-size: 0.95rem;
}

/* Top bar */

.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: #ffe3c2;
  border-bottom: 1px solid #f4c797;
}

.left-controls,
.center-controls,
.right-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.main-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.1fr;
  gap: 0.75rem;
  padding: 0.75rem;
}

/* Layout modes */

body.layout-classic .main-grid {
  grid-template-columns: 1.2fr 1fr 1.1fr;
}

body.layout-modern .main-grid {
  grid-template-columns: 1fr 1.1fr 1.1fr;
}

/* Sections */

section {
  background: #fffaf3;
  border-radius: 0.9rem;
  padding: 0.75rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.menu-section {
  overflow: hidden;
}

.menu-header,
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.5rem;
  overflow: auto;
  padding-right: 0.25rem;
}

/* Buttons */

button {
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  border-radius: 0.6rem;
  padding: 0.45rem 0.8rem;
  background: #ffd4a8;
  color: #4a2f1e;
  transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.05s ease;
}

button:active {
  background: #e9a96b;
  transform: translateY(1px);
  box-shadow: inset 0 2px 3px rgba(0,0,0,0.12);
}

.primary-btn {
  background: #ffb56b;
}

.primary-btn:hover {
  background: #ffbf80;
}

.small-btn {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

.icon-btn {
  font-size: 0.8rem;
}

.icon-btn.danger {
  background: #ffb3a8;
}

.icon-btn.danger:hover {
  background: #ffc2b8;
}

.wide {
  width: 100%;
  margin-top: 0.75rem;
}

.toggle-btn {
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: #ffe1bf;
  font-size: 0.8rem;
}

.toggle-btn.active {
  background: #ffb56b;
}

/* Menu item card */

.menu-item {
  background: #ffe8c8;
  padding: 0.6rem;
  border-radius: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.menu-item-name {
  font-weight: 600;
}

.menu-item-price {
  font-size: 0.85rem;
  color: #7a5030;
}

.menu-item button {
  align-self: flex-end;
}

/* Current order */

.order-section {
  gap: 0.75rem;
}

.current-order {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.order-items {
  flex: 1;
  overflow: auto;
  padding-right: 0.25rem;
}

.order-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 0.35rem;
  padding: 0.3rem 0.35rem;
  border-radius: 0.4rem;
  background: #fff0dd;
  margin-bottom: 0.25rem;
  align-items: center;
  font-size: 0.85rem;
}

.order-row span {
  white-space: nowrap;
}

.order-footer {
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px solid #f3c495;
}

.total-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}

/* Checkout */

.checkout-box {
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px dashed #f0c394;
}

.payment-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.35rem;
  font-size: 0.85rem;
}

/* History */

.history-section {
  min-width: 0;
}

.history-list {
  flex: 1;
  overflow: auto;
  padding-right: 0.25rem;
}

.history-card {
  background: #ffe8cf;
  border-radius: 0.7rem;
  padding: 0.5rem 0.6rem;
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
}

.history-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.history-meta {
  display: flex;
  gap: 0.4rem;
  font-size: 0.76rem;
  color: #7a5030;
}

.history-items {
  margin: 0.25rem 0;
  padding-left: 1rem;
}

.history-items li {
  margin-bottom: 0.15rem;
}

.history-actions {
  display: flex;
  gap: 0.3rem;
  justify-content: flex-end;
  margin-top: 0.2rem;
}

/* Modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.modal {
  background: #fffaf3;
  padding: 1rem 1.2rem;
  border-radius: 0.9rem;
  width: 320px;
  max-width: 95vw;
  box-shadow: 0 8px 22px rgba(0,0,0,0.15);
}

.modal h2 {
  margin: 0 0 0.5rem;
  color: #c16115;
}

.modal-body {
  margin-bottom: 0.75rem;
}

.modal-body input {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border-radius: 0.55rem;
  border: 1px solid #f2c597;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Scrollbar */

.menu-grid::-webkit-scrollbar,
.order-items::-webkit-scrollbar,
.history-list::-webkit-scrollbar {
  width: 6px;
}

.menu-grid::-webkit-scrollbar-thumb,
.order-items::-webkit-scrollbar-thumb,
.history-list::-webkit-scrollbar-thumb {
  background: #f0c594;
  border-radius: 999px;
}
