
html { scroll-behavior: smooth; }
body { font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; margin: 0; padding: 0; background: #f6f7f9; color: #111; font-weight: 400; overflow-x: hidden; }
* { box-sizing: border-box; }
a { color: #111827; }

header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: #ffffff; border-bottom: 1px solid #e5e7eb; }
header .header-brand { display: flex; flex-direction: column; gap: 6px; }
header img { height: 36px; width: auto; object-fit: contain; }
header h1 { font-size: 22px; margin: 0; font-weight: 600; line-height: 1.2; }
.header-deadline { margin: 0; color: #90010d; background: #ecfdf5; border: 1px solid #a7f3d0; padding: 6px 10px; border-radius: 10px; font-weight: 400; align-self: flex-start; }
h2 { font-size: 18px; font-weight: 600; margin: 0 0 6px; }
h3 { font-size: 16px; font-weight: 500; margin: 0; }
.logout-form { margin-left: auto; }

.wrap { max-width: 960px; width: 100%; margin: 0 auto; padding: 24px 16px; }

.status-row { display: flex; align-items: baseline; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.status-label { font-size: 14px; color: #374151; }
.status-value { font-size: 18px; font-weight: 500; }
.status-open { color: #065f46; background: #ecfdf5; padding: 2px 8px; border-radius: 6px; border: 1px solid #a7f3d0; }
.status-closed { color: #991b1b; background: #fef2f2; padding: 2px 8px; border-radius: 6px; border: 1px solid #fecaca; }

.card { background: #ffffff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 20px; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.card-stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.categories { margin: 8px 0 6px; gap: 8px; }
.tabs { margin-top: 10px; }
#.tab-btn.active { background: #111827; color: #fff; }
.tab-btn.active { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; font-weight: 600; }

button.action, a.action { border: none; padding: 10px 16px; font-size: 16px; font-weight: 500; border-radius: 10px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
#button.primary { background: #111827; color: #fff; }
button.primary { padding: 6px 10px; border-radius: 10px; border: 1px solid #d1d5db; background: #ecfdf5; color: #065f46; border-color: #a7f3d0; font-weight: 600; }
 a.primary { padding: 6px 10px; border-radius: 10px; border: 1px solid #d1d5db; background: #ecfdf5; color: #065f46; border-color: #a7f3d0; font-weight: 600; }

button.primary:hover { filter: brightness(0.95); }
#button.secondary { background: transparent; color: #111827; border: 1px solid #d1d5db; }
button.secondary, a.secondary { padding: 6px 10px; border-radius: 10px; border: 1px solid #d1d5db; background: #fff; color: #111827; cursor: pointer; transition: all 120ms ease; outline: none; appearance: none; -webkit-appearance: none; }


button.secondary:hover, a.secondary:hover { background: #f3f4f6; }
button.danger { padding: 6px 10px; border-radius: 10px; background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
button.danger:hover { background: #fee2e2; }

label { display: flex; flex-direction: column; gap: 6px; color: #374151; font-size: 14px; margin-top: 10px; font-weight: 500; }
input { padding: 10px 12px; border-radius: 10px; border: 1px solid #d1d5db; background: #fff; color: #111; }
textarea { padding: 10px 12px; border-radius: 10px; border: 1px solid #d1d5db; background: #fff; color: #111; resize: vertical; font-family: inherit; min-height: 72px; }
.note-field { margin-top: 12px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.product { border: 1px solid #e5e7eb; border-radius: 12px; padding: 12px; background: #fff7ed; display: flex; flex-direction: column; gap: 6px; }
.product h4 { margin: 0; font-weight: 600; }
.product .price { color: #111827; font-weight: 500; }
.pill { align-self: flex-end; padding: 3px 8px; border-radius: 999px; border: 1px solid #e5e7eb; font-size: 12px; color: #6b7280; }
.quantity-row { display: flex; gap: 8px; align-items: center; }
.quantity-row input { width: 80px; }

.actions { margin: 14px 0 6px; display: flex; gap: 10px; flex-wrap: wrap; }
.line { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #e5e7eb; }
.total-row { margin-top: 10px; font-weight: 600; color: #111827; }

.hint { color: #6b7280; font-size: 13px; margin: 0; }
.flash { margin-bottom: 12px; padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.flash-ok { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; font-weight: 500; }
.flash-err { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.hidden { display: none; }

.table-scroll { overflow-x: auto; margin-top: 12px; }
.pivot-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.pivot-table th, .pivot-table td { border: 1px solid #e5e7eb; padding: 6px 8px; text-align: right; }
.pivot-table th:first-child, .pivot-table td:first-child { text-align: left; white-space: nowrap; }
.pivot-table thead th { background: #f9fafb; font-size: 0.8em; }
.pivot-table tfoot td { font-weight: 600; background: #eef2ff; }
.pivot-table th.order-col-header {
  width: 36px;
  min-width: 36px;
  text-align: center;
  font-weight: 600;
}
.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}
.admin-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  margin: 0;
}
.admin-inline input,
.admin-inline select {
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13px;
}
.admin-order {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  margin-top: 12px;
  background: #f9fafb;
}
.admin-order .row {
  justify-content: space-between;
}
.admin-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.admin-item-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px dashed #e5e7eb;
  padding-bottom: 8px;
}
.admin-item-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.admin-item-row input {
  width: 110px;
}
.admin-note {
  margin: 6px 0 0;
  color: #374151;
  font-size: 13px;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  font-size: 12px;
  background: #fff;
  color: #111827;
}
.invoice-box {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #fff;
}
.invoice-grid {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px 12px;
  align-items: center;
  font-size: 14px;
}
.invoice-total {
  margin-top: 8px;
  font-weight: 600;
}
.qr-code {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.qr-code img {
  width: 140px;
  height: 140px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 4px;
  background: #fff;
}

pre { background: #0b1020; color: #e5e7eb; padding: 12px; border-radius: 8px; overflow-x: auto; font-size: 12px; }

#toast {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 1000;
  min-width: 220px;
  background: #0b1020;
  color: #e5e7eb;
  border: 1px solid #111827;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

button.category-chip {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #111827;
  cursor: pointer;
  transition: all 120ms ease;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

button.category-chip.active {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
  font-weight: 600;
}

@media (max-width: 720px) {
  header { align-items: flex-start; flex-direction: column; }
  .wrap { padding: 16px 12px; }
  .card { padding: 16px; }
  .grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .actions { flex-direction: column; }
}

@media (max-width: 520px) {
  .grid { grid-template-columns: 1fr; }
  .product { padding: 12px; }
}
