/* Mobile order form — light professional theme (Dream Bath gold accent) */

/* Access gate (password before order UI) */
.mo-auth-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(15, 118, 110, 0.06), transparent 50%),
    linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.mo-auth-gate[hidden] {
  display: none !important;
}

.mo-auth-gate__panel {
  width: 100%;
  max-width: 380px;
  padding: 32px 28px 28px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 12px 40px rgba(15, 23, 42, 0.08);
}

.mo-auth-gate__title {
  font-family: var(--font-body);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: #0f172a;
  text-align: center;
  margin-bottom: 8px;
}

.mo-auth-gate__hint {
  font-size: 0.9rem;
  color: #64748b;
  text-align: center;
  margin-bottom: 22px;
  line-height: 1.5;
}

.mo-auth-gate__form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mo-auth-gate__input {
  width: 100%;
  padding: 14px 16px;
  font-family: var(--font-body);
  font-size: 1.05rem;
  letter-spacing: 0.1em;
  text-align: center;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  color: #0f172a;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.mo-auth-gate__input:focus {
  outline: none;
  background: #fff;
  border-color: #0d9488;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.mo-auth-gate__err {
  font-size: 0.85rem;
  color: #b91c1c;
  text-align: center;
  margin: 0;
  min-height: 1.2em;
}

.mo-auth-gate__submit {
  margin-top: 4px;
  padding: 14px 20px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.2);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.mo-auth-gate__submit:hover:not(:disabled) {
  filter: brightness(1.05);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.25);
}

.mo-auth-gate__submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mo-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mo-skin {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.mo-home-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
  margin-bottom: 4px;
}

.mo-home-link {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  color: #0f766e;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 10px;
  transition: color 0.2s ease, background 0.2s ease;
}

.mo-home-link:hover {
  color: #0f172a;
  background: rgba(15, 118, 110, 0.08);
}

