* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f4f5f7;
  color: #222;
}

body.auth-pending header,
body.auth-pending main {
  display: none;
}

#auth-loading {
  display: none;
}

body.auth-pending #auth-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  color: #666;
  font-size: 15px;
}

/* ===================== HEADER ===================== */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: #1f2937;
  padding: 14px 24px;
}

.logo {
  color: #fff;
  font-size: 20px;
}

nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #d1d5db;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.nav-btn:hover {
  background: #374151;
}

.nav-btn.active {
  background: #2563eb;
  color: #fff;
}

/* ===================== LAYOUT ===================== */

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.section-header {
  margin-bottom: 16px;
}

.section-header h2 {
  margin: 0 0 4px;
}

.section-desc {
  margin: 0;
  color: #666;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 800px) {
  .content-grid {
    grid-template-columns: 360px 1fr;
    align-items: start;
  }
}

/* ===================== CARD ===================== */

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 18px;
}

.card h3 {
  margin-top: 0;
}

.card-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-toolbar h3 {
  margin: 0;
}

/* ===================== FORM ===================== */

.form-group {
  margin-bottom: 14px;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: bold;
}

input,
select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
}

input:focus,
select:focus {
  outline: none;
  border-color: #2563eb;
}

.form-hint {
  font-size: 13px;
  color: #666;
}

.form-actions {
  display: flex;
  gap: 10px;
}

/* ===================== BUTTONS ===================== */

.btn {
  border: none;
  border-radius: 6px;
  padding: 9px 16px;
  font-size: 14px;
  cursor: pointer;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-ghost {
  background: #f3f4f6;
  color: #333;
}

.btn-ghost:hover {
  background: #e5e7eb;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
}

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

.btn-sm {
  padding: 6px 10px;
  font-size: 13px;
}

.btn-add-item {
  margin-top: 8px;
}

/* ===================== TABLE ===================== */

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

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

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 14px;
}

th {
  color: #555;
}

.table-actions {
  display: flex;
  gap: 8px;
}

.empty-state {
  text-align: center;
  padding: 30px 10px;
  color: #888;
}

.empty-state-icon {
  font-size: 32px;
  margin-bottom: 6px;
}

/* ===================== BADGES ===================== */

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: bold;
}

.badge-gray   { background: #e5e7eb; color: #374151; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-cyan   { background: #cffafe; color: #0e7490; }

/* ===================== ORDER ITEMS ===================== */

.items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.item-product {
  flex: 2;
}

.item-quantity {
  flex: 1;
}

.item-remove {
  background: #fee2e2;
  color: #b91c1c;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  padding: 6px 10px;
}

.order-total-preview {
  margin-top: 10px;
  font-size: 14px;
}

/* ===================== DETAILS ===================== */

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
}

.detail-item {
  font-size: 14px;
}

.detail-section-title {
  margin-top: 16px;
  margin-bottom: 6px;
  font-size: 14px;
  color: #555;
}

.product-name-cell {
  font-weight: bold;
}

/* ===================== TOAST ===================== */

#toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 18px;
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  z-index: 1000;
}

.toast-success {
  background: #16a34a;
}

.toast-error {
  background: #dc2626;
}

/* ===================== MODAL ===================== */

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

.modal-box {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  width: 90%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.modal-header h3 {
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
}

/* ===================== FOOTER ===================== */

.app-footer {
  text-align: center;
  padding: 16px;
  color: #888;
  font-size: 13px;
}
