.phone-tabs, .phone-drawer-scrim { display: none; }

@media (max-width: 759px) {
  :root {
    --phone-nav-h: 54px;
    --phone-bottom: env(safe-area-inset-bottom, 0px);
    --phone-top: env(safe-area-inset-top, 0px);
    --phone-left: env(safe-area-inset-left, 0px);
    --phone-right: env(safe-area-inset-right, 0px);
  }

  .topbar {
    min-height: calc(var(--topbar-h) + var(--phone-top));
    padding-block-start: var(--phone-top);
    padding-inline: max(12px, var(--phone-left)) max(12px, var(--phone-right));
  }
  .auth, .public-page {
    padding-inline: max(16px, var(--phone-left)) max(16px, var(--phone-right));
    padding-block-start: max(24px, var(--phone-top));
    padding-block-end: max(24px, var(--phone-bottom));
  }
  .topbar .breadcrumb { min-width: 0; }
  .topbar .crumb-link { max-width: 9ch; }
  .mobile-menu, .mobile-close, .header-controls .icon-button, .header-controls .command-button {
    min-width: 44px;
    min-height: 44px;
  }
  .phone-drawer-scrim:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 599;
    background: rgb(12 9 18 / .48);
  }
  html:has(.phone-drawer-scrim:not([hidden])) { overflow: hidden; }
  .sidebar {
    padding-block: var(--phone-top) var(--phone-bottom);
    padding-inline-start: var(--phone-left);
  }
  .sidebar.is-open { box-shadow: none; }
  .sidebar[data-phone-panel="work"] :is(.nav-section[aria-label="채널"], .work-utility-nav) { display: none; }
  .sidebar .nav-item, .sidebar .workspace-select { min-height: 44px; }

  .phone-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed;
    inset: auto 0 0;
    z-index: 80;
    min-height: calc(var(--phone-nav-h) + var(--phone-bottom));
    padding: 3px max(5px, var(--phone-right)) calc(3px + var(--phone-bottom)) max(5px, var(--phone-left));
    border-top: 1px solid var(--c-line);
    background: var(--c-surface);
    gap: 3px;
  }
  .phone-tab {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 2px;
    min-width: 0;
    min-height: 47px;
    padding: 2px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--c-ink-3);
    font: inherit;
    font-size: 12px;
    line-height: 1.25;
    cursor: pointer;
  }
  .phone-tab .work-icon { width: 20px; height: 20px; }
  .phone-tab:active, .phone-tab[aria-current="page"] {
    background: var(--c-primary-soft);
    color: var(--c-accent-text);
  }
  .phone-tab[aria-current="page"] { font-weight: 700; }

  .content {
    padding-inline: max(var(--pad-x), var(--phone-left)) max(var(--pad-x), var(--phone-right));
    padding-bottom: calc(24px + var(--phone-bottom));
  }
  .work:has(.phone-tabs) > .content { padding-bottom: calc(var(--phone-nav-h) + 22px + var(--phone-bottom)); }
  .work:has(.channel-screen) { height: var(--phone-visible-height, 100dvh); }
  .work > .content.channel-screen { padding-bottom: calc(8px + var(--phone-bottom)); }
  .work:has(.phone-tabs) > .content.channel-screen { padding-bottom: calc(var(--phone-nav-h) + 8px + var(--phone-bottom)); }
  [data-phone-keyboard] .phone-tabs { display: none; }
  [data-phone-keyboard] .work:has(.phone-tabs) > .content { padding-bottom: 20px; }
  [data-phone-keyboard] .work:has(.phone-tabs) > .content.channel-screen { padding-bottom: 6px; }
  .composer > .input { font-size: 16px; }
  .composer > .button { min-width: 52px; min-height: 44px; }
  .channel-screen > .tabs .tab { min-height: 44px; }
  .channel-screen > .screen-heading > .actions > .button { min-height: 42px; }
  .content .screen-heading h1 { overflow-wrap: anywhere; }
  .content .screen-heading > .actions { max-width: 100%; }
  .content.view-home .screen-heading .button { min-height: 44px; }
  .home-widget-controls .icon-button { min-width: 44px; min-height: 44px; }
  .calendar-toolbar .segment, .calendar-moves .icon-button, .calendar-toolbar .button { min-height: 44px; }
  .calendar-moves .icon-button { min-width: 44px; }
  .agenda-event-select, .agenda-event-open { min-height: 44px; }
  .agenda-event-select { min-width: 38px; }
  .agenda-event-open { white-space: normal; overflow-wrap: anywhere; }
  .agenda-event-row > .small { overflow-wrap: anywhere; }
  .modal { max-height: min(92dvh, calc(var(--phone-visible-height, 100dvh) - 12px - var(--phone-top))); }
  .modal-form { padding-bottom: calc(16px + var(--phone-bottom)); }
  .modal-form > .input, .modal-form .field > .input, .modal-form .field > .we-input { font-size: 16px; }
  .modal-head .icon-button { min-width: 44px; min-height: 44px; }
  .toast { bottom: calc(var(--phone-nav-h) + 14px + var(--phone-bottom)); overflow-wrap: anywhere; }
  [data-phone-keyboard] .toast { bottom: calc(12px + var(--phone-bottom)); }

  .we-page-save .we-btn, .we-event-properties button, .we-page-options .we-btn { min-height: 42px; }
  .we-editor .we-input:not(.we-title) { font-size: 16px; }
  .we-block:focus-within > .we-controls > .we-icon { min-height: 34px; }
  :is(.view-page, .view-table) .we-scroll {
    min-inline-size: 0;
    overscroll-behavior-inline: contain;
  }
}

@media (max-width: 540px) and (pointer: coarse) {
  .calendar-day, .calendar-blank { min-height: 46px; padding: 0; }
  .calendar-day-head { height: 100%; }
  .calendar-day .day-number {
    width: 100%;
    height: 100%;
    min-height: 44px;
    padding-block-end: 4px;
    font-size: 13px;
  }
  .calendar-day.has-calendar-items .day-number::after {
    content: '';
    position: absolute;
    inset: auto 0 6px;
    margin-inline: auto;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
  }
  .calendar-day .day-number { position: relative; }
  .calendar-day > :is(.day-event, span) { display: none; }
  .agenda-actions .button { min-height: 42px; }
}

.phone-doc-scale { display: none; }

@supports (zoom: .8) {
  @media (max-width: 759px) {
    .phone-doc-scale {
      display: flex;
      align-items: center;
      align-self: end;
      gap: 8px;
      margin: 4px max(var(--pad-x), var(--phone-right)) 0 max(var(--pad-x), var(--phone-left));
      color: var(--c-ink-3);
      font-size: .8rem;
      font-weight: 650;
    }
    .phone-doc-scale > span { white-space: nowrap; }
    .phone-doc-scale > .input {
      width: auto;
      min-width: 78px;
      min-height: 44px;
      padding-inline: 10px;
      font-size: 16px;
      color: var(--c-ink);
    }
    .phone-doc-scale + .content { padding-block-start: 8px; }
    .phone-doc-scale + .content > .we-editor {
      zoom: var(--work-document-scale);
    }
    /* These use viewport coordinates or their own responsive dialog layout. */
    .phone-doc-scale + .content > .we-editor :is(.we-format-toolbar, .we-drag-rectangle, .we-modal) {
      zoom: var(--work-document-unzoom);
    }
  }
}