.mobile-order-page {
  --mo-radius: 20px;
  --mo-radius-sm: 12px;
  --mo-radius-xs: 10px;
  --mo-shadow-card:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 4px 16px rgba(15, 23, 42, 0.05);
  --mo-shadow-float:
    0 4px 6px -1px rgba(15, 23, 42, 0.06),
    0 12px 24px -4px rgba(15, 23, 42, 0.08);
  --mo-input-bg: #f8fafc;
  --mo-muted: #64748b;
  padding: max(10px, env(safe-area-inset-top)) 0 max(20px, env(safe-area-inset-bottom));
  min-height: 100vh;
  background:
    radial-gradient(ellipse 100% 60% at 50% -10%, rgba(13, 148, 136, 0.05), transparent 55%),
    linear-gradient(180deg, #f8fafc 0%, #f1f5f9 50%, #fafbfc 100%);
}

.mobile-order-page .container {
  max-width: 560px;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

/* Full-width sticky rail. Sticky lives on .mo-party-sticky-slot (with
   .mo-party-sticky-slot--visible), not on the inner card: otherwise the sticky
   containing block is only as tall as the bar and the rail scrolls off-screen. */
.mo-party-sticky-slot {
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
  margin-bottom: 0;
}

.mo-party-sticky-slot.mo-party-sticky-slot--visible {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 950;
  margin-bottom: 12px;
}

.mo-skin .mo-footer-home {
  color: #0f766e;
  font-weight: 600;
}

.mo-skin .mo-footer-home:hover {
  color: #0f172a;
}

.mo-skin .mo-footer-sep {
  opacity: 0.4;
  color: #94a3b8;
}

.mo-help {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--mo-muted);
  margin-bottom: 14px;
}

.mo-data-warning {
  font-size: 0.88rem;
  line-height: 1.45;
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.mo-data-warning code {
  font-size: 0.8em;
  word-break: break-all;
}

/* Cards */
.mo-card {
  background: #fff;
  backdrop-filter: none;
  border-radius: var(--mo-radius);
  border: 1px solid #e2e8f0;
  box-shadow: var(--mo-shadow-card);
  margin-bottom: 16px;
  overflow: visible;
}

.mo-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #0f172a;
  background: #fafbfc;
  border-bottom: 1px solid #f1f5f9;
  position: relative;
}

.mo-card__head::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 48px;
  height: 1px;
  border-radius: 2px;
  background: linear-gradient(90deg, #c9a227, transparent);
  opacity: 0.85;
}

.mo-card__head-title {
  flex: 1;
  min-width: 0;
  padding-right: 10px;
}

.mo-btn-pdf {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: #25d366;
  background: #fff;
  border: 1px solid rgba(37, 211, 102, 0.45);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.mo-btn-pdf__wa {
  display: block;
  flex-shrink: 0;
}

.mo-btn-pdf:hover:not(:disabled) {
  background: #ecfdf5;
  border-color: #25d366;
  color: #128c7e;
  box-shadow: 0 1px 4px rgba(37, 211, 102, 0.2);
}

.mo-btn-pdf:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.mo-card__body {
  padding: 18px;
}

.mo-card__body--flush {
  padding: 12px 10px 14px;
}

.mo-party-expanded--minimal .mo-card__body {
  padding: 14px;
}

/* Party collapsed — light card; tap bar to change party */
.mo-party-collapsed {
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 14px 16px 16px;
  background: #fff;
  color: #0f172a;
  border-radius: var(--mo-radius);
  cursor: pointer;
  border: 1px solid #e2e8f0;
  box-shadow: var(--mo-shadow-card);
  transition:
    box-shadow 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.25s ease,
    padding 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.mo-party-collapsed:hover {
  border-color: #cbd5e1;
  box-shadow: var(--mo-shadow-float);
}

.mo-party-collapsed:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2), var(--mo-shadow-card);
}

.mo-party-collapsed:focus:not(:focus-visible) {
  box-shadow: var(--mo-shadow-card);
}

.mo-party-collapsed.is-visible {
  display: flex;
}

/* Pinned while scrolling: one-line party name only */
.mo-party-collapsed--compact.is-visible {
  padding: 10px 16px 12px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

/* Animate collapse (avoid display:none — it can’t transition) */
.mo-party-collapsed__details {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  min-height: 0;
  max-height: 600px;
  opacity: 1;
  overflow: hidden;
  transform: translateY(0);
  transition:
    max-height 0.34s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.26s ease,
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    margin 0.3s ease;
}

.mo-party-collapsed--compact .mo-party-collapsed__details {
  max-height: 0 !important;
  margin-top: 0;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  gap: 0;
}

.mo-party-collapsed--compact .mo-party-collapsed__name {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom-color: transparent;
  font-size: 0.875rem;
  line-height: 1.25;
}

.mo-party-collapsed__name {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  text-transform: none;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid #f1f5f9;
  color: #0f172a;
  transition:
    padding 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    margin 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.28s ease,
    font-size 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    line-height 0.3s ease;
}

.mo-party-collapsed__meta {
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.45;
  color: #475569;
  word-break: break-word;
}

.mo-party-collapsed__meta[hidden] {
  display: none;
}

.mo-party-collapsed__gstin {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #b45309;
  line-height: 1.35;
  word-break: break-all;
}

.mo-party-collapsed__gstin[hidden] {
  display: none;
}

.mo-party-collapsed__addr {
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
  color: #64748b;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  hyphens: auto;
}

.mo-party-collapsed__addr[hidden] {
  display: none;
}

.mo-party-collapsed__email {
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.35;
  color: #0f766e;
  word-break: break-all;
}

.mo-party-collapsed__email[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .mo-party-collapsed,
  .mo-party-collapsed__details,
  .mo-party-collapsed__name {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}

.mo-party-expanded.is-hidden {
  display: none;
}

.mo-search-wrap {
  position: relative;
}

.mobile-order-page .mo-party-expanded:not(.is-hidden) {
  position: relative;
  z-index: 100;
}

.mobile-order-page #itemSection.mo-card:not(.mo-section-disabled) {
  position: relative;
  z-index: 90;
}

.mobile-order-page #moGridSection {
  position: relative;
  z-index: 1;
}

.mo-search-wrap input,
.mo-search-wrap textarea {
  width: 100%;
  padding: 15px 16px;
  font-size: 1rem;
  line-height: 1.4;
  border: 1px solid #e2e8f0;
  border-radius: var(--mo-radius-sm);
  font-family: var(--font-body);
  font-weight: 500;
  background: var(--mo-input-bg);
  color: #0f172a;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.mo-search-wrap input::placeholder,
.mo-search-wrap textarea::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.mo-search-wrap input:focus,
.mo-search-wrap textarea:focus {
  outline: none;
  border-color: #0d9488;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

/* Item search: wrap long selected names, auto-height in JS */
.mo-item-card .mo-search-wrap textarea#itemSearch {
  display: block;
  min-height: 2.75rem;
  max-height: 7rem;
  resize: none;
  overflow-y: auto;
  overflow-x: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mo-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  max-height: min(55vh, 380px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: var(--mo-shadow-float);
  z-index: 1100;
  display: none;
}

.mo-suggestions.is-open {
  display: block;
}

.mo-suggestion {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
  width: 100%;
  background: #fff;
  border-left: none;
  border-right: none;
  border-top: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease;
}

.mo-suggestion:last-child {
  border-bottom: none;
}

.mo-suggestion:hover {
  background: #f8fafc;
}

.mo-suggestion:active {
  background: #f0fdfa;
}

.mo-suggestion__title {
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.35;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.mo-suggestion__line {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--mo-muted);
  margin-top: 5px;
  line-height: 1.4;
}

.mo-suggestion__detail {
  font-size: 0.75rem;
  line-height: 1.45;
  color: #94a3b8;
  margin-top: 7px;
  max-height: 2.9em;
  overflow: hidden;
}

/* Form fields */
.mo-field {
  margin-bottom: 14px;
}

.mo-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 7px;
}

.mo-field input,
.mo-field textarea {
  width: 100%;
  padding: 14px 15px;
  font-size: 1rem;
  line-height: 1.4;
  border: 1px solid #e2e8f0;
  border-radius: var(--mo-radius-sm);
  font-family: var(--font-body);
  font-weight: 500;
  background: var(--mo-input-bg);
  color: #0f172a;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.mo-field input::placeholder,
.mo-field textarea::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.mo-field textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.5;
}

.mo-field input:focus,
.mo-field textarea:focus {
  outline: none;
  border-color: #0d9488;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.mo-field input[readonly] {
  background: #f1f5f9;
  color: #334155;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border-color: #e2e8f0;
}

#fieldUnitPrice,
#fieldQty,
#fieldDiscount,
#fieldGst {
  font-variant-numeric: tabular-nums;
}

.mo-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.mo-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

/* Add item — single-screen compact layout */
.mo-item-card {
  margin-bottom: 14px;
}

.mo-item-card .mo-card__head::after {
  left: 12px;
  right: 12px;
  height: 1px;
  opacity: 0.28;
}

.mo-item-card__head {
  padding: 10px 16px !important;
  font-size: 1rem !important;
  font-family: var(--font-body) !important;
}

.mo-item-card__body {
  padding: 10px 12px 12px !important;
}

.mo-item-card .mo-field--tight {
  margin-bottom: 6px;
}

.mo-item-card .mo-field--tight label {
  font-size: 0.62rem;
  margin-bottom: 2px;
  letter-spacing: 0.05em;
}

.mo-item-card .mo-field input {
  padding: 9px 8px;
  font-size: 16px;
  line-height: 1.25;
  border-radius: 10px;
  border-width: 1px;
}

.mo-item-card .mo-field input:focus {
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.mo-item-card .mo-search-wrap input,
.mo-item-card .mo-search-wrap textarea#itemSearch {
  padding: 10px 12px;
  font-size: 16px;
  border-radius: 10px;
  border-width: 1px;
  line-height: 1.35;
}

.mo-item-card .mo-search-wrap input:focus,
.mo-item-card .mo-search-wrap textarea#itemSearch:focus {
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.mo-row-2--tight {
  gap: 8px;
}

.mo-btn-add--compact {
  margin-top: 6px;
  padding: 12px 16px;
  font-size: 0.82rem;
  letter-spacing: 0.07em;
  border-radius: 10px;
}

.mo-msg--compact {
  margin-top: 5px;
  min-height: 0;
  font-size: 0.78rem;
  line-height: 1.35;
}

@media (max-width: 360px) {
  .mo-item-card .mo-row-3 {
    gap: 6px;
  }

  .mo-item-card .mo-field--tight label {
    font-size: 0.58rem;
  }
}

.mo-btn-add {
  width: 100%;
  margin-top: 10px;
  padding: 16px 20px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 55%, #0f172a 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.2);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.mo-btn-add:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.22);
}

.mo-btn-add:active:not(:disabled) {
  transform: translateY(1px);
}

.mo-btn-add:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  filter: grayscale(0.2);
  box-shadow: none;
}

