/* Phone layout. Inline sizes on the design pages win unless marked important. */

@media (max-width: 780px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  #dc-mount,
  #dc-mount * {
    box-sizing: border-box;
  }

  h1,
  h2,
  p,
  .ynw-badge:not(.ynw-badge--status) {
    overflow-wrap: break-word;
  }

  .ynw-badge:not(.ynw-badge--status) {
    height: auto;
    max-width: 100%;
    white-space: normal;
    line-height: 1.35;
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .ynw-btn:not(.ynw-btn--icon) {
    min-height: 40px;
    height: auto;
    white-space: normal;
    text-align: center;
  }

  .ynw-field {
    min-width: 0 !important;
    flex: 1 1 100% !important;
    width: 100%;
    max-width: 100%;
  }

  .ynw-input,
  .ynw-select,
  .ynw-textarea {
    font-size: 16px;
    max-width: 100%;
  }

  .ynw-seg {
    display: flex;
    flex-wrap: wrap;
    max-width: 100%;
  }

  .ynw-toast {
    width: auto;
    max-width: 100%;
  }

  .ynw-scrim {
    padding: 12px;
    align-items: end;
  }

  .ynw-modal-foot {
    flex-wrap: wrap;
  }

  aside.ynw-side {
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand logout"
      "nav nav";
    align-items: center;
    flex: 1 1 100% !important;
    width: 100% !important;
    height: auto !important;
    max-width: 100%;
    border-right: 0;
    border-bottom: var(--bw-hairline) solid var(--border);
    background: var(--surface);
  }

  .ynw-side-ws {
    grid-area: brand;
    min-width: 0;
    border-bottom: 0;
    padding: 10px 8px 0 12px;
  }

  .ynw-side-ws .ynw-mono {
    display: none;
  }

  .ynw-side-ws b {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ynw-side-scroll {
    grid-area: nav;
    display: block;
    overflow: visible;
    padding: 6px 8px 8px;
  }

  .ynw-side-scroll > .ynw-side-group:not(nav) {
    display: none;
  }

  nav.ynw-side-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  nav.ynw-side-group > .ynw-eyebrow {
    display: none;
  }

  .ynw-side-item {
    flex: 0 1 auto;
    height: 36px;
    padding: 0 10px;
    background: var(--bg);
    border: var(--bw-hairline) solid var(--border);
  }

  .ynw-side-foot {
    grid-area: logout;
    display: flex !important;
    align-items: center;
    border-top: 0;
    padding: 10px 8px 0 0;
  }

  .ynw-side-foot > .ynw-avatar,
  .ynw-side-foot > div {
    display: none !important;
  }

  #dc-mount > div[lang] {
    max-width: 100%;
    min-width: 0;
  }

  main {
    flex: 1 1 100% !important;
    max-width: 100%;
    min-width: 0 !important;
    padding: 16px 12px 48px !important;
  }

  main > * {
    min-width: 0;
    max-width: 100%;
  }

  .ynw-card {
    padding: 12px;
  }

  [style*="overflow-x: auto"],
  [style*="overflow: hidden"] {
    position: relative;
    max-width: 100%;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
  }

  [style*="overflow-x: auto"] > table {
    min-width: 36rem;
  }

  span[style*="clip: rect"] {
    left: 0 !important;
    top: 0 !important;
  }

  div[style*="140px minmax(0, 1fr) 90px 60px"] {
    grid-template-columns: minmax(0, 1.1fr) minmax(48px, 1.3fr) auto auto !important;
    gap: 6px !important;
  }

  div[style*="140px minmax(0, 1fr) 90px 60px"] > span:first-child {
    overflow-wrap: anywhere;
  }

  div[role="img"] {
    gap: 2px !important;
    height: 160px !important;
  }

  div[role="img"] span,
  div[role="img"] + div span {
    font-size: 9px !important;
    line-height: 1;
  }

  div[role="img"] + div {
    gap: 2px !important;
  }

  article.ynw-card .ynw-select-wrap,
  article.ynw-card input.ynw-input {
    flex: 1 1 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100%;
  }

  article.ynw-card div[style*="padding-left: 40px"],
  div[style*="padding-left: 44px"] {
    padding-left: 0 !important;
  }

  span.ynw-card-index[style*="padding-top: 30px"],
  article.ynw-card div[style*="padding-top: 26px"] {
    padding-top: 0 !important;
  }

  section[aria-label="เกี่ยวกับพอร์ทัล"] {
    flex: 1 1 100% !important;
    min-height: 0 !important;
    gap: 16px !important;
    padding: 20px 16px !important;
    border-right: 0 !important;
    border-bottom: var(--bw-hairline) solid var(--border);
  }

  section[aria-label="เกี่ยวกับพอร์ทัล"] h1 {
    font-size: 28px !important;
    letter-spacing: -0.03em !important;
  }

  section[aria-label="เกี่ยวกับพอร์ทัล"] p {
    font-size: 15px !important;
  }

  section[aria-label="เข้าสู่ระบบ"] {
    flex: 1 1 100% !important;
    align-items: stretch !important;
    padding: 24px 16px 48px !important;
  }

  div[style*="padding: var(--space-12) var(--space-10)"] {
    min-height: 0 !important;
    padding: 16px 12px 40px !important;
  }

  div[style*="minmax(340px"],
  div[style*="minmax(300px"],
  div[style*="minmax(180px"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  div[style*="24px 1fr 80px 70px"] {
    grid-template-columns: 16px minmax(0, 1fr) 28px 22px !important;
    gap: 8px !important;
  }
}
