:root {
  --teal: #1f6f78;
  --teal-deep: #18585f;
  --teal-soft: #e8f4f5;
  --teal-mid: #2a8a94;
  --accent: #f08a24;
  --ink: #1b2b2e;
  --ink-soft: #6b7a7e;
  --line: #dce6e8;
  --white: #ffffff;
  --danger: #d64545;
  --success: #1f8a4c;
  --radius: 18px;
  --shadow: 0 14px 34px rgba(31, 111, 120, 0.1);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Bai Jamjuree", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #edf6f7 0%, #f4f8f9 45%, #eef4f5 100%);
  position: relative;
}

button, input, textarea, select, option { font: inherit; }

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
  background-image:
    linear-gradient(rgba(31, 111, 120, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 111, 120, 0.06) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 92%);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1100px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0 64px;
  animation: rise-in 0.5s var(--ease) both;
}

/* ===== Menu ===== */
.menu-header {
  text-align: center;
  margin-bottom: 36px;
}

.system-label {
  margin: 0 0 6px;
  color: var(--teal-mid);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.system-name {
  margin: 0 0 14px;
  color: var(--teal-deep);
  font-size: clamp(2rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.menu-lead {
  margin: 0 auto;
  max-width: 560px;
  color: var(--ink-soft);
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.7;
  font-weight: 400;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.menu-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 360px));
  justify-content: center;
}

.menu-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  text-decoration: none;
  color: inherit;
  padding: 28px 26px 24px;
  min-height: 250px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.menu-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(31, 111, 120, 0.16);
}

.menu-card:focus-visible {
  outline: 3px solid rgba(42, 138, 148, 0.35);
  outline-offset: 3px;
}

.menu-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--teal-soft);
  color: var(--teal);
  margin-bottom: 18px;
}

.menu-icon svg {
  width: 26px;
  height: 26px;
}

.menu-index {
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.menu-title {
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.menu-desc {
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.5;
  margin-bottom: auto;
  padding-bottom: 22px;
}

.menu-cta {
  color: var(--teal-mid);
  font-size: 0.95rem;
  font-weight: 600;
  transition: transform 0.2s var(--ease);
}

.menu-card:hover .menu-cta {
  transform: translateX(4px);
}

/* ===== Sub pages ===== */
.page-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.page-bar h1 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--teal-deep);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--teal);
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.back-btn:hover {
  background: var(--teal-soft);
  border-color: #c5dce0;
}

.form-surface {
  width: min(520px, 100%);
  margin: 0 auto;
  padding: 28px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.form-surface-wide {
  width: min(640px, 100%);
}

.form-intro {
  margin-bottom: 22px;
}

.form-intro h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.form-intro p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.5;
}

.edit-banner {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(31, 111, 120, 0.2);
  background: linear-gradient(135deg, rgba(42, 138, 148, 0.12), rgba(31, 111, 120, 0.06));
}

.edit-banner strong {
  display: block;
  color: var(--teal-deep);
  font-size: 0.95rem;
}

.edit-banner span {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff;
  color: var(--teal);
  font-size: 0.8rem;
  font-weight: 700;
}

.edit-banner p {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #3a4a4d;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.field input {
  height: 48px;
}

.field textarea {
  padding: 12px 14px;
  resize: vertical;
  min-height: 96px;
  line-height: 1.5;
}