.mo-msg {
  margin-top: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  min-height: 1.35em;
  line-height: 1.45;
}

.mo-msg.error {
  color: #b91c1c;
}

.mo-msg.ok {
  color: #047857;
}

/* Grid */
.mo-grid-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -2px;
  border-radius: 12px;
  border: 1px solid #f1f5f9;
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 116, 139, 0.35) transparent;
}

.mo-grid {
  width: 100%;
  min-width: 640px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.84rem;
  font-weight: 500;
}

.mo-grid th,
.mo-grid td {
  border: 1px solid #f1f5f9;
  padding: 10px 8px;
  text-align: center;
  vertical-align: middle;
}

.mo-grid th {
  background: #f8fafc;
  font-weight: 600;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
}

.mo-grid thead th:first-child {
  border-top-left-radius: var(--mo-radius-xs);
}

.mo-grid thead th:last-child {
  border-top-right-radius: var(--mo-radius-xs);
}

.mo-grid tbody tr:nth-child(even) td {
  background: #fafbfc;
}

.mo-grid tbody tr:nth-child(odd) td {
  background: #fff;
}

.mo-grid td.mo-desc {
  text-align: left;
  max-width: 200px;
  font-size: 0.82rem;
  line-height: 1.4;
  color: #334155;
}

.mo-grid .mo-num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #0f172a;
}

.mo-grid-footer td {
  font-weight: 700;
  font-size: 0.88rem;
  background: #f0fdfa !important;
  border-top: 2px solid #ccfbf1;
  color: #0f172a;
}

.mo-remove {
  border: 1px solid #fecaca;
  background: #fff;
  color: #b91c1c;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  text-decoration: none;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.mo-remove:hover {
  background: #fef2f2;
  border-color: #f87171;
}

.mo-section-disabled {
  opacity: 0.45;
  pointer-events: none;
  filter: saturate(0.92);
}

/* Footer on this page — light bar to match form */
.mo-skin .footer {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.mo-skin .footer-bottom {
  padding: 20px 0 max(20px, env(safe-area-inset-bottom));
}

.mo-skin .footer-bottom p {
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: #64748b;
  opacity: 1;
}

@media (min-width: 480px) {
  .mo-grid {
    font-size: 0.9rem;
  }

  .mo-grid th {
    font-size: 0.72rem;
  }
}

@media (min-width: 600px) {
  .mobile-order-page .container {
    padding-left: 24px;
    padding-right: 24px;
  }
}
