/*
 * Ice Cream Shop Order Management System styles
 * Modern pastel refresh with a soft pink-first palette.
 */

:root {
  --color-background: #fff8fb;
  --color-surface: rgba(255, 255, 255, 0.78);
  --color-surface-strong: #ffffff;
  --color-primary: #f7b8d4;
  --color-primary-deep: #d96c9f;
  --color-primary-soft: #ffe1ee;
  --color-secondary: #ffe8c9;
  --color-accent: #d9dcff;
  --color-success: #d9f4e7;
  --color-danger: #ffd7df;
  --color-danger-deep: #bf4d72;
  --color-text: #4f3d48;
  --color-text-soft: #856a78;
  --color-border: rgba(220, 189, 204, 0.55);
  --color-shadow: rgba(204, 136, 164, 0.16);
  --color-shadow-strong: rgba(180, 103, 137, 0.22);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --shadow-soft: 0 6px 18px rgba(204, 136, 164, 0.12);
  --shadow-panel: 0 8px 24px rgba(204, 136, 164, 0.12);
  --shadow-float: 0 12px 28px rgba(180, 103, 137, 0.2);
  --ease-spring: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes pageRise {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes softPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(217, 108, 159, 0);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(217, 108, 159, 0.08);
  }
}

@keyframes shimmerSlide {
  from {
    transform: translateX(-120%);
  }
  to {
    transform: translateX(140%);
  }
}

@keyframes floatNudge {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@keyframes pendingBlink {
  0%, 100% {
    color: #c41414;
    opacity: 1;
  }
  50% {
    color: #ff1e1e;
    opacity: 0.35;
  }
}

@supports (-webkit-touch-callout: none) {
  input, select, textarea {
    font-size: 16px;
  }
}

html, body {
  min-height: 100%;
  margin: 0;
  padding: 0;
}

body {
  position: relative;
  font-family: Aptos, "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--color-text);
  background: #fffdfb;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  border-radius: 999px;
  pointer-events: none;
  z-index: 0;
  filter: blur(4px);
  opacity: 0.45;
}

body::before {
  top: 110px;
  right: -90px;
  width: 280px;
  height: 280px;
  background: rgba(247, 184, 212, 0.35);
}

body::after {
  bottom: 70px;
  left: -100px;
  width: 300px;
  height: 300px;
  background: rgba(217, 220, 255, 0.28);
}

.secure-input {
  -webkit-text-security: disc;
  text-security: disc;
}

header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  margin: 0;
  width: 100%;
  box-sizing: border-box;
  border-bottom: 1px solid rgba(232, 198, 213, 0.8);
  background: #f7c8dd;
  box-shadow: 0 2px 8px rgba(204, 136, 164, 0.12);
  backdrop-filter: none;
}

header .logo-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  min-width: 0;
}

header .logo-wrapper img {
  width: auto;
  height: 34px;
  max-width: 48px;
  object-fit: contain;
  padding: 3px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.45);
  box-shadow: none;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 0;
}

header .logo {
  display: flex;
  align-items: center;
  font-size: 1rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-subtitle {
  display: none;
  font-size: 0.9rem;
  color: var(--color-text-soft);
}

header .nav-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.nav-btn,
header button,
.btn,
.file-label {
  position: relative;
  overflow: hidden;
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--color-text);
  background: #ffe2ad;
  box-shadow: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.nav-btn::after,
.btn::after {
  content: "";
  position: absolute;
  inset: -30% auto auto -15%;
  width: 45%;
  height: 180%;
  transform: translateX(-120%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.32), transparent);
  opacity: 0;
}

.nav-btn:hover,
header button:hover,
.btn:hover,
.file-label:hover {
  transform: translateY(-1px);
  border-color: rgba(217, 108, 159, 0.25);
  box-shadow: 0 16px 30px rgba(214, 123, 161, 0.2);
}

.nav-btn:hover::after,
.btn:hover::after {
  opacity: 1;
  animation: shimmerSlide 0.8s ease;
}

.nav-btn:active,
.btn:active,
.file-label:active {
  transform: translateY(1px) scale(0.985);
}