.field input:hover,
.field textarea:hover { border-color: #c5d4d7; }

.field input:focus,
.field textarea:focus {
  border-color: var(--teal-mid);
  box-shadow: 0 0 0 4px rgba(42, 138, 148, 0.14);
}

.field input::placeholder,
.field textarea::placeholder { color: #9aa8ab; }

.field-hint {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.addable-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.addable-row .ghost-btn {
  height: 40px;
  min-width: 0;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 0.84rem;
  font-weight: 600;
  flex: 0 0 auto;
}

.combo {
  position: relative;
  min-width: 0;
}

.combo-control {
  position: relative;
  display: flex;
  align-items: center;
}

.combo-control input {
  width: 100%;
  height: 48px;
  padding: 0 44px 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.combo-control input:hover {
  border-color: #c5d4d7;
}

.combo.is-open .combo-control input,
.combo-control input:focus {
  border-color: var(--teal-mid);
  box-shadow: 0 0 0 4px rgba(42, 138, 148, 0.14);
}

.combo-toggle {
  position: absolute;
  right: 6px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--teal);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}

.combo-toggle svg {
  width: 18px;
  height: 18px;
}

.combo-toggle:hover {
  background: var(--teal-soft);
}

.combo.is-open .combo-toggle {
  transform: rotate(180deg);
  background: var(--teal-soft);
}

.combo-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 240px;
  overflow: auto;
  padding: 6px;
  border: 1px solid #d7e4e6;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 36px rgba(31, 111, 120, 0.16);
  backdrop-filter: blur(10px);
  animation: combo-in 0.18s var(--ease);
}

.combo-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  padding: 11px 12px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.combo-option::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c9d7da;
  flex-shrink: 0;
}

.combo-option:hover,
.combo-option.is-active {
  background: var(--teal-soft);
  color: var(--teal-deep);
}

.combo-option:hover::before,
.combo-option.is-active::before {
  background: var(--teal);
}

.combo-option.is-selected {
  background: linear-gradient(135deg, rgba(42, 138, 148, 0.12), rgba(31, 111, 120, 0.08));
  color: var(--teal-deep);
  font-weight: 600;
}

.combo-empty {
  padding: 16px 12px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

@keyframes combo-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pin-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}

.pin-status {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.pin-status.is-ready {
  color: var(--success);
  font-weight: 500;
}

.pin-map-link {
  display: inline-block;
  margin-top: 8px;
}

.secondary-btn,
.ghost-btn,
.file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.secondary-btn,
.file-btn {
  height: 48px;
  padding: 0 16px;
  border: 0;
  background: linear-gradient(135deg, var(--teal-mid), var(--teal));
  color: #fff;
  white-space: nowrap;
}

.secondary-btn:hover,
.file-btn:hover {
  filter: brightness(1.05);
}

.secondary-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.ghost-btn {
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #f7fbfb;
  color: var(--teal);
  white-space: nowrap;
}

.ghost-btn:hover {
  background: var(--teal-soft);
  border-color: #c5dce0;
}

.ghost-btn.is-loading,
.ghost-btn:disabled {
  opacity: 0.85;
  cursor: wait;
  pointer-events: none;
}

.ghost-btn.is-loading {
  gap: 8px;
  min-width: 118px;
  background: var(--teal-soft);
  border-color: rgba(31, 111, 120, 0.28);
  color: var(--teal-deep);
}

.btn-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(31, 111, 120, 0.22);
  border-top-color: var(--teal);
  animation: spin 0.7s linear infinite;
  flex: 0 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.modal-trigger {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 14px 16px;
  border: 1px solid rgba(31, 111, 120, 0.14);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(232, 244, 245, 0.9));
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  box-shadow: 0 8px 20px rgba(31, 111, 120, 0.06);
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.modal-trigger-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.modal-trigger-icon {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(160deg, var(--teal-mid), var(--teal-deep));
  color: #fff;
  font-size: 0.95rem;
  box-shadow: 0 8px 16px rgba(31, 111, 120, 0.22);
}

.modal-trigger-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.modal-trigger-title {
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.35;
}

.modal-trigger-sub {
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.4;
}

.modal-trigger-count,
.modal-trigger strong {
  flex: 0 0 auto;
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(31, 111, 120, 0.1);
}

.modal-trigger:hover {
  border-color: rgba(42, 138, 148, 0.45);
  box-shadow: 0 12px 28px rgba(31, 111, 120, 0.12);
  transform: translateY(-1px);
}

.modal-trigger:active {
  transform: translateY(0);
}

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

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}

.field-label-row label {
  margin-bottom: 0;
}

.photo-count {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(31, 111, 120, 0.1);
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 700;
}

.photo-uploader {
  border: 1px solid rgba(31, 111, 120, 0.12);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(232, 244, 245, 0.55), rgba(255, 255, 255, 0.95));
  padding: 12px;
  box-shadow: 0 10px 24px rgba(31, 111, 120, 0.05);
}

.photo-dropzone {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 84px;
  padding: 14px 14px 14px 12px;
  border: 1.5px dashed rgba(31, 111, 120, 0.28);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
  color: var(--ink);
  margin: 0;
  font-weight: 500;
}

.photo-dropzone:hover {
  border-color: rgba(42, 138, 148, 0.55);
  background: #fff;
  box-shadow: 0 10px 22px rgba(31, 111, 120, 0.08);
  transform: translateY(-1px);
}

.photo-dropzone:active {
  transform: translateY(0);
}

.photo-dropzone-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--teal-mid), var(--teal-deep));
  color: #fff;
  box-shadow: 0 8px 16px rgba(31, 111, 120, 0.22);
  flex: 0 0 auto;
}

.photo-dropzone-icon svg {
  width: 24px;
  height: 24px;
}

.photo-dropzone-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.photo-dropzone-copy strong {
  display: block;
  color: var(--teal-deep);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.3;
}

.photo-dropzone-copy small {
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.4;
}

.photo-dropzone-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--teal-mid), var(--teal));
  color: #fff !important;
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 8px 16px rgba(31, 111, 120, 0.2);
}

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

.photo-preview:not(:empty) {
  margin-top: 12px;
}

.photo-preview-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.86rem;
  padding: 8px 4px 4px;
}

.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(31, 111, 120, 0.12);
  background: #eef5f6;
  box-shadow: 0 8px 18px rgba(31, 111, 120, 0.08);
  animation: rise-in 0.28s var(--ease) both;
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(18, 35, 38, 0.62);
  color: #fff;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  display: grid;
  place-items: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.photo-remove:hover {
  background: rgba(214, 69, 69, 0.9);
}

@media (max-width: 640px) {
  .photo-dropzone {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "icon copy"
      "cta cta";
    gap: 10px 12px;
    padding: 14px;
  }

  .photo-dropzone-icon { grid-area: icon; }
  .photo-dropzone-copy { grid-area: copy; }
  .photo-dropzone-cta {
    grid-area: cta;
    width: 100%;
    height: 44px;
  }
}

body.modal-open {
  overflow: hidden;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: end center;
  padding: 0;
}

.modal.is-open .modal-backdrop {
  animation: modal-fade-in 0.28s var(--ease) both;
}

.modal.is-open .modal-card {
  animation: modal-sheet-in 0.34s var(--ease) both;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 28, 31, 0.48);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(540px, 100%);
  max-height: min(92vh, 860px);
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, #f7fbfb 0%, #ffffff 28%, #ffffff 100%);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -8px 40px rgba(18, 35, 38, 0.18);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-bottom: 0;
}

