/* Lịch Việt v16.52 r13 · Motion Studio mobile editor / native date field.
   Route-scoped and loaded AFTER the immutable v16.42 production bundle.
   Keep the native iOS date picker, template radio controls and draft/export JS unchanged. */
body[data-page="motion"] .motion-studio,
body[data-page="motion"] .motion-studio .motion-layout,
body[data-page="motion"] .motion-studio .motion-editor,
body[data-page="motion"] .motion-studio #motion-quick-edit {
  min-inline-size: 0;
  max-inline-size: 100%;
  box-sizing: border-box;
}
body[data-page="motion"] .motion-studio #motion-quick-edit > .motion-field,
body[data-page="motion"] .motion-studio #motion-quick-edit > .motion-templates {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  inline-size: 100%;
  min-inline-size: 0;
  max-inline-size: 100%;
  box-sizing: border-box;
}
/* Safari can supply an intrinsic min-content width to date controls.  Constrain
   every ancestor and the actual date input; never hide the overflow of the card
   or replace the native picker with a text input. */
body[data-page="motion"] .motion-studio #motion-date {
  display: block !important;
  box-sizing: border-box !important;
  inline-size: 100% !important;
  width: 100% !important;
  min-inline-size: 0 !important;
  min-width: 0 !important;
  max-inline-size: 100% !important;
  max-width: 100% !important;
  min-height: 48px !important;
  margin: 0 !important;
  padding: 10px 12px !important;
  border-radius: 12px !important;
  -webkit-appearance: auto !important;
  appearance: auto !important;
  font-size: 16px !important;
  line-height: 1.4 !important;
  text-align: start;
  color: var(--m-ink) !important;
  background-color: var(--m-panel) !important;
  border: 1px solid var(--m-line) !important;
  color-scheme: light;
}
:root[data-theme="dark"] body[data-page="motion"] .motion-studio #motion-date {
  background-color: #1a5144 !important;
  color-scheme: dark;
}
body[data-page="motion"] .motion-studio #motion-date::-webkit-date-and-time-value {
  min-height: 1.35em;
  line-height: 1.35;
  text-align: start;
}
body[data-page="motion"] .motion-studio #motion-date::-webkit-datetime-edit {
  min-width: 0;
  max-width: 100%;
  padding: 0;
}
/* A single design language for the template library: equal columns/rows,
   readable names, no fixed-height truncation or tiny 9px descriptions. */
body[data-page="motion"] .motion-studio #motion-templates {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  grid-auto-flow: row;
  align-items: stretch;
  gap: 9px !important;
  margin-block: 12px 0 !important;
  padding: 0 !important;
  border: 0 !important;
}
body[data-page="motion"] .motion-studio #motion-templates > legend {
  width: 100%;
  padding: 0;
  margin-block-end: 9px;
  font-size: 14px !important;
  color: var(--m-ink) !important;
}
body[data-page="motion"] .motion-studio #motion-templates > .motion-template {
  box-sizing: border-box;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  width: 100%;
  min-width: 0 !important;
  height: 100%;
  min-height: 0 !important;
  gap: 8px !important;
  padding: 9px !important;
  border-radius: 12px !important;
  overflow: visible;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}
body[data-page="motion"] .motion-studio #motion-templates .motion-template-swatch {
  box-sizing: border-box;
  width: 100% !important;
  height: 80px !important;
  min-height: 0 !important;
  flex: 0 0 auto;
  border-radius: 9px !important;
  overflow: hidden;
}
body[data-page="motion"] .motion-studio #motion-templates .motion-template > span:last-child {
  display: block;
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
}
body[data-page="motion"] .motion-studio #motion-templates .motion-template strong {
  display: block;
  font-size: 14px !important;
  font-weight: 700;
  line-height: 1.4 !important;
  color: var(--m-ink) !important;
  overflow-wrap: break-word;
  word-break: normal;
}
body[data-page="motion"] .motion-studio #motion-templates .motion-template small {
  display: block !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
  color: var(--motion-muted-readable, var(--m-muted)) !important;
  margin-block-start: 4px;
  overflow-wrap: break-word;
  word-break: normal;
}
body[data-page="motion"] .motion-studio #motion-templates .motion-template:has(input:checked) {
  border-color: #087860 !important;
  box-shadow: inset 0 0 0 1px #087860 !important;
}
:root[data-theme="dark"] body[data-page="motion"] .motion-studio #motion-templates .motion-template:has(input:checked) {
  border-color: #91d6b4 !important;
  box-shadow: inset 0 0 0 1px #91d6b4 !important;
}
/* A+ enlarges meaningful labels, while preserving the two-column geometry. */
html[data-lvg-font-scale="115"] body[data-page="motion"] #motion-templates .motion-template strong {font-size: 15px !important;}
html[data-lvg-font-scale="115"] body[data-page="motion"] #motion-templates .motion-template small {font-size: 13px !important;}
html[data-lvg-font-scale="130"] body[data-page="motion"] #motion-templates .motion-template strong {font-size: 17px !important;}
html[data-lvg-font-scale="130"] body[data-page="motion"] #motion-templates .motion-template small {font-size: 14px !important;}
html[data-lvg-font-scale="115"] body[data-page="motion"] #motion-date {font-size: 18px !important;}
html[data-lvg-font-scale="130"] body[data-page="motion"] #motion-date {font-size: 20px !important;}
@media (max-width: 600px) {
  body[data-page="motion"] .motion-studio #motion-templates {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px !important;
  }
  body[data-page="motion"] .motion-studio #motion-templates .motion-template-swatch {height: 76px !important;}
}
@media (max-width: 360px) {
  body[data-page="motion"] .motion-studio #motion-templates {gap: 8px !important;}
  body[data-page="motion"] .motion-studio #motion-templates > .motion-template {padding: 8px !important;}
  body[data-page="motion"] .motion-studio #motion-templates .motion-template-swatch {height: 70px !important;}
}
@media (prefers-reduced-motion: reduce) {
  body[data-page="motion"] .motion-studio #motion-templates .motion-template {transition: none !important;}
}
