/**
 * Mobile non-native date picker (tap day = confirm).
 * Desktop: no styles — keep system type=date.
 */
@media (max-width: 768px) {
  html,
  body {
    overflow-x: hidden;
    max-width: 100%;
    width: 100%;
  }

  .form-group,
  .filter-item,
  .filter-group,
  .form-section,
  form,
  #saleForm {
    min-width: 0;
    max-width: 100%;
  }

  /* Trigger field (text) — never uses type=date min-content */
  .shimei-date-field {
    position: relative;
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .shimei-date-field .shimei-date-display {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    cursor: pointer;
    background: #fff;
  }

  /* Hide original type=date after enhance (value still used by business code) */
  .shimei-date-field input[type="date"].shimei-date-source,
  .shimei-date-field input[type="datetime-local"].shimei-date-source,
  .shimei-date-field input[type="month"].shimei-date-source,
  .shimei-date-field input[type="time"].shimei-date-source,
  .shimei-date-field input[type="week"].shimei-date-source {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-width: 0 !important;
    max-width: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    border: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .shimei-date-scrim {
    position: fixed;
    inset: 0;
    z-index: 10040;
    background: rgba(15, 23, 42, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
  }

  .shimei-date-scrim.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  body.shimei-date-open {
    overflow: hidden !important;
  }

  .shimei-date-pop {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.98);
    z-index: 10050;
    width: min(360px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.2);
    padding: 0 0 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
  }

  .shimei-date-pop.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
  }

  .shimei-date-pop-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 12px 8px;
    border-bottom: 1px solid #f1f5f9;
  }

  .shimei-date-pop-head strong {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
  }

  .shimei-date-pop-head button {
    appearance: none;
    border: 0;
    background: transparent;
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    min-height: 36px;
    padding: 0 8px;
    border-radius: 10px;
    cursor: pointer;
  }

  .shimei-date-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px 4px;
  }

  .shimei-date-nav button {
    width: 36px;
    height: 36px;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    color: #0369a1;
    font-family: inherit;
  }

  .shimei-date-nav strong {
    font-size: 14px;
    font-weight: 700;
    color: #0369a1;
  }

  .shimei-date-dow,
  .shimei-date-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    padding: 0 10px;
    text-align: center;
    box-sizing: border-box;
  }

  .shimei-date-dow span {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    padding: 4px 0;
  }

  .shimei-date-days button {
    border: 0;
    background: transparent;
    min-height: 40px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    cursor: pointer;
    font-family: inherit;
  }

  .shimei-date-days button.mute {
    color: #cbd5e1;
  }

  .shimei-date-days button.is-today {
    box-shadow: inset 0 0 0 1.5px #0ea5e9;
    color: #0369a1;
  }

  .shimei-date-days button.is-selected {
    background: #0284c7;
    color: #fff;
    box-shadow: none;
  }

  .shimei-date-days button:not(.mute):active {
    background: #e0f2fe;
  }

  .shimei-date-hint {
    margin: 8px 12px 0;
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    text-align: center;
  }
}