.modal-sheet-handle {
  width: 42px;
  height: 5px;
  margin: 10px auto 0;
  border-radius: 999px;
  background: rgba(31, 111, 120, 0.22);
  flex: 0 0 auto;
}

.modal-header,
.modal-footer {
  padding: 14px 20px 16px;
}

.modal-footer {
  border-top: 1px solid rgba(220, 230, 232, 0.9);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-top: 8px;
}

.modal-heading {
  min-width: 0;
}

.modal-kicker {
  margin: 0 0 4px;
  color: var(--teal-mid);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--teal-deep);
  line-height: 1.3;
}

.modal-subtitle {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.45;
}

.modal-close {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(31, 111, 120, 0.08);
  color: var(--teal-deep);
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.modal-close:hover {
  background: rgba(31, 111, 120, 0.14);
  transform: scale(1.04);
}

.modal-body {
  padding: 4px 18px 18px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.product-rows {
  display: grid;
  gap: 14px;
}

.product-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(31, 111, 120, 0.1);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 24px rgba(31, 111, 120, 0.05);
  position: relative;
  overflow: visible;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.product-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--teal-mid), var(--teal));
  opacity: 0.35;
}

.product-row.is-filled {
  border-color: rgba(42, 138, 148, 0.28);
  box-shadow: 0 12px 28px rgba(31, 111, 120, 0.08);
}

.product-row.is-filled::before {
  opacity: 1;
}

.product-row-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.product-row-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: end;
}

.product-row.customer-row {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.2fr) 72px;
  gap: 8px;
  align-items: end;
}

.product-row.cheer-row {
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: 8px;
  align-items: end;
}

.product-row.cheer-row .product-row-qty input,
.product-row.customer-row .product-row-qty input {
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  padding: 0 6px;
  height: 50px;
}

.product-row.cheer-row .product-row-qty label {
  text-align: right;
  font-size: 0.75rem;
}

.product-row.cheer-row .fancy-select-value {
  font-size: 0.9rem;
}

.product-row.customer-row .product-row-brand .fancy-select-trigger,
.product-row.customer-row .product-row-name .fancy-select-trigger {
  padding-left: 10px;
  padding-right: 8px;
}

.product-row.customer-row .fancy-select-value {
  font-size: 0.88rem;
}

.product-row.customer-row .fancy-select-chevron {
  width: 24px;
  height: 24px;
  border-radius: 8px;
}

.product-row.customer-row label {
  font-size: 0.75rem;
  text-align: left;
}

.product-row.customer-row .product-row-name label {
  text-align: center;
}

.product-row.customer-row .product-row-qty label {
  text-align: right;
}

.product-row-field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #5a6b6f;
  letter-spacing: 0.01em;
}

.product-row-field select,
.product-row-field input[type="number"],
.product-row-field input[type="text"] {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  border: 1px solid rgba(220, 230, 232, 0.95);
  border-radius: 14px;
  background: #f8fbfb;
  color: var(--ink);
  outline: none;
  font-size: 1rem;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}

.fancy-select {
  position: relative;
  min-width: 0;
}

.fancy-select-trigger {
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px 0 14px;
  border: 1px solid rgba(220, 230, 232, 0.95);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #f4fafb);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  font: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}

.fancy-select-trigger:hover {
  border-color: rgba(42, 138, 148, 0.4);
  background: #fff;
}

.fancy-select.is-open .fancy-select-trigger,
.fancy-select-trigger:focus-visible {
  border-color: var(--teal-mid);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(42, 138, 148, 0.14);
  outline: none;
}

.fancy-select.has-value .fancy-select-trigger {
  border-color: rgba(31, 111, 120, 0.28);
}

.fancy-select-value {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--teal-deep);
}

.fancy-select-value.is-placeholder {
  color: #8a9a9e;
  font-weight: 500;
}

.fancy-select-chevron {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(31, 111, 120, 0.08);
  color: var(--teal);
  flex: 0 0 auto;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}

.fancy-select-chevron svg {
  width: 16px;
  height: 16px;
}

.fancy-select.is-open .fancy-select-chevron {
  transform: rotate(180deg);
  background: rgba(31, 111, 120, 0.14);
}

.fancy-select-menu {
  z-index: 120;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 8px;
  border: 1px solid rgba(31, 111, 120, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 40px rgba(18, 35, 38, 0.22);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: combo-in 0.18s var(--ease);
}

.fancy-select-menu[hidden] {
  display: none !important;
}

.fancy-select-search {
  flex: 0 0 auto;
  margin-bottom: 6px;
}

.fancy-select-search input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(31, 111, 120, 0.16);
  border-radius: 12px;
  background: #f7fbfb;
  color: var(--ink);
  outline: none;
  font: inherit;
}

.fancy-select-search input:focus {
  border-color: var(--teal-mid);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(42, 138, 148, 0.14);
}