.nav-btn.is-active {
  color: #ffffff;
  border-color: rgba(217, 108, 159, 0.6);
  background: linear-gradient(135deg, #ea89b4 0%, #d96c9f 100%);
  box-shadow: 0 16px 32px rgba(217, 108, 159, 0.35);
}

.nav-btn-ghost {
  background: rgba(255, 255, 255, 0.56);
  box-shadow: none;
}

header .total-earning {
  min-height: 32px;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border-radius: 8px;
  background: #cbf3df;
  border: 1px solid rgba(170, 222, 196, 0.85);
  box-shadow: none;
  font-weight: 700;
  font-size: 0.78rem;
  line-height: 1.2;
  white-space: nowrap;
  max-width: calc(100vw - 90px);
  overflow-x: auto;
  overflow-y: hidden;
}

header .total-earning.earn-indicator,
header .total-earning.earn-indicator {
  letter-spacing: 0.01em;
}

header .total-earning .free-text,
header .total-earning .total.negative {
  color: var(--color-danger-deep);
}

#content {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100% - 16px));
  margin: 0 auto;
  padding: 14px 0 88px;
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: pageRise 0.28s var(--ease-spring);
}

.page-shell {
  display: grid;
  gap: 12px;
}

.narrow-shell {
  max-width: 760px;
}

.page-hero,
.page-panel,
.card,
.modal .modal-content {
  border: 1px solid rgba(239, 219, 228, 0.9);
  background: #ffffff;
  backdrop-filter: none;
  box-shadow: none;
}

.page-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
}

.page-hero::after {
  content: "";
  position: absolute;
  top: -34px;
  right: -34px;
  width: 150px;
  height: 150px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(247, 184, 212, 0.3), transparent 68%);
  pointer-events: none;
}

.compact-hero {
  align-items: center;
}

.page-eyebrow {
  margin-bottom: 6px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-primary-deep);
}

.page h2,
.modal h2 {
  margin: 0;
  font-size: clamp(1.05rem, 1.5vw, 1.45rem);
  line-height: 1.1;
}

.page-description {
  max-width: 720px;
  margin: 6px 0 0;
  font-size: 0.85rem;
  color: var(--color-text-soft);
  line-height: 1.45;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.page-panel {
  padding: 12px;
  border-radius: 12px;
}

.page-panel > .total-earning {
  width: 100%;
  box-sizing: border-box;
  justify-content: center;
  text-align: center;
}

.btn-compact {
  min-height: 28px;
  padding: 5px 10px;
  font-size: 0.78rem;
}

.card {
  padding: 12px;
  border-radius: 12px;
  margin: 0;
}

.card h3 {
  margin: 0 0 10px;
  font-size: 0.96rem;
}

.preference-card {
  margin-top: 8px;
}

label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 600;
}

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(225, 199, 211, 0.9);
  border-radius: 9px;
  padding: 8px 10px;
  font: inherit;
  color: var(--color-text);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 247, 251, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(217, 108, 159, 0.55);
  box-shadow: 0 0 0 4px rgba(247, 184, 212, 0.22);
}

input::placeholder,
textarea::placeholder {
  color: #aa92a0;
}

.btn {
  min-height: 34px;
}