.fancy-select-options {
  flex: 1 1 auto;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.fancy-select-empty {
  padding: 14px 10px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.fancy-select-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  padding: 12px 12px;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  font-size: 0.95rem;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.fancy-select-option[hidden],
.fancy-select-option.is-filtered-out {
  display: none !important;
}

.fancy-select-option::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid #c9d7da;
  background: #fff;
  flex-shrink: 0;
  box-sizing: border-box;
}

.fancy-select-option:hover {
  background: var(--teal-soft);
  color: var(--teal-deep);
}

.fancy-select-option:hover::before {
  border-color: var(--teal-mid);
}

.fancy-select-option.is-selected {
  background: linear-gradient(135deg, rgba(42, 138, 148, 0.16), rgba(31, 111, 120, 0.12));
  color: var(--teal-deep);
  font-weight: 700;
}

.fancy-select-option.is-selected::before {
  border-color: var(--teal);
  background: var(--teal);
  box-shadow: inset 0 0 0 3px #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 10.5L8.5 14L15 6.5' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 12px 12px;
  background-position: center;
  background-repeat: no-repeat;
}

.fancy-select-option[data-value=""] {
  color: var(--ink-soft);
  font-weight: 500;
}

.fancy-select-option[data-value=""]::before {
  display: none;
}

.product-row-field select {
  padding-right: 40px;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(180deg, #f8fbfb, #f8fbfb),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%231f6f78' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: 0 0, right 14px center;
  background-size: 100% 100%, 16px 16px;
}

.product-row-field select:focus,
.product-row-field input:focus {
  border-color: var(--teal-mid);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(42, 138, 148, 0.14);
}

.qty-stepper {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 8px;
  align-items: center;
}

.qty-stepper button {
  width: 44px;
  height: 50px;
  border: 1px solid rgba(31, 111, 120, 0.16);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #eef7f8);
  color: var(--teal-deep);
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s var(--ease), transform 0.15s var(--ease);
}

.qty-stepper button:hover {
  background: var(--teal-soft);
}

.qty-stepper button:active {
  transform: scale(0.96);
}

.qty-stepper input {
  text-align: center;
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: 0.02em;
}

.product-rows .empty-products {
  text-align: center;
  color: var(--ink-soft);
  padding: 36px 16px;
  border: 1px dashed rgba(31, 111, 120, 0.22);
  border-radius: 20px;
  background:
    radial-gradient(circle at top, rgba(232, 244, 245, 0.9), transparent 55%),
    #fafcfc;
  font-size: 0.95rem;
  line-height: 1.5;
}

.modal-add-panel {
  margin-top: 16px;
  border: 1px solid rgba(31, 111, 120, 0.12);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(232, 244, 245, 0.55), rgba(255, 255, 255, 0.9));
  overflow: hidden;
}

.modal-add-summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
}

.modal-add-summary::-webkit-details-marker {
  display: none;
}

.modal-add-summary strong {
  display: block;
  font-size: 0.95rem;
  color: var(--teal-deep);
}

.modal-add-summary small {
  display: block;
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.modal-add-summary-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(31, 111, 120, 0.12);
  color: var(--teal);
  font-size: 1.1rem;
  font-weight: 700;
  flex: 0 0 auto;
}

.modal-add-panel[open] .modal-add-summary {
  border-bottom: 1px solid rgba(31, 111, 120, 0.1);
}

.modal-add-block {
  margin-top: 0;
  padding: 14px 16px 16px;
  border-top: 0;
}

.modal-add-grid {
  display: grid;
  gap: 14px;
}

.modal-add-item label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #5a6b6f;
}

.modal-add-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.modal-add-row input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid rgba(220, 230, 232, 0.95);
  border-radius: 14px;
  background: #fff;
  outline: none;
}

.modal-add-row input:focus {
  border-color: var(--teal-mid);
  box-shadow: 0 0 0 4px rgba(42, 138, 148, 0.14);
}

.modal-add-row .ghost-btn {
  height: 48px;
  min-width: 72px;
  padding: 0 16px;
  border-radius: 14px;
  font-weight: 600;
}

.modal-done {
  margin-top: 0;
  height: 54px;
  font-size: 1.05rem;
  border-radius: 16px;
}

@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-sheet-in {
  from {
    opacity: 0.4;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 720px) {
  .modal {
    place-items: center;
    padding: 24px;
  }

  .modal.is-open .modal-card {
    animation-name: modal-card-in;
  }

  .modal-card {
    border-radius: 24px;
    max-height: min(84vh, 760px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 28px 60px rgba(18, 35, 38, 0.2);
  }

  .modal-sheet-handle {
    display: none;
  }

  .product-row.cheer-row {
    grid-template-columns: 1.45fr 0.7fr;
    align-items: end;
  }

  .product-row.customer-row {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.25fr) 84px;
    gap: 10px;
  }

  .product-row-pair {
    gap: 12px;
  }

  .modal-add-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .modal-add-row {
    grid-template-columns: 1fr auto;
  }
}

@keyframes modal-card-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.save-btn {
  width: 100%;
  height: 52px;
  margin-top: 6px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--teal-mid), var(--teal));
  color: #fff;
  font-weight: 600;
  font-size: 1.02rem;
  cursor: pointer;
  transition: transform 0.2s var(--ease), filter 0.2s var(--ease);
  box-shadow: 0 10px 22px rgba(31, 111, 120, 0.25);
}

.save-btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.save-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.message {
  min-height: 28px;
  margin: 12px 0 0;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
}

.message.success { color: var(--success); }
.message.error { color: var(--danger); }
.message.progress { color: var(--teal); }

.data-surface {
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.app-shell-data {
  width: min(1600px, calc(100% - 32px));
}

.data-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 20px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(180deg, #f7fbfb 0%, #eef6f7 100%);
}

.data-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 14px;
  min-height: 64px;
  padding: 12px 14px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    background 0.2s var(--ease),
    color 0.2s var(--ease),
    border-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease),
    transform 0.2s var(--ease);
}

.data-tab:hover {
  background: rgba(255, 255, 255, 0.72);
  color: var(--teal-deep);
}

.data-tab.is-active {
  background: #fff;
  color: var(--teal-deep);
  border-color: rgba(31, 111, 120, 0.14);
  box-shadow: 0 10px 24px rgba(31, 111, 120, 0.1);
}

.data-tab-index {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(31, 111, 120, 0.1);
  color: var(--teal);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
}

.data-tab.is-active .data-tab-index {
  background: var(--teal);
  color: #fff;
}

.data-tab-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.data-tab-copy strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-tab-copy small {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-tab.is-active .data-tab-copy small {
  color: #5f7d82;
}

.data-tab-panel[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .data-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .data-tab {
    flex: 0 0 auto;
    width: min(260px, 78vw);
  }
}

@media (max-width: 640px) {
  .data-tabs {
    padding: 6px;
    border-radius: 16px;
  }

  .data-tab {
    min-height: 58px;
    padding: 10px 12px;
    gap: 10px;
  }

  .data-tab-index {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 0.82rem;
  }

  .data-tab-copy strong {
    font-size: 0.88rem;
  }

  .data-tab-copy small {
    font-size: 0.72rem;
  }
}

.data-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.data-header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.data-subtitle {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.date-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7fbfb;
}

.date-filter-bar[hidden],
.date-filter-bar.is-hidden {
  display: none !important;
}

.date-filter-field {
  display: grid;
  gap: 4px;
  min-width: 150px;
}

.date-filter-field label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.date-filter-field input[type="date"],
.date-filter-field select {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
}

.date-filter-field input[type="date"]:focus,
.date-filter-field select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(31, 111, 120, 0.12);
}

.date-filter-sep {
  align-self: center;
  padding-top: 16px;
  color: var(--ink-soft);
  font-weight: 600;
}

.date-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.date-filter-btn {
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: var(--teal);
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.date-filter-btn:hover {
  filter: brightness(1.05);
}

.date-filter-btn.is-ghost {
  background: #fff;
  color: var(--teal-deep);
  border: 1px solid var(--line);
}

.date-filter-btn.is-ghost:hover {
  background: var(--teal-soft);
  border-color: #c5dce0;
  filter: none;
}

.district-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  margin: 0 0 16px;
}

.district-filter-field {
  min-width: 240px;
  flex: 1 1 240px;
}

.district-filter-field select {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
}

.district-filter-field select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(31, 111, 120, 0.12);
}

.district-filter-actions {
  margin-left: 0;
}

.multi-year-field {
  min-width: 220px;
  flex: 1 1 220px;
}

.multi-year-picker {
  position: relative;
}

.multi-year-trigger {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}

.multi-year-trigger:hover,
.multi-year-picker.is-open .multi-year-trigger {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(31, 111, 120, 0.12);
}

.multi-year-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.multi-year-caret {
  color: var(--ink-soft);
  flex-shrink: 0;
}

.multi-year-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 240px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 28px rgba(27, 43, 46, 0.12);
}

.multi-year-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

.multi-year-option:hover {
  background: var(--teal-soft);
}

.multi-year-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
}

.multi-year-empty {
  padding: 10px;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.summary-list {
  display: grid;
  gap: 14px;
}

.data-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1.5px solid #9bb8bc;
  border-radius: 12px;
  background: #fff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  min-width: 320px;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border: 1px solid #b7cbce;
}

.data-table th {
  background: #dceced;
  color: var(--teal-deep);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
}

.data-table tbody tr:nth-child(even) {
  background: #f7fbfb;
}

.data-table tbody tr:hover {
  background: #eef7f8;
}

.data-table .col-no {
  width: 56px;
  text-align: center;
  color: var(--ink-soft);
  font-weight: 700;
  vertical-align: middle;
}

.data-table .col-brand {
  width: 28%;
  color: var(--ink-soft);
  font-weight: 600;
}

.data-table .col-name {
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
}

.data-table .col-count,
.data-table .col-qty {
  width: 88px;
  text-align: right;
  font-weight: 700;
  color: var(--teal);
  white-space: nowrap;
}

.data-table tfoot td {
  background: #dceced;
  font-weight: 700;
  color: var(--teal-deep);
}

.summary-table-wrap {
  border-radius: 16px;
}

.summary-table {
  width: 100%;
  min-width: 520px;
}

.matrix-table-wrap {
  border-radius: 16px;
  overflow-x: auto;
}

.table-expand-shell {
  display: grid;
  gap: 10px;
}