.btn.secondary {
  background: linear-gradient(180deg, #ffffff 0%, #f8f4f8 100%);
}

.btn-danger {
  color: #7b2647;
  background: linear-gradient(180deg, #fff0f4 0%, #ffdce6 100%);
}

.btn-success {
  background: linear-gradient(180deg, #f2fff7 0%, #dcf6ea 100%);
}

.back-btn {
  border-color: rgba(196, 142, 166, 0.45);
  background: linear-gradient(180deg, #ffffff 0%, #ffeef5 100%);
  box-shadow: 0 8px 18px rgba(180, 103, 137, 0.16);
}

.back-btn::before {
  content: "<";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 7px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--color-primary-deep);
  font-size: 0.72rem;
  font-weight: 900;
}

.toolbar-row,
.menu-admin-toolbar,
.form-row-wrap,
.action-row,
.report-actions,
.report-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.search-field,
.form-chip {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 220px;
  padding: 8px 10px;
  border: 1px solid rgba(233, 205, 216, 0.85);
  border-radius: 10px;
  background: #fffdfd;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.search-field {
  flex: 1 1 320px;
}

.search-field span,
.form-chip label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-soft);
}

.search-field input,
.form-chip input,
.form-chip select {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 0.9rem;
}

.search-field input:focus,
.form-chip input:focus,
.form-chip select:focus {
  box-shadow: none;
}

.search-field:focus-within,
.form-chip:focus-within {
  transform: translateY(-1px);
  border-color: rgba(217, 108, 159, 0.34);
  box-shadow: 0 14px 28px rgba(217, 159, 184, 0.14);
}

.btn-filter {
  min-width: 82px;
}

.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.item-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  min-height: 148px;
  padding: 12px;
  border: 1px solid rgba(239, 211, 222, 0.9);
  border-radius: 12px;
  background:
    radial-gradient(circle at top right, rgba(247, 184, 212, 0.2), transparent 38%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 248, 251, 0.95) 100%);
  box-shadow: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.item-card:hover {
  transform: translateY(-3px);
  border-color: rgba(217, 108, 159, 0.28);
  box-shadow: 0 20px 44px rgba(210, 142, 172, 0.22);
}

.item-card.is-selected {
  padding-top: 42px;
  border-color: rgba(217, 108, 159, 0.42);
  background:
    radial-gradient(circle at top right, rgba(247, 184, 212, 0.3), transparent 40%),
    linear-gradient(180deg, rgba(255, 249, 252, 0.99) 0%, rgba(255, 238, 245, 0.95) 100%);
  box-shadow: 0 22px 46px rgba(210, 137, 167, 0.25);
}

.item-card.is-selected::after {
  content: "IN CART";
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(217, 108, 159, 0.14);
  color: var(--color-primary-deep);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.item-card.is-bumping {
  animation: softPulse 0.52s ease;
}

.item-card .name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.35;
}

.item-card .cat-badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid rgba(232, 205, 217, 0.9);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--color-text-soft);
  line-height: 1.25;
}

.item-card .price {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--color-primary-deep);
}

.item-card .qty-controls,
.modal .qty-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 237, 244, 0.85);
  width: fit-content;
}

.item-card button,
.modal .qty-controls button,
.confirm-cart-item .remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 28px;
  border: 0;
  border-radius: 999px;
  padding: 5px 8px;
  font: inherit;
  font-weight: 800;
  color: var(--color-text);
  background: linear-gradient(180deg, #ffffff 0%, #ffeef5 100%);
  box-shadow: none;
  cursor: pointer;
}

.item-card button:hover,
.modal .qty-controls button:hover,
.confirm-cart-item .remove:hover {
  background: linear-gradient(180deg, #fff9fb 0%, #ffdfe9 100%);
}

.item-card .qty,
.modal .qty {
  min-width: 26px;
  text-align: center;
  font-weight: 800;
}

.cat-indicator {
  display: none;
  margin-top: 6px;
}

.cat-indicator .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid rgba(232, 205, 217, 0.9);
  border-radius: 8px;
  background: rgba(255, 246, 250, 0.96);
  font-size: 0.74rem;
}

.cat-indicator .chip .label {
  font-weight: 800;
}

.cat-indicator .chip .sep {
  opacity: 0.45;
}

.cat-indicator .chip .reset {
  color: var(--color-primary-deep);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

#categorySelectContainer {
  display: none;
}

#categorySelectContainer.category-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 6px;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid rgba(232, 205, 217, 0.8);
  border-radius: 10px;
  background: rgba(255, 250, 252, 0.88);
}

#categorySelectContainer.category-list .btn {
  width: 100%;
  text-align: left;
  min-height: 30px;
  padding: 5px 8px;
  font-size: 0.76rem;
}

#categorySelectContainer.category-list .btn.tiny-joy,
.badge-cloud-green {
  color: #0f6b49;
  background: #dff6e8;
  border: 1px solid #97ddb8;
}