.table-expand-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.table-expand-hint {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.table-expand-btn {
  height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(31, 111, 120, 0.22);
  border-radius: 10px;
  background: #fff;
  color: var(--teal-deep);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.table-expand-btn:hover {
  background: var(--teal-soft);
}

.table-expand-btn.is-close {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.table-fullscreen-root {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: #f4f8f9;
  padding: 16px 18px 20px;
}

.table-fullscreen-root[hidden] {
  display: none !important;
}

.table-fullscreen-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.table-fullscreen-kicker {
  margin: 0 0 2px;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.table-fullscreen-bar h3 {
  margin: 0;
  color: var(--teal-deep);
  font-size: 1.05rem;
}

.table-fullscreen-body {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 12px;
}

.table-fullscreen-body .table-expand-stage,
.table-fullscreen-body .data-table-wrap {
  max-height: none;
  overflow: visible;
}

.table-fullscreen-body .matrix-table,
.table-fullscreen-body .summary-table {
  width: max-content;
  min-width: 100%;
}

.table-fullscreen-body .records-table {
  table-layout: fixed;
  width: 100%;
  min-width: 1280px;
}

.table-fullscreen-body .records-table .col-shop {
  width: 150px;
}

.table-fullscreen-body .records-table .col-district {
  width: 110px;
}

.table-fullscreen-body .records-table .col-address {
  width: 170px;
  max-width: 170px;
}

.table-fullscreen-body .records-table .col-products {
  width: 22%;
}

.table-fullscreen-body .records-table .col-shop,
.table-fullscreen-body .records-table .col-district,
.table-fullscreen-body .records-table .col-address {
  overflow-wrap: anywhere;
  word-break: break-word;
}

body.is-table-fullscreen {
  overflow: hidden;
}

.matrix-table {
  width: max-content;
  min-width: 0;
  max-width: none;
  table-layout: auto;
}

.matrix-table th,
.matrix-table td {
  vertical-align: top;
}

.matrix-table .col-district {
  width: 160px;
  min-width: 140px;
  max-width: 200px;
  white-space: normal;
}

.matrix-table .col-brand-head {
  min-width: 180px;
  max-width: 220px;
  text-align: left;
  white-space: nowrap;
}

.matrix-table .col-brand-products {
  min-width: 180px;
  max-width: 220px;
  padding: 10px 12px;
}

.matrix-table .col-qty {
  width: 72px;
  min-width: 72px;
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}

.brand-product-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.brand-product-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(31, 111, 120, 0.12);
  font-size: 0.84rem;
}

.brand-product-list li:last-child {
  border-bottom: 0;
}

.brand-product-list li span {
  min-width: 0;
  color: var(--ink);
  line-height: 1.3;
}

.brand-product-list li strong {
  color: var(--teal-deep);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.brand-product-list li.is-zero strong {
  color: #b8c4c7;
  font-weight: 500;
}

.matrix-table .col-brand-head small {
  display: block;
  margin-top: 4px;
  color: rgba(27, 43, 46, 0.55);
  font-size: 0.72rem;
  font-weight: 500;
}

.matrix-table.is-compare .col-brand-head {
  text-align: center;
}

.matrix-table.is-compare .col-year-head {
  min-width: 150px;
  max-width: 200px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--teal-deep);
  background: #dceff1;
}

.matrix-table .col-pct-head,
.matrix-table.is-compare .col-pct-head {
  min-width: 88px;
  max-width: 110px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: #8a5a00;
  background: #fff4d9;
}

.matrix-table .col-pct-cell {
  min-width: 72px;
  max-width: 96px;
  text-align: right;
}

.brand-product-list.is-pct-only li {
  grid-template-columns: 1fr;
  justify-items: end;
}

.brand-product-list.is-pct-only li strong {
  min-width: 3.5ch;
  text-align: right;
}

.matrix-table .col-year-head {
  min-width: 120px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--teal-deep);
  background: #dceff1;
}

.brand-product-list li strong.is-up {
  color: #1f7a4d;
}

.brand-product-list li strong.is-down {
  color: #b42323;
}

.matrix-table.is-compare .col-brand-products {
  min-width: 150px;
  max-width: 200px;
}

.year-pair {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.compare-total-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
  align-items: end;
}

.compare-total-card .summary-total-note {
  grid-column: 1 / -1;
}

.summary-table .col-qty.is-up {
  color: #1f7a4d;
}

.summary-table .col-qty.is-down {
  color: #b42323;
}

.summary-total-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(42, 138, 148, 0.14), rgba(31, 111, 120, 0.08));
  border: 1px solid rgba(31, 111, 120, 0.12);
}

.summary-total-label {
  margin: 0 0 4px;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.summary-total-value {
  color: var(--teal-deep);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.summary-total-note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  text-align: right;
}

.summary-card {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid rgba(31, 111, 120, 0.1);
  border-radius: 16px;
  background: #fbfefe;
}

.summary-rank {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(31, 111, 120, 0.1);
  color: var(--teal-deep);
  font-weight: 700;
}

.summary-body h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
}

.summary-meta {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.summary-qty {
  text-align: right;
}

.summary-qty-label {
  display: block;
  color: var(--ink-soft);
  font-size: 0.75rem;
  margin-bottom: 2px;
}

.summary-qty strong {
  color: var(--teal);
  font-size: 1.2rem;
  font-weight: 700;
}

.count-badge {
  background: var(--teal-soft);
  color: var(--teal);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.records-list {
  display: grid;
  gap: 16px;
}

.records-table-wrap {
  border-radius: 16px;
}

.records-table {
  width: 100%;
  min-width: 1100px;
  table-layout: fixed;
}

.records-table .col-date {
  width: 100px;
  white-space: nowrap;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
  vertical-align: middle;
}

.records-table .col-shop {
  width: 150px;
  vertical-align: middle;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.records-table .col-shop strong {
  display: block;
  font-size: 0.95rem;
  color: var(--teal-deep);
  line-height: 1.35;
}

.records-table .col-shop small {
  display: block;
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.records-table .col-district {
  width: 110px;
  font-weight: 600;
  color: var(--ink);
  vertical-align: middle;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.records-table .col-address {
  width: 170px;
  white-space: normal;
  vertical-align: middle;
  color: var(--ink);
  line-height: 1.45;
  font-size: 0.88rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.records-table .col-map {
  width: 120px;
  min-width: 110px;
  text-align: center;
  vertical-align: middle;
}

.map-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 8px;
  background: #e8f4f5;
  color: var(--teal-deep);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}

.map-link-btn:hover {
  background: #d7ecee;
}

.map-coords {
  display: block;
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  line-height: 1.3;
}

.records-table .col-photos {
  width: 132px;
  min-width: 120px;
  vertical-align: middle;
}

.cell-photo-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
}

.cell-photo-thumb {
  display: block;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f3f7f8;
}

.cell-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cell-photo-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal-deep);
  font-size: 0.78rem;
  font-weight: 700;
}

.records-table .col-products {
  width: auto;
  padding: 0;
}

.records-table .col-action {
  width: 118px;
  text-align: center;
  vertical-align: middle;
}

.records-table .col-status {
  width: 96px;
  text-align: center;
  vertical-align: middle;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge.is-active {
  background: #e8f5ee;
  color: #1f7a4d;
}

.status-badge.is-cancelled {
  background: #f3f4f6;
  color: #6b7280;
}

.records-table tr.is-cancelled td {
  color: #9ca3af;
}

.records-table tr.is-cancelled strong {
  color: #9ca3af;
  text-decoration: line-through;
}

.action-btns {
  display: grid;
  gap: 6px;
  justify-items: center;
}

.edit-btn,
.delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  font-size: 0.84rem;
  text-decoration: none;
  cursor: pointer;
  border: 0;
}

.edit-btn {
  background: #e8f4f5;
  color: var(--teal-deep);
}

.edit-btn:hover {
  background: #d7ecee;
}

.delete-btn {
  background: #fdecec;
  color: #b42323;
}

.delete-btn:hover {
  background: #fad8d8;
}

.records-table .delete-btn {
  min-width: 64px;
}

.cell-muted {
  display: block;
  padding: 10px 12px;
  color: var(--ink-soft);
}

.cell-product-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.cell-product-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid #c9dbde;
  background: #fff;
  border-radius: 0;
}

.cell-product-list li:nth-child(even) {
  background: #f3f8f9;
}

.cell-product-list li:last-child {
  border-bottom: 0;
}

.cell-product-text {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.cell-product-text small {
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 600;
}

.cell-product-list li span {
  min-width: 0;
  line-height: 1.35;
  font-weight: 600;
  color: var(--ink);
}

.cell-product-list li strong {
  text-align: right;
  color: var(--teal-deep);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.records-table .delete-btn {
  min-width: 52px;
}

.record-card {
  border: 1px solid rgba(31, 111, 120, 0.12);
  border-radius: 20px;
  padding: 0;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(31, 111, 120, 0.05);
}

.record-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 16px 12px;
  background: linear-gradient(180deg, rgba(232, 244, 245, 0.7), rgba(255, 255, 255, 0.9));
  border-bottom: 1px solid rgba(31, 111, 120, 0.08);
}

.record-heading {
  min-width: 0;
}

.record-card h3 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--teal-deep);
  line-height: 1.35;
}

.record-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.record-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(31, 111, 120, 0.12);
  color: var(--teal-deep);
  font-size: 0.78rem;
  font-weight: 600;
}

.record-badge-muted {
  background: #eef2f3;
  color: #5f6f73;
}

.record-quick {
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}

.record-quick-label {
  display: block;
  margin-bottom: 4px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

.record-quick-item p {
  margin: 0;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.5;
}

.record-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.record-action-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(31, 111, 120, 0.08);
  color: var(--teal);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 700;
}

.record-action-muted {
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.record-sections {
  display: grid;
  gap: 0;
  border-top: 1px solid rgba(31, 111, 120, 0.08);
}

.record-section {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(31, 111, 120, 0.06);
}

.record-section:last-child {
  border-bottom: 0;
}

.record-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.record-section-head h4 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--teal-deep);
}

.record-section-head span {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

.record-product-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.record-product-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f6fbfb;
}