#categorySelectContainer.category-list .btn.happy-scoop,
.badge-cloud-blue {
  color: #3757a8;
  background: #e0e6ff;
  border: 1px solid #b9c3ff;
}

#categorySelectContainer.category-list .btn.big-bliss,
.badge-cloud-red {
  color: #984267;
  background: #ffe3eb;
  border: 1px solid #f4b8cb;
}

#historyEarning {
  display: inline-flex;
  align-items: center;
  margin-top: 6px;
  margin-bottom: 0;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #f7c8e3;
  border: 1px solid rgba(236, 195, 214, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

#orderHistoryList {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#orderHistoryList .order-table,
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 780px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(232, 205, 217, 0.9);
  background: rgba(255, 255, 255, 0.92);
}

th,
td {
  padding: 10px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(239, 223, 230, 0.9);
  vertical-align: top;
}

th {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-soft);
  background: linear-gradient(180deg, rgba(255, 243, 248, 0.98), rgba(255, 236, 245, 0.95));
}

tbody tr:hover td {
  background: rgba(255, 248, 251, 0.88);
}

#orderHistoryList .order-table th:first-child,
#orderHistoryList .order-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: inherit;
}

#orderHistoryList .order-table th:nth-child(2),
#orderHistoryList .order-table td:nth-child(2) {
  white-space: nowrap;
}

#orderHistoryList .order-table th:nth-child(3),
#orderHistoryList .order-table td:nth-child(3) {
  white-space: nowrap;
}

#orderHistoryList .order-table th:nth-child(4),
#orderHistoryList .order-table td:nth-child(4) {
  white-space: normal;
  max-width: 340px;
}

#orderHistoryList .order-table .order-actions {
  min-width: 150px;
}

#orderHistoryList .order-table .order-actions .btn + .btn {
  margin-left: 6px;
}

#orderHistoryList .order-table tr.order-row-pending td {
  background: #fff5f5;
  border-bottom-color: rgba(238, 148, 148, 0.6);
}

#orderHistoryList .order-table tr.order-row-pending td:first-child {
  box-shadow: inset 4px 0 0 #e22121;
}

.status-pending {
  color: #d11212;
  font-weight: 900;
  animation: pendingBlink 1s steps(2, start) infinite;
}

.pay-later-option {
  border-color: rgba(212, 48, 48, 0.35) !important;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.settings-card,
.report-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  min-height: 140px;
  padding: 20px;
  border: 1px solid rgba(236, 207, 219, 0.88);
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(255, 232, 244, 0.72), transparent 35%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 248, 251, 0.92));
  box-shadow: 0 16px 35px rgba(205, 163, 183, 0.16);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.settings-card::before,
.report-card::before {
  content: attr(data-icon);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 240, 247, 0.96), rgba(255, 228, 238, 0.94));
  color: var(--color-primary-deep);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  box-shadow: inset 0 0 0 1px rgba(217, 108, 159, 0.1);
}

.settings-card {
  cursor: pointer;
}

.settings-card:hover,
.report-card:hover {
  transform: translateY(-3px);
  border-color: rgba(217, 108, 159, 0.28);
  box-shadow: 0 20px 40px rgba(204, 143, 171, 0.22);
}

.settings-card:active,
.report-card:active {
  transform: translateY(-1px) scale(0.99);
}

.settings-card-title,
.report-card h4 {
  margin: 0;
  font-size: 1.04rem;
  font-weight: 800;
}

.settings-card-copy {
  margin: 0;
  color: var(--color-text-soft);
  line-height: 1.55;
}

.report-card-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--color-primary-deep);
}

.report-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.report-actions {
  margin-top: 18px;
}

.admin-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.admin-row-title {
  font-weight: 700;
  line-height: 1.5;
}

.admin-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.form-row-wrap > input:first-child {
  flex: 1 1 260px;
}

#itemPrice {
  width: 140px;
}

#itemCategory {
  min-width: 190px;
  width: auto;
}