.record-product-text {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.record-product-text small {
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.record-product-name {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
}

.record-product-qty {
  flex: 0 0 auto;
  color: var(--teal);
  font-weight: 700;
  font-size: 0.95rem;
}

.record-empty-line,
.record-comment {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.5;
}

.record-comment {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f7f9fa;
  color: var(--ink);
}

.record-source-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.record-source-card {
  padding: 12px;
  border-radius: 12px;
  background: #f6fbfb;
  display: grid;
  gap: 4px;
}

.record-source-card span {
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 600;
}

.record-source-card strong {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  background: var(--teal-soft);
  color: var(--teal-deep);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 500;
}

.record-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.record-photos a {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  display: block;
}

.record-photos img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.map-link {
  color: var(--teal);
  text-decoration: none;
  font-weight: 600;
}

.map-link:hover { text-decoration: underline; }

.delete-btn {
  background: #fdecec;
  color: #b42323;
}

.delete-btn:hover {
  background: #fad8d8;
}

.records-table .delete-btn,
.records-table .edit-btn {
  min-width: 64px;
}

.record-meta {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.empty-state {
  text-align: center;
  padding: 42px 20px;
  color: var(--ink-soft);
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 960px) {
  .app-shell-data {
    width: min(1760px, calc(100% - 40px));
    padding: 36px 0 48px;
  }

  .app-shell-data .data-surface {
    padding: 28px 28px 32px;
  }

  .app-shell-data .data-tabs {
    max-width: none;
  }

  .app-shell-data .data-table {
    table-layout: fixed;
  }

  .app-shell-data .records-table,
  .app-shell-data .summary-table {
    min-width: 0;
  }

  .app-shell-data .records-table .col-no {
    width: 60px;
  }

  .app-shell-data .records-table .col-date {
    width: 100px;
  }

  .app-shell-data .records-table .col-shop {
    width: 150px;
  }

  .app-shell-data .records-table .col-district {
    width: 110px;
  }

  .app-shell-data .records-table .col-address {
    width: 170px;
  }

  .app-shell-data .records-table .col-products {
    width: 22%;
  }

  .app-shell-data .records-table .col-action {
    width: 110px;
  }

  .app-shell-data .cell-product-list {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .app-shell-data .data-table th,
  .app-shell-data .data-table td {
    padding: 14px 16px;
  }

  .app-shell-data .summary-table .col-name {
    width: auto;
  }

  .app-shell-data .summary-table .col-count,
  .app-shell-data .summary-table .col-qty {
    width: 120px;
  }
}

@media (max-width: 960px) {
  .menu-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: calc(100% - 24px);
    padding: 28px 0 40px;
  }

  .menu-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .menu-card {
    min-height: auto;
    padding: 22px 20px;
  }

  .field-row,
  .pin-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .addable-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
  }

  .addable-row .ghost-btn {
    height: 44px;
    padding: 0 10px;
    font-size: 0.8rem;
  }

  .addable-row .combo-control input {
    height: 44px;
  }

  .form-surface,
  .data-surface {
    padding: 18px;
  }

  .page-bar {
    flex-wrap: wrap;
  }

  .data-header,
  .record-card-top {
    flex-direction: column;
  }

  .date-filter-bar {
    align-items: stretch;
  }

  .date-filter-field {
    flex: 1 1 calc(50% - 20px);
    min-width: 0;
  }

  .date-filter-sep {
    display: none;
  }

  .date-filter-actions {
    width: 100%;
    margin-left: 0;
  }

  .date-filter-btn {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ===== Login ===== */
.login-shell {
  width: min(460px, calc(100% - 32px));
  padding-top: 72px;
}

.login-card {
  padding: 28px 26px 24px;
}

.login-intro h1 {
  margin: 0 0 8px;
  color: var(--teal-deep);
  font-size: 1.8rem;
  font-weight: 700;
}

.login-intro p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

.login-intro .system-label {
  margin-bottom: 10px;
}

.auth-user-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.page-bar .auth-user-bar {
  margin-top: 0;
  margin-left: auto;
  justify-content: flex-end;
}

.auth-user-name {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.auth-user-name strong {
  color: var(--teal-deep);
  font-weight: 700;
}

.auth-logout-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-logout-btn:hover {
  border-color: #c9d7da;
  background: var(--teal-soft);
  color: var(--teal-deep);
}

/* ===== App Dialog Modal ===== */
.app-dialog {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s var(--ease);
}

.app-dialog.is-open {
  opacity: 1;
  pointer-events: auto;
}

.app-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 38, 42, 0.48);
  backdrop-filter: blur(4px);
}

.app-dialog-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 28px 24px 22px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(18, 38, 42, 0.22);
  text-align: center;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s var(--ease);
}

.app-dialog.is-open .app-dialog-card {
  transform: translateY(0) scale(1);
}

.app-dialog-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  font-size: 1.45rem;
  font-weight: 700;
  background: var(--teal-soft);
  color: var(--teal-deep);
}

.app-dialog-icon.is-danger,
.app-dialog-icon.is-error {
  background: #fdecec;
  color: var(--danger);
}

.app-dialog-icon.is-success {
  background: #e8f7ee;
  color: var(--success);
}

.app-dialog-icon.is-logout {
  background: #fff4e8;
  color: var(--accent);
}

.app-dialog-title {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 700;
}

.app-dialog-message {
  margin: 0 0 22px;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.65;
}

.app-dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.app-dialog-btn {
  min-width: 120px;
  height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  border: 0;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s var(--ease), filter 0.15s var(--ease), background 0.15s var(--ease);
}

.app-dialog-btn.is-primary {
  background: linear-gradient(135deg, var(--teal-mid), var(--teal));
  color: #fff;
  box-shadow: 0 10px 20px rgba(31, 111, 120, 0.22);
}

.app-dialog-btn.is-danger {
  background: linear-gradient(135deg, #e35b5b, var(--danger));
  color: #fff;
  box-shadow: 0 10px 20px rgba(214, 69, 69, 0.22);
}

.app-dialog-btn.is-ghost {
  background: #f3f6f7;
  color: var(--ink);
}

.app-dialog-btn:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
}

.app-dialog-btn:focus-visible {
  outline: 3px solid rgba(42, 138, 148, 0.28);
  outline-offset: 2px;
}

/* ===== Loading Modal ===== */
.app-loading {
  position: fixed;
  inset: 0;
  z-index: 4500;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s var(--ease);
}

.app-loading.is-open {
  opacity: 1;
  pointer-events: auto;
}

.app-loading-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 38, 42, 0.5);
  backdrop-filter: blur(4px);
}

.app-loading-card {
  position: relative;
  z-index: 1;
  width: min(360px, 100%);
  padding: 28px 24px 24px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(18, 38, 42, 0.22);
  text-align: center;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.2s var(--ease);
}

.app-loading.is-open .app-loading-card {
  transform: translateY(0) scale(1);
}

.app-loading-spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border: 4px solid #d9ecee;
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: app-spin 0.8s linear infinite;
}

.app-loading-title {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 700;
}

.app-loading-message {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.55;
}

body.is-app-loading {
  overflow: hidden;
}

@keyframes app-spin {
  to { transform: rotate(360deg); }
}