.stack-form {
  display: grid;
  gap: 10px;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 18px;
  overflow-y: auto;
  background: rgba(89, 56, 71, 0.32);
  backdrop-filter: blur(10px);
  z-index: 50;
  -webkit-overflow-scrolling: touch;
}

.modal.active {
  display: flex;
}

.modal .modal-content {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100vh - 36px);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 24px;
  border-radius: 28px;
  -webkit-overflow-scrolling: touch;
}

.modal-full .modal-content {
  width: min(980px, calc(100vw - 24px));
  min-height: calc(100vh - 36px);
  min-height: calc(100dvh - 36px);
  display: flex;
  flex-direction: column;
}

.modal h2 {
  margin-bottom: 16px;
}

.modal input[type="text"],
.modal input[type="password"],
.modal input[type="number"],
.modal input[type="date"] {
  margin-bottom: 12px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

.modal-actions-stack {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  justify-content: stretch;
}

.modal-actions-stack #btnConfirmOrder {
  white-space: normal;
}

.modal-actions-stack .back-btn {
  justify-self: start;
}

.modal-actions .back-btn {
  margin-right: auto;
}

.required-mark {
  color: var(--color-danger-deep);
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.payment-form-row {
  flex: 1 1 240px;
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.radio-group label {
  padding: 10px 14px;
  border: 1px solid rgba(233, 206, 217, 0.88);
  border-radius: 999px;
  background: rgba(255, 247, 251, 0.94);
  font-weight: 700;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.radio-group label:has(input:checked) {
  transform: translateY(-1px);
  border-color: rgba(217, 108, 159, 0.4);
  background: rgba(255, 236, 245, 0.98);
}

#splitAmountsRow input {
  width: 100%;
}

#confirmOrderModal .modal-content {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding-bottom: 18px;
  scroll-padding-bottom: 24px;
}

#splitAmountsRow {
  width: 100%;
  box-sizing: border-box;
}

#splitAmountsRow input {
  margin-bottom: 8px;
}

.edit-order-summary {
  margin: -4px 0 12px;
  color: var(--color-text-soft);
  font-size: 0.84rem;
  font-weight: 800;
}

.edit-order-toolbar {
  align-items: stretch;
  margin-bottom: 12px;
}

.edit-order-toolbar input {
  flex: 1 1 220px;
}

.edit-order-search {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 12px;
}

.edit-split-row {
  display: flex;
  flex-direction: row;
  gap: 8px;
  margin: 10px 0 12px;
}

.edit-split-row input {
  min-width: 0;
  flex: 1 1 0;
}

.edit-order-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
  padding-right: 2px;
  overflow: visible;
}

.edit-order-list .empty-state {
  grid-column: 1 / -1;
}

.edit-menu-card {
  min-height: 132px;
}

.edit-order-actions {
  position: sticky;
  bottom: -24px;
  z-index: 2;
  margin: 14px -24px -24px;
  padding: 12px 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), #ffffff 45%);
  border-top: 1px solid rgba(239, 219, 228, 0.9);
}

#btnUpdateEditedOrder {
  white-space: normal;
}

.confirm-cart-section {
  margin: 8px 0 16px;
}

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

.confirm-cart-header h3 {
  margin: 0;
}

.confirm-cart-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}

.confirm-cart-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(236, 207, 219, 0.88);
  border-radius: 18px;
  background: rgba(255, 252, 253, 0.95);
}

.confirm-cart-item .name {
  font-weight: 800;
}

.confirm-cart-empty {
  padding: 12px 4px;
  color: var(--color-text-soft);
  font-style: italic;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 28px 22px;
  border: 1px dashed rgba(227, 191, 206, 0.95);
  border-radius: 24px;
  background: rgba(255, 248, 251, 0.92);
  color: var(--color-text-soft);
  text-align: center;
  line-height: 1.6;
}

input[type="file"] {
  display: none;
}

.order-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  display: none;
  align-items: center;
  gap: 10px;
}

#placeOrderBtn,
#cancelOrderBtn {
  min-height: 60px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  padding: 14px 24px;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  box-shadow: var(--shadow-float);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

#placeOrderBtn {
  display: none;
  color: #ffffff;
  background: linear-gradient(135deg, #ea89b4 0%, #cf608f 100%);
}

#cancelOrderBtn {
  display: none;
  color: #7b2647;
  background: linear-gradient(180deg, #fff0f4 0%, #ffdce6 100%);
}

#placeOrderBtn:hover,
#cancelOrderBtn:hover {
  transform: translateY(-2px);
}

#placeOrderBtn.attention {
  animation: floatNudge 0.9s ease 2;
}

.total-earning,
#historyEarning {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.total-earning:hover,
#historyEarning:hover {
  transform: translateY(-1px);
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  header {
    top: 0;
    padding: 8px 12px;
    gap: 10px;
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 6px;
  }

  header .nav-buttons {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  header .nav-buttons::-webkit-scrollbar {
    display: none;
  }

  header .nav-buttons .nav-btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  header .total-earning {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    justify-content: flex-start;
  }

  .page-hero {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .page-actions {
    width: 100%;
    align-items: stretch;
  }

  #orderHistoryList {
    overflow: visible;
  }

  #orderHistoryList .order-table,
  table {
    min-width: 0;
    border: 0;
    background: transparent;
    border-spacing: 0;
  }

  #orderHistoryList .order-table thead {
    display: none;
  }

  #orderHistoryList .order-table tbody {
    display: grid;
    gap: 10px;
  }

  #orderHistoryList .order-table tr {
    display: block;
    padding: 10px;
    border: 1px solid rgba(232, 205, 217, 0.9);
    border-radius: 10px;
    background: #fff;
  }

  #orderHistoryList .order-table tr.order-row-pending {
    border-color: rgba(226, 33, 33, 0.45);
    background: #fff5f5;
    box-shadow: inset 4px 0 0 #e22121;
  }

  #orderHistoryList .order-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
    padding: 6px 0;
    border-bottom: 1px solid rgba(239, 223, 230, 0.75);
    white-space: normal;
    max-width: none;
    background: transparent;
    position: static;
    overflow-wrap: anywhere;
  }

  #orderHistoryList .order-table th:first-child,
  #orderHistoryList .order-table td:first-child {
    position: static;
    left: auto;
    z-index: auto;
  }

  #orderHistoryList .order-table tr.order-row-pending td:first-child {
    box-shadow: none;
  }

  #orderHistoryList .order-table td:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  #orderHistoryList .order-table td::before {
    content: attr(data-label);
    flex: 0 0 88px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-soft);
  }

  #orderHistoryList .order-table td:nth-child(4) {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  #orderHistoryList .order-table td:nth-child(4)::before {
    flex-basis: auto;
  }

  #orderHistoryList .order-table td:last-child {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  #orderHistoryList .order-table td:last-child::before {
    flex-basis: auto;
  }

  #orderHistoryList .order-table .order-actions {
    min-width: 0;
  }

  #orderHistoryList .order-table .order-actions .btn {
    width: 100%;
  }

  #orderHistoryList .order-table .order-actions .btn + .btn {
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  header,
  #content {
    width: min(100% - 16px, 1240px);
  }

  header {
    top: 0;
    width: 100%;
    margin-top: 0;
    padding: 8px 10px 10px;
    border-radius: 0;
    gap: 6px;
  }

  header .logo-wrapper {
    width: 100%;
    justify-content: flex-start;
    margin-bottom: 2px;
  }

  .brand-copy {
    min-width: 0;
  }

  .header-actions {
    width: 100%;
    gap: 8px;
  }

  header .nav-buttons {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    width: 100%;
    justify-content: flex-start;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
  }

  header .nav-buttons .nav-btn {
    width: auto;
    min-width: max-content;
    padding: 7px 8px;
    font-size: 0.78rem;
    justify-content: center;
    text-align: center;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  header .total-earning {
    width: 100%;
    min-height: auto;
    padding: 7px 8px;
    font-size: 0.72rem;
    line-height: 1.35;
    white-space: normal;
    overflow: visible;
    border-radius: 8px;
    display: block;
  }

  .page-hero,
  .page-panel,
  .card,
  .modal .modal-content {
    border-radius: 10px;
  }

  .page-hero,
  .page-panel,
  .card {
    padding: 10px;
  }

  .page h2,
  .modal h2 {
    font-size: 1rem;
  }

  .page-description {
    font-size: 0.8rem;
  }

  .page-actions {
    gap: 8px;
  }

  .items-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .item-card {
    min-height: 132px;
    padding: 10px;
  }

  .item-card.is-selected {
    padding-top: 40px;
  }

  .form-chip,
  .search-field,
  .confirm-cart-item {
    min-width: 0;
    width: 100%;
  }

  .toolbar-row,
  .menu-admin-toolbar,
  .form-row-wrap,
  .action-row,
  .report-actions,
  .report-controls {
    align-items: stretch;
  }

  .toolbar-row > *,
  .menu-admin-toolbar > *,
  .form-row-wrap > *,
  .action-row > *,
  .report-actions > *,
  .report-controls > * {
    flex: 1 1 100%;
  }

  .btn,
  .file-label {
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
  }

  .btn.btn-compact {
    width: auto;
    min-width: 96px;
  }

  .date-picker.form-chip {
    padding: 8px 10px;
  }

  .date-picker.form-chip input {
    min-height: 24px;
  }

  #categorySelectContainer.category-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #historyEarning {
    width: 100%;
    box-sizing: border-box;
    white-space: normal;
    line-height: 1.4;
    display: block;
    overflow: visible;
    font-size: 0.72rem;
  }

  .page-panel > .total-earning {
    justify-content: flex-start;
    text-align: left;
  }

  #orderHistoryList {
    overflow: visible;
  }

  #orderHistoryList .order-table,
  table {
    min-width: 0;
    border: 0;
    background: transparent;
    border-spacing: 0;
  }

  #orderHistoryList .order-table thead {
    display: none;
  }

  #orderHistoryList .order-table tbody {
    display: grid;
    gap: 10px;
  }

  #orderHistoryList .order-table tr {
    display: block;
    padding: 10px;
    border: 1px solid rgba(232, 205, 217, 0.9);
    border-radius: 10px;
    background: #fff;
  }

  #orderHistoryList .order-table tr.order-row-pending {
    border-color: rgba(226, 33, 33, 0.45);
    background: #fff5f5;
    box-shadow: inset 4px 0 0 #e22121;
  }

  #orderHistoryList .order-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
    padding: 6px 0;
    border-bottom: 1px solid rgba(239, 223, 230, 0.75);
    white-space: normal;
    max-width: none;
    background: transparent;
    position: static;
  }

  #orderHistoryList .order-table td:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  #orderHistoryList .order-table td::before {
    content: attr(data-label);
    flex: 0 0 88px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-soft);
  }

  #orderHistoryList .order-table td:nth-child(4) {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  #orderHistoryList .order-table td:nth-child(4)::before {
    flex-basis: auto;
  }

  #orderHistoryList .order-table td:last-child {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  #orderHistoryList .order-table td:last-child::before {
    flex-basis: auto;
  }

  #orderHistoryList .order-table td:last-child .btn {
    width: 100%;
  }

  .confirm-cart-item {
    grid-template-columns: 1fr;
  }

  #confirmOrderModal {
    padding: 10px;
  }

  #confirmOrderModal .modal-content {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    padding: 14px;
  }

  #confirmOrderModal .confirm-cart-list {
    max-height: 180px;
  }

  .modal-full .modal-content {
    min-height: calc(100dvh - 24px);
  }

  .edit-split-row,
  .edit-order-toolbar {
    flex-direction: column;
  }

  .edit-order-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .edit-order-actions {
    bottom: -10px;
    margin: 12px -10px -10px;
    padding: 10px;
  }

  .admin-row {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-row-actions {
    width: 100%;
  }

  .admin-row-actions .btn {
    flex: 1 1 0;
  }

  .order-fab {
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
  }

  #placeOrderBtn,
  #cancelOrderBtn {
    flex: 1 1 0;
    min-width: 0;
    padding: 12px 10px;
    font-size: 0.88rem;
  }
}
